Created
December 16, 2022 13:53
-
-
Save dhmacher/c2f2c36868e39345cf695380d687e0bf to your computer and use it in GitHub Desktop.
Powershell code to generate a password pusher URL (using pw.strd.co)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Generate a password pusher URL. | |
#> | |
$secretString = "Be vewy, vewy quiet. I'm hunting wabbits." | |
$maxDays = 1 # Number of days the link is valid | |
$maxCount = 1 # Maximum number of times the link can be used | |
$pwStrdCo = (Invoke-WebRequest ` | |
-Uri "https://pw.strd.co/generate" ` | |
-Method "POST" ` | |
-ContentType "application/x-www-form-urlencoded" ` | |
-UseBasicParsing ` | |
-Body ( "plaintext=" + [System.Web.HttpUtility]::UrlEncode($secretString) ` | |
"&maxdays=" + $maxDays ` | |
"&maxcount=" + $maxCount ) ` | |
) | ConvertFrom-Json | |
$url = "https://pw.strd.co/" + $pwStrdCo.code + "/" + $pwStrdCo.key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment