snappass icon indicating copy to clipboard operation
snappass copied to clipboard

Make possible to get the password via Curl

Open ebuildy opened this issue 8 years ago • 12 comments

Feature Request:

"With the secured link, make possible to retrieve raw password via a simple Linux curl command"

ebuildy avatar Oct 24 '16 14:10 ebuildy

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 =)

jameswthorne avatar Nov 03 '16 02:11 jameswthorne

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

nichochar avatar Nov 06 '16 02:11 nichochar

Just pushed PR #51 to accomplish this.

jameswthorne avatar Jan 12 '17 14:01 jameswthorne

For anyone that will need this:

curl -d "password=secret&ttl=day" -X POST https://snappass.herokuapp.com | grep "value" | awk -F '"' '{print $8}'

wooyek avatar Oct 13 '21 14:10 wooyek

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

Kav7 avatar Apr 22 '22 07:04 Kav7

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
}

silverl avatar Apr 22 '22 14:04 silverl

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?

yuval-katzman-digsec avatar Jun 23 '22 12:06 yuval-katzman-digsec