Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PowerShell snippet for submitting to urlscan.io - By Nicholas Gipson
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Invoke = Invoke-WebRequest -Headers @{"API-Key" = "$apikey"} -Method Post ` -Body "{`"url`":`"$url`"}" -Uri https://urlscan.io/api/v1/scan/ ` -ContentType application/json
@unexpectedBy

This comment has been minimized.

Copy link

unexpectedBy commented Jul 5, 2018

thanks for this bro, if i need submit a url list, how can a edit this script?

@dmissp

This comment has been minimized.

Copy link

dmissp commented Jan 31, 2019

@unexpectedBy - I know it's a bit old, but I believe the list submission would just be wrapped inside a foreach.

$apikey = 'yourapikey'
$list = gc .\listofurls.txt
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

foreach ($url in $list){
write-host "Submitting $url"
$Invoke = Invoke-WebRequest -Headers @{"API-Key" = "$apikey"} -Method Post -Body "{"url":"$url"}" -Uri https://urlscan.io/api/v1/scan/ -ContentType application/json
start-sleep 2
}

@pramodpabbati

This comment has been minimized.

Copy link

pramodpabbati commented May 10, 2019

I am trying to use PowerShell for searching using search API. Any idea how I can modify the code to perform the search? I am getting errors on several of my tries.

$headers = @{
'Content-Type' = 'application/json'
'API-Key' = 'apikey'
}

$url="https://urlscan.io/api/v1/search/?q=domain:"
$domain="sampledomain.tld"
$request = $url+$domain
$response = Invoke-RestMethod $request -Headers $headers

Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
At line:9 char:13
$response = Invoke-RestMethod $request -Headers $headers         

  CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
  FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

I have also tried:
$apikey = 'apikey
$Invoke = Invoke-WebRequest -Uri "https://urlscan.io/api/v1/search/?q=domain:wifi.n2s.es" -Headers @{"API-Key" = "$apikey"}

Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
At line:2 char:11
$Invoke = Invoke-WebRequest -Uri "https://urlscan.io/api/v1/search/?q ...

   CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
   FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.