This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
WiFi Positioning System | |
Wrappers around the SkyHook and Google Locations APIs to resolve | |
wireless routers' MAC addresses (BSSID) to physical locations. | |
""" | |
try: | |
from json import dumps, loads | |
except: | |
from simplejson import dumps, loads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ easy_install shodan | |
# or easy_install -U shodan | |
# or pip install shodan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import the class | |
from shodan.wps import GoogleLocation | |
# Setup the object | |
wps_client = GoogleLocation() | |
# Locate the physical address of the MAC/ BSSID | |
address = wps_client.locate('00:1D:7E:F0:A2:B0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Search the Shodan database using the given query. Returns the number of matches. | |
*/ | |
function SHODAN(query) { | |
var API_KEY = 'YOUR API KEY'; | |
var url = 'http://www.shodanhq.com/api/count?key=' + API_KEY + '&q=' + query; | |
var response = UrlFetchApp.fetch(url); | |
var data = Utilities.jsonParse(response.getContentText()); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var API_KEY = 'YOUR API KEY'; | |
/** | |
* Search the Shodan database using the given query. Returns the number of matches. | |
*/ | |
function SHODAN_COUNT(query) { | |
var url = 'https://api.shodan.io/shodan/host/count?key=' + API_KEY + '&query=' + query; | |
var response = UrlFetchApp.fetch(url); | |
var data = Utilities.jsonParse(response.getContentText()); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
A simple script to search Shodan and output the results as JSON-encoded banners; | |
each line corresponds to a single banner. | |
Warning: This will use up query credits because it pages through the results! | |
Usage: python simple-export.py <search query> | |
""" | |
# Install via "easy_install shodan" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# shodan-stream.py | |
# Read a firehose/ stream of 1% of the data that Shodan collects in real-time. | |
# | |
# WARNING: This script only works with people that have a subscription API plan! | |
# And by default the Streaming API only returns 1% of the data that Shodan gathers. | |
# If you wish to have more access please contact us at [email protected] for pricing | |
# information. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shodan | |
import socket | |
# Configuration options | |
API_KEY = 'YOUR API KEY' | |
SEARCH_QUERY = 'netcam' | |
CONNECTION_TIMEOUT = 1.5 | |
def is_camera(ip_str): | |
"""Check whether the given IP operates a valid webcam by checking for the existence of a URL.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shodan.threatnet | |
# Configuration | |
API_KEY = "Please enter your API key here" | |
# Create the object that interfaces with the Threatnet API | |
tnet = shodan.threatnet.Threatnet(API_KEY) | |
# Get a stream of events and print them to stdout | |
for event in tnet.stream.events(): |
OlderNewer