projects
/
my-code
/
hdw-sniff.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a1ec80d
)
added ip header support
author
hackbard
<hackbard>
Fri, 6 Sep 2002 22:37:09 +0000
(22:37 +0000)
committer
hackbard
<hackbard>
Fri, 6 Sep 2002 22:37:09 +0000
(22:37 +0000)
hdw-sniff.c
patch
|
blob
|
history
diff --git
a/hdw-sniff.c
b/hdw-sniff.c
index
8f11c82
..
e49ec34
100644
(file)
--- a/
hdw-sniff.c
+++ b/
hdw-sniff.c
@@
-26,6
+26,7
@@
int main(int argc, char *argv[]) {
const u_char *package;
struct pcap_pkthdr pcap_header;
struct ethhdr *e_hdr;
const u_char *package;
struct pcap_pkthdr pcap_header;
struct ethhdr *e_hdr;
+ struct ip *ip_hdr;
struct ieee802_11_hdr *w_hdr;
/* parse the arguments */
struct ieee802_11_hdr *w_hdr;
/* parse the arguments */
@@
-73,7
+74,9
@@
int main(int argc, char *argv[]) {
printf("%x%s",*(e_hdr->h_source+i),((i==ETH_ALEN-1)?"\n":":"));
if(ntohs(e_hdr->h_proto)==ETH_P_IP) {
printf("ip protocol: ");
printf("%x%s",*(e_hdr->h_source+i),((i==ETH_ALEN-1)?"\n":":"));
if(ntohs(e_hdr->h_proto)==ETH_P_IP) {
printf("ip protocol: ");
- // printf("
+ ip_hdr=(struct ip *)(package+sizeof(struct ethhdr));
+ printf("version = %x ",ntohs(ip_hdr->ip_v:4));
+ printf("header length = %x\n",ntohs(ip_hdr->ip_hl:4));
}
printf("rest:\n");
for(i=sizeof(struct ethhdr);i<pcap_header.caplen;i++)
}
printf("rest:\n");
for(i=sizeof(struct ethhdr);i<pcap_header.caplen;i++)