Last active
March 1, 2017 11:10
-
-
Save Sam-Martin/b8128a38b61adaf65ee0e41e55a5bec5 to your computer and use it in GitHub Desktop.
Upload Secret to Ephemera
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
function New-EphemeraSecret{ | |
param( | |
[string]$Secret, | |
[string]$EphemeraURl = "http://ephemera.sdlsecuritycentre.com" | |
) | |
$EphemeraConfig = Invoke-WebRequest -Uri "$EphemeraURL/js/frontend_config.js" -UseBasicParsing | |
$EphemeraConfig.Content -match "apiURL = '(.+?)';" | Out-Null | |
$EphemeraAPIURL = $Matches[1] | |
$Payload = @{secretText = $Secret} | ConvertTo-Json | |
$Result = (Invoke-WebRequest -uri "$EphemeraAPIURL/addTextSecret" -Body $Payload -UseBasicParsing -Method POST).Content | ConvertFrom-Json | |
return "$EphemeraURl/?key={0}" -f $Result.Key | |
} | |
$SecretURL = New-EphemeraSecret -Secret "PotatoesAreAWESOME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment