tklab-tud / ID2T

Official ID2T repository. ID2T creates labeled IT network datasets that contain user defined synthetic attacks.
MIT License
58 stars 23 forks source link

DDoS sometimes produces illegal IP addresses #97

Open pepper-jk opened 5 years ago

pepper-jk commented 5 years ago

For some reason DDoS seems to produce integer values for IP addresses sometimes.

I could not find the cause yet, but I'm gonna keep looking. Theoretically it could only be either of the following issues:

I've been over this multiple times and could not find the issue, but I might be missing something. I'll take a look at it, when I'm back at the office next week.

.............................E..............................................................................................................................................................................................................................
======================================================================
ERROR: test_ddos_one_ip (test_DDoSAttack.UnitTestDDoS)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/ID2T/code/Test/test_DDoSAttack.py", line 13, in test_ddos_one_ip
    self.order_test([['DDoSAttack', 'ip.src=1.1.1.1']])
  File "/ID2T/code/Test/ID2TAttackTest.py", line 117, in order_test
    controller.process_attacks(attack_args, [[seed]])
  File "/ID2T/code/Core/Controller.py", line 100, in process_attacks
    temp_attack_pcap, duration = self.attack_controller.process_attack(attack[0], attack[1:], measure_time)
  File "/ID2T/code/Core/AttackController.py", line 177, in process_attack
    self.current_attack.generate_attack_packets()
  File "/ID2T/code/Attack/DDoSAttack.py", line 335, in generate_attack_packets
    result = self.add_packet(pkt, ip_source, ip_destination)
  File "/ID2T/code/Attack/BaseAttack.py", line 449, in add_packet
    bytes = len(pkt)
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/packet.py", line 476, in __len__
    return len(self.__bytes__())
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/packet.py", line 441, in __bytes__
    return self.build()
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/packet.py", line 556, in build
    p = self.do_build()
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/packet.py", line 541, in do_build
    pay = self.do_build_payload()
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/packet.py", line 528, in do_build_payload
    return self.payload.do_build()
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/packet.py", line 541, in do_build
    pay = self.do_build_payload()
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/packet.py", line 528, in do_build_payload
    return self.payload.do_build()
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/packet.py", line 543, in do_build
    return self.post_build(pkt, pay)
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/layers/inet.py", line 623, in post_build
    ck = in4_chksum(socket.IPPROTO_TCP, self.underlayer, p)
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/layers/inet.py", line 594, in in4_chksum
    inet_pton(socket.AF_INET, u.src),
  File "/ID2T/.venv/lib/python3.7/site-packages/scapy/pton_ntop.py", line 87, in inet_pton
    return socket.inet_pton(af, addr)
OSError: illegal IP address string passed to inet_pton

----------------------------------------------------------------------
Ran 252 tests in 142.852s

FAILED (errors=1)