We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 02e8671 + 0a1e1ff commit 9d1eb41Copy full SHA for 9d1eb41
pyexfil/http_exfiltration.py
@@ -128,16 +128,15 @@ def eth_addr(a):
128
129
# Main work starts here
130
while True:
131
- packet = s.recvfrom(65565)
132
- packet = packet[0]
+ packet, address = s.recvfrom(65565)
133
eth_length = 14
134
135
eth_header = packet[:eth_length]
136
eth = unpack('!6s6sH', eth_header)
137
eth_protocol = socket.ntohs(eth[2])
138
139
# Parse IP packets, IP Protocol number = 8
140
- if eth_protocol == 8:
+ if eth_protocol == 8 and address[2] == 4: # Cancel out duplicates
141
# Parse IP header
142
ip_header = packet[eth_length:20 + eth_length] # 20 first chars are IP Header
143
iph = unpack('!BBHHHBBH4s4s', ip_header) # Unpacking IP Header
0 commit comments