Jump to content

API error - Searchpasswords failes


Guest Michael Ryom

Recommended Posts

Guest Michael Ryom

Hi

 

I'm trying to use the webapi to search for a password. But no matter what I do I cant get a useful output. (Creating/searching folders,password lists, etc. works.)

 

Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title" -Credential $cred

Returns "[{"errors":[{"message":"Invalid API Call"},{"phrase":"Error = Object reference not set to an instance of an object."}]}]"

 

if I change it to something incorrect like added a "1" after username or title - It tells me there is no record like expected

Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title1" -Credential $cred

Returns "[{"errors":[{"message":"Not Found"},{"phrase":"You search for Password records return zero results."}]}]"

 

 

 

So why does it return "Invalid API Call", when it should return "password found"

 

ps. if I use the URI in a browser the result is the same.

 

 

 

 

 

 

 

Link to comment
Share on other sites

1 minute ago, Guest Michael Ryom said:

Hi

 

I'm trying to use the webapi to search for a password. But no matter what I do I cant get a useful output. (Creating/searching folders,password lists, etc. works.)

 

Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title" -Credential $cred

Returns "[{"errors":[{"message":"Invalid API Call"},{"phrase":"Error = Object reference not set to an instance of an object."}]}]"

 

if I change it to something incorrect like added a "1" after username or title - It tells me there is no record like expected

Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title1" -Credential $cred

Returns "[{"errors":[{"message":"Not Found"},{"phrase":"You search for Password records return zero results."}]}]"

 

 

 

So why does it return "Invalid API Call", when it should return "password found"

 

ps. if I use the URI in a browser the result is the same.

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

So I have been testing and I can find the flaw. Sometimes is works with passwordlistID, sometimes it dont :(

 

I'm now testing with notes instead of passwordlistID

 

HTTPS://pstate/winapi/searchpasswords/?username=username&title=title&notes=notes

Link to comment
Share on other sites

Hi Michael,

 

Can you give us some examples of what's not working for you, and we will look into them? On your last URL provided, you've changed to the Windows Integrated API - was this intentional?

Regards

Click Studios

Link to comment
Share on other sites

I'm using the win API - Only.

 

As I wrote in the beginning:

Correctly formatted - Does not return the password

Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title" -Credential $cred

Returns "[{"errors":[{"message":"Invalid API Call"},{"phrase":"Error = Object reference not set to an instance of an object."}]}]"

 

Incorrectly formatted - Does return msg that there is no password record

if I change it to something incorrect like added a "1" after username or title - It tells me there is no record like expected

Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title1" -Credential $cred

Returns "[{"errors":[{"message":"Not Found"},{"phrase":"You search for Password records return zero results."}]}]"

 

Some more testing:

Invoke-WebRequest -URI "https://pstate/winapi/searchpasswords/83" -Credential $cred -ContentType "application/json; charset=utf-16"

Returns a list of password for the passwordlist with ID 83

 

(Invoke-WebRequest -URI "https://pstate/winapi/searchpasswords/83?username=username" -Credential $cred -ContentType "application/json; charset=utf-16")

Returns a password list

 

 

In the first two examples, I would expect the output to be the same if username and/or title was incorrect, just like it does in the second example. When the title is purposely changed by adding a "1" at the end.

 

Link to comment
Share on other sites

Hi MichaelRyom,

 

I've compared your examples to our documentation, and notice a couple of differences which I can confirm in my environment, if I change them, the search functionality works as expected.

 

1. You are using invoke-webrequest instead of invoke-restmethod

2. You don't have -method GET as a parameter in your API call

3. You are using -Credential $cred instead of -UseDefaultCredentials

 

An example of searching with the changes I've mentioned above would be

 

$PasswordstateUrl = 'https://sandbox.halox.net/winapi/searchpasswords/10929?username=asand'
Invoke-RestMethod -Method Get -Uri $PasswordstateUrl -UseDefaultCredentials

 

another example, searching by username and title is:

 

$PasswordstateUrl = 'https://sandbox.halox.net/winapi/searchpasswords/10929?username=asand&title=Admin Linux'
Invoke-RestMethod -Method Get -Uri $PasswordstateUrl -UseDefaultCredentials

 

Hope this helps!

 

Support.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...