snappass
snappass copied to clipboard
Make possible to get the password via Curl
Feature Request:
"With the secured link, make possible to retrieve raw password via a simple Linux curl command"
I'm been maintaining my own fork of snappass that includes an API. I'm working on rebasing all of my changes on top of the latest changes in pinterest/snappass.
Stay tuned =)
It would be very nice tom separate the code out and have an API and a default web client. This way we could start building multiple clients, like:
- curl
- slack
- web
- ios
- android
Just pushed PR #51 to accomplish this.
For anyone that will need this:
curl -d "password=secret&ttl=day" -X POST https://snappass.herokuapp.com | grep "value" | awk -F '"' '{print $8}'
thanks @wooyek , based on your comment I converted to PowerShell for the system admins out there:
$Password = 'something1122'
$RawPasswordLink = Invoke-WebRequest -Method POST -Body "password=$Password&ttl=day" -Uri https://snappass.herokuapp.com/ -UseBasicParsing
$Link = $RawPasswordLink.RawContent.Substring($RawPasswordLink.RawContent.IndexOf('value="') + 7)
$Link = $Link.Substring(0, $link.IndexOf(' ') - 1)
$Link
Here's my PowerShell function taking advantage of the recent addition of JSON support.
function Get-OneTimeUsePasswordLink {
param
(
[String] $password,
[ValidateSet("Week", "Day", "Hour")]
[String]
$ttl
)
$postParams = @{password = $password; ttl = $ttl }
$response = Invoke-WebRequest -Uri "https://your.site.here" -Method Post -ContentType "application/x-www-form-urlencoded" -Body $postParams -Headers @{"accept"="application/json"}
$json = $response | ConvertFrom-Json
return $json.Link
}
For anyone that will need this:
curl -d "password=secret&ttl=day" -X POST https://snappass.herokuapp.com[](https://snappass.herokuapp.com) | grep "value" | awk -F '"' '{print $8}'
is there a way to pull the secret content using a curl command and the generated URL?