Skip to content

Commit 9d1eb41

Browse files
committed
Merge pull request #7 from Sheksa/master
Fixed duplicate packet capturing casuing CRC issue in HTTP
2 parents 02e8671 + 0a1e1ff commit 9d1eb41

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pyexfil/http_exfiltration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,15 @@ def eth_addr(a):
128128

129129
# Main work starts here
130130
while True:
131-
packet = s.recvfrom(65565)
132-
packet = packet[0]
131+
packet, address = s.recvfrom(65565)
133132
eth_length = 14
134133

135134
eth_header = packet[:eth_length]
136135
eth = unpack('!6s6sH', eth_header)
137136
eth_protocol = socket.ntohs(eth[2])
138137

139138
# Parse IP packets, IP Protocol number = 8
140-
if eth_protocol == 8:
139+
if eth_protocol == 8 and address[2] == 4: # Cancel out duplicates
141140
# Parse IP header
142141
ip_header = packet[eth_length:20 + eth_length] # 20 first chars are IP Header
143142
iph = unpack('!BBHHHBBH4s4s', ip_header) # Unpacking IP Header

0 commit comments

Comments
 (0)