Skip to content

Instantly share code, notes, and snippets.

@Sam-Martin
Last active March 1, 2017 11:10
Show Gist options
  • Save Sam-Martin/b8128a38b61adaf65ee0e41e55a5bec5 to your computer and use it in GitHub Desktop.
Save Sam-Martin/b8128a38b61adaf65ee0e41e55a5bec5 to your computer and use it in GitHub Desktop.
Upload Secret to Ephemera
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