forked from AlexTrushkovsky/NoWarDDoS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdater.py
36 lines (30 loc) · 1.06 KB
/
updater.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from urllib.request import urlopen
import sys
import os
import requests
if len(sys.argv) > 1:
threads = int(sys.argv[1])
else:
threads = 500
def update():
url = "https://raw.githubusercontent.com/AlexTrushkovsky/NoWarDDoS/main/attack.py"
filename = url.split('/')[-1].replace(" ", "_") # be careful with file names
file_path = os.path.join('', filename)
r = requests.get(url, stream=True)
if r.ok:
print("saving to", os.path.abspath(file_path))
with open("attack.py", 'wb') as f:
for chunk in r.iter_content(chunk_size=1024 * 8):
if chunk:
f.write(chunk)
f.flush()
os.fsync(f.fileno())
else: # HTTP status code 4XX/5XX
print("Download failed: status code {}\n{}".format(r.status_code, r.text))
start_new()
def start_new():
print("Success update")
os.system("python attack.py " + str(threads))
os.system("python3 attack.py " + str(threads))
if __name__ == '__main__':
update()