Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDoS sometimes produces illegal IP addresses #97

Open
pepper-jk opened this issue Sep 30, 2019 · 0 comments
Open

DDoS sometimes produces illegal IP addresses #97

pepper-jk opened this issue Sep 30, 2019 · 0 comments

Comments

@pepper-jk
Copy link
Collaborator

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:

  • an IP is split at the dots ("." ) within the string, where it should not be split (e.g. "1.1.1.1" -> ["1", "1", "1", "1"])
  • generate_random_ipv4_address() or get_random_ip_address() produce integers
  • the IP address validation of the IP parameter does not work properly

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant