### Getting Account Information (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md This method (AccountProfile) allows you to retrieve your Shodan account information, such as membership status, credits, display name, and creation date. ```php var_dump($client->AccountProfile()); ``` -------------------------------- ### Searching Shodan Hosts (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Search Shodan using the same query syntax as the website and use facets to get summary information for different properties via the ShodanHostSearch method. This method may use API query credits depending on usage. ```php var_dump($client->ShodanHostSearch(array( 'query' => 'Niagara Web Server', ))); ``` -------------------------------- ### Searching Exploits (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Search across a variety of data sources for exploits using the Search method. Can use facets to get summary information. Requires a 'query' parameter. ```php var_dump($client->Search(array( 'query' => 'cve' ))); ``` -------------------------------- ### Getting Shodan Host Search Tokens (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md This method lets you determine which filters are being used by the query string and what parameters were provided to the filters using the ShodanHostSearchTokens method. Requires a search query. ```php var_dump($client->ShodanHostSearchTokens(array( 'query' => 'Niagara Web Server country:"IT"', ))); ``` -------------------------------- ### Initiating Shodan Internet Scan (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Use this method (ShodanScanInternet) to request Shodan to crawl the Internet for a specific port and protocol. This is a POST method and requires a paid API key and Shodan permission. Requires 'port' and 'protocol' parameters. ```php var_dump($client->ShodanScanInternet(array( 'port' => '80', 'protocol' => 'dns-tcp', ))); ``` -------------------------------- ### Listing Shodan Protocols (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md This method returns an object containing all the protocols that can be used when launching an Internet scan using the ShodanProtocols method. ```php var_dump($client->ShodanProtocols()); ``` -------------------------------- ### Initiating Shodan Network Scan (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Use this method (ShodanScan) to request Shodan to crawl a network. This is a POST method and requires a paid API key. Requires the 'ips' parameter specifying the network range. ```php var_dump($client->ShodanScan(array( 'ips' => '69.171.230.0/24', ))); ``` -------------------------------- ### Setting Shodan API Key in PHP Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md This snippet shows where to insert your Shodan API key within the shodan-api.php file or when instantiating the API object. Replacing the placeholder string with your actual key is a necessary step for authenticating requests to the Shodan API. ```php $key = 'Insert your API key here'; ``` -------------------------------- ### Querying Shodan Host Information (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Return all services that have been found on the given host IP using the ShodanHost method. This requires providing the target IP address. ```php var_dump($client->ShodanHost(array( 'ip' => '69.171.230.68', // https://www.facebook.com/ ))); ``` -------------------------------- ### Counting Exploits (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md This method (Count) behaves identically to the "/search" method for exploits but doesn't return any results, only the count. Requires a 'query' parameter. ```php var_dump($client->Count(array( 'query' => 'cve' ))); ``` -------------------------------- ### Listing Shodan Services (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md This method (ShodanServices) returns an object containing all the services that the Shodan crawlers look at. It can also be used as a quick way to resolve a port number to a service name. ```php var_dump($client->ShodanServices()); ``` -------------------------------- ### Listing Saved Shodan Queries (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Use this method (ShodanQuery) to obtain a list of search queries that users have saved in Shodan. Can be paginated using the 'page' parameter. ```php var_dump($client->ShodanQuery(array( 'page' => '1' ))); ``` -------------------------------- ### Performing DNS Resolution using Shodan PHP API Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Uses the Shodan PHP API client's DnsResolve method to look up IP addresses for a list of hostnames. Requires a comma-separated string of hostnames as input. ```php var_dump($client->DnsResolve(array( 'hostnames' => 'google.com,bing.com', ))); ``` -------------------------------- ### Listing Popular Shodan Query Tags (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Use this method (ShodanQueryTags) to obtain a list of popular tags for the saved search queries in Shodan. Can specify the number of results using the 'size' parameter. ```php var_dump($client->ShodanQueryTags(array( 'size' => '30' ))); ``` -------------------------------- ### Listing Shodan Ports (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md This method returns a list of port numbers that the Shodan crawlers are looking for using the ShodanPorts method. ```php var_dump($client->ShodanPorts()); ``` -------------------------------- ### Counting Shodan Host Results (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Returns the total number of results that matched the query and any facet information that was requested using the ShodanHostCount method. Requires a search query. ```php var_dump($client->ShodanHostCount(array( 'query' => 'Niagara Web Server', ))); ``` -------------------------------- ### Calculating Honeypot Score (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Calculates a honeypot probability score ranging from 0 (not a honeypot) to 1.0 (is a honeypot) using the LabsHoneyscore experimental method. Requires the 'ip' parameter. ```php var_dump($client->LabsHoneyscore(array( 'ip' => '54.231.184.227', // http://mushmush.org/ ))); ``` -------------------------------- ### Searching Saved Shodan Queries (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Use this method (ShodanQuery) to search the directory of search queries that users have saved in Shodan. Requires a 'query' parameter. ```php var_dump($client->ShodanQuery(array( 'query' => 'fax' ))); ``` -------------------------------- ### Performing DNS Reverse Lookup using Shodan PHP API Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Uses the Shodan PHP API client's DnsReverse method to look up hostnames for a list of IP addresses. Requires a comma-separated string of IP addresses as input. ```php var_dump($client->DnsReverse(array( 'ips' => '8.8.8.8,1.1.1.1', ))); ``` -------------------------------- ### Checking Shodan Scan Progress (PHP) Source: https://github.com/scadaexposure/shodan-php-rest-api/blob/master/README.md Check the progress of a previously submitted scan request using the ShodanScan_Id method. Requires the 'id' parameter which is the scan ID. ```php var_dump($client->ShodanScan_Id(array( 'id' => 'R2XRT5HH6X67PFAB', ))); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.