Get-ShodanExploitCount.psm1
<#PSScriptInfo
.VERSION 1.1.2 .GUID 36d9dca8-c696-4739-a5d3-91a820580171 .AUTHOR SimeonOnSecurity .COMPANYNAME SimeonOnSecurity .COPYRIGHT 2020 SimeonOnSecurity. All rights reserved. .TAGS Shodan PowerShell Modules ShodanPS cmdlet .PROJECTURI https://simeononsecurity.com/github/shodan-powershell/ .DESCRIPTION "This method behaves identical to the "/search" method with the difference that it doesn't return any results. Ex: Get-ShodanExploitCount -Query [string] -Facet [string] -API [string]" .RELEASENOTES Init #> function Get-ShodanExploitCount { param( [Parameter(Mandatory = $false, Position = 0)] [string]$api, [Parameter(Mandatory = $true, Position = 1)] [string]$query, [Parameter(Mandatory = $false, Position = 2)] [string]$facet ) $apistring = "?key=$api" $querystring = "&query=$query" If (!$facet) { Write-Output "You chose no facet" $facetstring = "" } Else { $facetstring = "&facets=$facet" } If (!$api) { Write-Output "Please set the 'api' variable to your shodan API key." } Else { If (!$query) { Write-Output "Please specify your query with -Query [string]" } Else { (Invoke-WebRequest "https://exploits.shodan.io/api/count$apistring$querystring$facetstring").content | ConvertFrom-Json } } } |