[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
This works.

404 is a web server error that basically means file not found but in this case 
is also part of the API saying that the account has not been pwned.

Use the example email in the documentation with your code:

Invoke-RestMethod -Uri 
"https://haveibeenpwned.com/api/v2/pasteaccount/t...@example.com"; -Method Get


https://haveibeenpwned.com/API/v2#PastesForAccount

Thanks,
Jeff Jerousek<mailto:jeff.jerou...@lrs.com>


From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of Kurt Buff
Sent: Sunday, May 7, 2017 9:35 PM
To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com>
Subject: [powershell]

So, I want to know what's been breached. I use a different password for each 
site, but I can't seem to figure this out - I'm pretty sure it's going to be 
obvious that I don't know what I'm doing here. Any pointers would be 
appreciated..

This:
https://www.troyhunt.com/password-reuse-credential-stuffing-and-another-1-billion-records-in-have-i-been-pwned/<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.troyhunt.com%2Fpassword-reuse-credential-stuffing-and-another-1-billion-records-in-have-i-been-pwned%2F&data=02%7C01%7C%7C38e70dd6f72744ae3e5208d495bbeb77%7C62af9ccc42164ae2a1d306614c59c315%7C0%7C0%7C636298081720778787&sdata=WxEJgwNu7zjBDR6Wu%2FXuDIDqUNM8uPFpbnfcrXhJZaM%3D&reserved=0>
Leads to this:
https://haveibeenpwned.com/API/v2<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhaveibeenpwned.com%2FAPI%2Fv2&data=02%7C01%7C%7C38e70dd6f72744ae3e5208d495bbeb77%7C62af9ccc42164ae2a1d306614c59c315%7C0%7C0%7C636298081720778787&sdata=A8fCKK1Nv71GhWz1%2FkopNVNeNnDiw2RiHDLDw9gkbeg%3D&reserved=0>
And a couple of bits of googling leads me to this:
http://stackoverflow.com/questions/41618766/powershell-invoke-webrequest-fails-with-ssl-tls-secure-channel<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F41618766%2Fpowershell-invoke-webrequest-fails-with-ssl-tls-secure-channel&data=02%7C01%7C%7C38e70dd6f72744ae3e5208d495bbeb77%7C62af9ccc42164ae2a1d306614c59c315%7C0%7C0%7C636298081720778787&sdata=zmGAGb9P%2BHlFN3GcxBO9TEpttSgXnZR1qvelbTNL%2BDU%3D&reserved=0>

With this result:
     PS C:\temp>[Net.ServicePointManager]::SecurityProtocol = 
[Net.SecurityProtocolType]::Tls12
     PS C:\temp>invoke-restmethod -uri 
https://haveibeenpwned.com/api/v2/pasteaccount/kurt.b...@gmail.com<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhaveibeenpwned.com%2Fapi%2Fv2%2Fpasteaccount%2Fkurt.buff%40gmail.com&data=02%7C01%7C%7C38e70dd6f72744ae3e5208d495bbeb77%7C62af9ccc42164ae2a1d306614c59c315%7C0%7C0%7C636298081720778787&sdata=w%2BCivaaVkOcLREeuMmw%2BJHMAIfeCOV9Si5vysMtb96M%3D&reserved=0>
 -method get
     invoke-restmethod : The remote server returned an error: (404) Not Found.
     At line:1 char:1
      + invoke-restmethod -uri 
https://haveibeenpwned.com/api/v2/pasteaccount<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhaveibeenpwned.com%2Fapi%2Fv2%2Fpasteaccount&data=02%7C01%7C%7C38e70dd6f72744ae3e5208d495bbeb77%7C62af9ccc42164ae2a1d306614c59c315%7C0%7C0%7C636298081720778787&sdata=87hQzF8L7C8cqQRQk2JijwrsmFfslD8x4KMKcLRrVZQ%3D&reserved=0>
 ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         + CategoryInfo          : InvalidOperation: 
(System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
         + FullyQualifiedErrorId : 
WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Since this page shows a lot of successful queries:
https://haveibeenpwned.com/API/Consumers<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhaveibeenpwned.com%2FAPI%2FConsumers&data=02%7C01%7C%7C38e70dd6f72744ae3e5208d495bbeb77%7C62af9ccc42164ae2a1d306614c59c315%7C0%7C0%7C636298081720788796&sdata=sREqdwkRgTi8t8jI4IqW%2FOw23SlG2D%2BAZ3qc8%2BK4F%2BQ%3D&reserved=0>
I figure the page owner hasn't screwed things up, and this is all about my lack 
of knowledge...

Kurt


Reply via email to