1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
diff --exclude='*~' -Naur src.orig/lc.c src/lc.c
--- src.orig/lc.c 2006-07-26 14:30:24.000000000 -0700
+++ src/lc.c 2006-07-26 14:37:34.000000000 -0700
@@ -190,7 +190,7 @@
break;
case 'h':
if(sniff_file[0]=='-' &&
- sniff_file[1]==0) (void *)sniff.dump = stdout;
+ sniff_file[1]==0) sniff.dump = stdout;
else sniff.dump = (void *)fopen(sniff_file, "w");
if(!sniff.dump){
fprintf(stderr, "Couldn't open file: %s\n", sniff.dump);
@@ -223,7 +223,7 @@
break;
case 'h':
if(spoof_file[0]=='-' &&
- spoof_file[1]==0) (void *)spoof.pcap = stdin;
+ spoof_file[1]==0) spoof.pcap = stdin;
else spoof.pcap = (void *)fopen(spoof_file, "r");
if(!spoof.pcap){
fprintf(stderr, "Couldn't open file: %s\n", spoof.pcap);
@@ -244,7 +244,7 @@
i=1;
if(!pid){
if(sniff_packets){
- (void *)sniff.packet = pcap_next(sniff.pcap, &(sniff.pkthdr));
+ sniff.packet = pcap_next(sniff.pcap, &(sniff.pkthdr));
if(!sniff.packet) continue; /* network has "infinite packets, but there's blocking */
if(trailer_sniff){
pk_hmac(buf, sniff_key, sniff.packet, sniff.pkthdr.caplen-21);
diff --exclude='*~' -Naur src.orig/minewt.c src/minewt.c
--- src.orig/minewt.c 2006-07-26 14:28:11.000000000 -0700
+++ src/minewt.c 2006-07-26 14:37:34.000000000 -0700
@@ -599,7 +599,7 @@
/* XXX very probable security hole lives here -- we must validate length, at minimum*/
if(stateless_ipt &&
(x.ip->ip_hl*4) != LIBNET_IP_H){
- (char *)packet_state = (char *)x.ip + LIBNET_IP_H + 4;
+ packet_state = (char *)x.ip + LIBNET_IP_H + 4;
}
if(packet_state || (packet_state = find_entry(packet_key)))
diff --exclude='*~' -Naur src.orig/paketto.c src/paketto.c
--- src.orig/paketto.c 2006-07-26 14:24:27.000000000 -0700
+++ src/paketto.c 2006-07-26 14:37:34.000000000 -0700
@@ -109,7 +109,7 @@
if(datalink != DLT_EN10MB) return(0); /* validate is our ethernet */
if(length < LIBNET_ETH_H) return(0); /* validate can be ethernet */
- (char *)x->eth = (char *)packet;
+ x->eth = (char *)packet;
l2_offset=LIBNET_ETH_H;
ok += l2_offset;
@@ -118,7 +118,7 @@
case ETHERTYPE_ARP:
if(length < LIBNET_ETH_H + LIBNET_ARP_H)
return(0);
- (char *)x->arp = (char *)x->eth + LIBNET_ETH_H;
+ x->arp = (char *)x->eth + LIBNET_ETH_H;
ok+=LIBNET_ARP_H;
return(ok);
break;
@@ -133,8 +133,8 @@
if(length < l2_offset + LIBNET_IP_H) /* Could we be IP? */
return(0);
ok+=LIBNET_IP_H;
- if(x->eth) (char *)x->ip = (char *)x->eth + l2_offset;
- else (char *)x->ip = (char *)packet;
+ if(x->eth) x->ip = (char *)x->eth + l2_offset;
+ else x->ip = (char *)packet;
if(x->ip->ip_off != 0 && x->ip->ip_off != ntohs(16384)) return(0);
if(x->ip->ip_v != 4) return(0);
@@ -164,19 +164,19 @@
return(0);
ok+=LIBNET_TCP_H;
}
- (char *)x->tcp = (char *)x->ip + ((int)x->ip->ip_hl*4);
+ x->tcp = (char *)x->ip + ((int)x->ip->ip_hl*4);
break;
case IPPROTO_UDP:
if(length < l2_offset + (int)x->ip->ip_hl*4 + LIBNET_UDP_H)
return(0);
ok+=LIBNET_UDP_H;
- (char *)x->udp = (char *)x->ip + ((int)x->ip->ip_hl*4);
+ x->udp = (char *)x->ip + ((int)x->ip->ip_hl*4);
break;
case IPPROTO_ICMP:
if(length < l2_offset + (int)x->ip->ip_hl*4 + 8)
return(0);
ok+=LIBNET_ICMP_H;
- (char *)x->icmp= (char *)x->ip + ((int)x->ip->ip_hl*4);
+ x->icmp= (char *)x->ip + ((int)x->ip->ip_hl*4);
break;
default:
return(0);
@@ -317,7 +317,7 @@
char buf[MX_B], buf2[MX_B];
struct frame x;
- (char *)x.ip = target;
+ x.ip = target;
snprintf(buf, sizeof(buf), "%s", inet_ntoa(x.ip->ip_src));
snprintf(buf2, sizeof(buf2), "%s", inet_ntoa(x.ip->ip_dst));
fprintf(stderr, " IP: i=%s->%s v=%hu hl=%hu s=%hu id=%i o=%hu ttl=%hu pay=%u\n",
@@ -334,7 +334,7 @@
char tmp = '\n';
if(!short_tcp)tmp=' ';
- (char *)x.tcp = target;
+ x.tcp = target;
fprintf(stderr, "TCP: p=%u->%u, s/a=%u%c",
ntohs(x.tcp->th_sport), ntohs(x.tcp->th_dport), ntohl(x.tcp->th_seq),tmp);
if(!short_tcp) fprintf(stderr, "-> %u o=%hu f=%hu w=%u u=%u optl=%i\n",
diff --exclude='*~' -Naur src.orig/scanutil.c src/scanutil.c
--- src.orig/scanutil.c 2006-07-26 14:28:50.000000000 -0700
+++ src/scanutil.c 2006-07-26 14:37:34.000000000 -0700
@@ -10,8 +10,8 @@
u_char syncookie[20];
long synbits;
- (char *)ip = (char *)ipp;
- (char *)tcp = (char *)ip + (int)ip->ip_hl*4;
+ ip = (char *)ipp;
+ tcp = (char *)ip + (int)ip->ip_hl*4;
bzero(buf, sizeof(buf));
@@ -39,8 +39,8 @@
u_char syncookie[20];
long synbits;
- (char *)ip = (char *)ipp;
- (char *)tcp = (char *)ip + (int)ip->ip_hl*4;
+ ip = (char *)ipp;
+ tcp = (char *)ip + (int)ip->ip_hl*4;
bzero(buf, sizeof(buf));
memcpy(buf, &ip->ip_dst, 4);
@@ -261,7 +261,7 @@
0, /*how much crap*/
(char *)x->eth);
- (char *)x->ip = (char *)x->eth + LIBNET_ETH_H;
+ x->ip = (char *)x->eth + LIBNET_ETH_H;
libnet_build_ip(LIBNET_TCP_H,
0, // tos
@@ -276,7 +276,7 @@
(char *)x->ip);
x->ip->ip_off = 64; /* set DF flag */
- (char *)x->tcp = (char *)x->ip + (int)x->ip->ip_hl*4;
+ x->tcp = (char *)x->ip + (int)x->ip->ip_hl*4;
libnet_build_tcp(12345, // source port
139, // dest port
|