This question already has an answer here:
- What's the bad magic number error? 7 answers
import tempfile, random, uuid, os, multiprocessing, time
path = tempfile.mkdtemp()
pid = os.getpid()
print (path)
def ddos():
p = multiprocessing.current_process()
print ("process id =", p.name)
while True:
byte = random.randint(10000000, 16000000)
i = '\0' * byte
filename = str(uuid.uuid4().hex)
temp = tempfile.NamedTemporaryFile(delete=False, prefix=filename, dir=path)
temp.write(i.encode('ascii'))
temp.close()
time.sleep(120)
if __name__ == '__main__':
for x in range(10):
a = multiprocessing.Process(name=ddos, target=ddos)
a.start()
I want to create 10 copies of my script but when I run it, it gives me this error:
Traceback (most recent call last):
File "C:/Python34/localdos 2.0.py", line 1, in <module>
import tempfile,random,uuid,os,multiprocessing,time
File "C:\Python34\lib\tempfile.py", line 36, in <module>
from random import Random as _Random
ImportError: bad magic number in 'random': b'\x03\xf3\r\n'
Aucun commentaire:
Enregistrer un commentaire