小编Ron*_*fon的帖子

Python 脚本中的 Scapy

我正在用 Python 编写一个使用 Scapy 的脚本,但我的问题是例外是:

我 = IP()

NameError:未定义全局名称“IP”

这是我的脚本:

import random
from scapy import *
import threading
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)

print ("Which IP would you like to choose?")
ip = raw_input("-->")
print ("Which Port would you like to choose?")
port = raw_input("-->")

class sendSYN(threading.Thread):
    global ip, port

    def __init__(self):
        threading.Thread.__init__(self)

    def run(self):
        # Method -
        i = IP()
        i.src = "%i.%i.%i.%i" % (random.randint(1, 254), random.randint(1, 254), random.randint(1, 254), random.randint(1, 254))
        i.dst = ip

        t = TCP()
        t.sport = random.randint(1, …
Run Code Online (Sandbox Code Playgroud)

python scapy

5
推荐指数
1
解决办法
9535
查看次数

标签 统计

python ×1

scapy ×1