def dotransform(request, response): ssid = request.value username = config['wigle/username'].strip('\'') password = config['wigle/password'].strip('\'') w_login = '******' w_query = 'https://wigle.net/gps/gps/main/confirmquery/' gurl_base = 'http://maps.googleapis.com/maps/api/streetview?size=800x800&sensor=false&location=' map_details = [] def Wigle_SSID(username, password, ssid): # Create a session with requests to enable the use of auth cookies agent = requests.Session() # Login to Wigle.net using the specified creds agent.post(w_login, data={ 'credential_0': username, 'credential_1': password, 'destination': '/gps/gps/main' }) # Submit query against the MAC address of the AP (confirmlocquery, netid) response = agent.post(url=w_query, data={ 'ssid': ssid, 'Query': 'Query' }) # Pull the latitude and longitude from the raw response for s in re.finditer(r'maplat=(\S*)&maplon=(\S*)&map', response.text): lat = s.group(1) lng = s.group(2) # Build the Google Maps URL gurl = gurl_base + str(lat) + ',' + str(lng) mapping = str(lat), str(lng), gurl # Add the details to a variable for creating the entity if mapping not in map_details: map_details.append(mapping) Wigle_SSID(username, password, ssid) for x in map_details: cords = 'Lat: ' + str(x[0]).strip('\'') + '\nLong: ' + str( x[1]).strip('\'') e = Image(cords) e.url = x[2] response += e return response
def dotransform(request, response, config): ip = request.value host = request.fields['kippoip'] if not os.path.exists('/opt/geoip/GeoLiteCity.dat'): return response + UIMessage('Need local install of MaxMinds Geo IP database') gi = pygeoip.GeoIP('/opt/geoip/GeoLiteCity.dat') rec = gi.record_by_addr(ip) country = rec['country_name'] ccode = rec['country_code'].lower() flag_path = 'http://flags.sneakersinc.net:8080/' + ccode + '.png' e = Image(country) e.url = (flag_path) e += Field('kippoip', host, displayname='Kippo IP') response += e return response
def dotransform(request, response, config): ip = request.value host = request.fields['kippoip'] if not os.path.exists('/opt/geoip/GeoLiteCity.dat'): return response + UIMessage( 'Need local install of MaxMinds Geo IP database') gi = pygeoip.GeoIP('/opt/geoip/GeoLiteCity.dat') rec = gi.record_by_addr(ip) country = rec['country_name'] ccode = rec['country_code'].lower() flag_path = 'http://flags.sneakersinc.net:8080/' + ccode + '.png' e = Image(country) e.url = (flag_path) e += Field('kippoip', host, displayname='Kippo IP') response += e return response
def dotransform(request, response): ssid = request.value username = config['wigle/username'].strip('\'') password = config['wigle/password'].strip('\'') w_login = '******' w_query = 'https://wigle.net/gps/gps/main/confirmquery/' gurl_base = 'http://maps.googleapis.com/maps/api/streetview?size=800x800&sensor=false&location=' map_details = [] def Wigle_SSID(username, password, ssid): # Create a session with requests to enable the use of auth cookies agent = requests.Session() # Login to Wigle.net using the specified creds agent.post(w_login, data={'credential_0': username, 'credential_1': password, 'destination': '/gps/gps/main'}) # Submit query against the MAC address of the AP (confirmlocquery, netid) response = agent.post(url=w_query, data={'ssid': ssid,'Query': 'Query'}) # Pull the latitude and longitude from the raw response for s in re.finditer(r'maplat=(\S*)&maplon=(\S*)&map', response.text): lat = s.group(1) lng = s.group(2) # Build the Google Maps URL gurl = gurl_base + str(lat) + ',' + str(lng) mapping = str(lat), str(lng), gurl # Add the details to a variable for creating the entity if mapping not in map_details: map_details.append(mapping) Wigle_SSID(username, password, ssid) for x in map_details: cords = 'Lat: ' + str(x[0]).strip('\'') + '\nLong: ' + str(x[1]).strip('\'') e = Image(cords) e.url = x[2] response += e return response
def dotransform(request, response, config): conf = SafeConfigParser() conf.read("HoneyMalt.conf") geodbpath = conf.get("geoip", "geoip_db").strip("'") ip = request.value host = request.fields["kippodatabase"] if not os.path.exists(geodbpath): return response + UIMessage("Need local install of MaxMinds Geo IP database") gi = pygeoip.GeoIP(geodbpath) rec = gi.record_by_addr(ip) country = rec["country_name"] ccode = rec["country_code"].lower() flag_path = "http://flags.sneakersinc.net/" + ccode + ".png" e = Image(country) e.url = flag_path e += Field("kippoip", host, displayname="Kippo IP") response += e return response
def dotransform(request, response, config): conf = SafeConfigParser() conf.read('HoneyMalt.conf') geodbpath = conf.get('geoip', 'geoip_db').strip('\'') ip = request.value host = request.fields['kippodatabase'] if not os.path.exists(geodbpath): return response + UIMessage( 'Need local install of MaxMinds Geo IP database') gi = pygeoip.GeoIP(geodbpath) rec = gi.record_by_addr(ip) country = rec['country_name'] ccode = rec['country_code'].lower() flag_path = 'http://flags.sneakersinc.net/' + ccode + '.png' e = Image(country) e.url = (flag_path) e += Field('kippoip', host, displayname='Kippo IP') response += e return response
def dotransform(request, response, config): if 'workspace' in request.fields: workspace = request.fields['workspace'] else: workspace = request.value dbcon = db_connect(workspace) pushpin_list = get_pushpin(dbcon) for puser in pushpin_list: if 'Picasa' == puser[0]: e = Image(puser[6], url=puser[4]) e += Field("workspace", workspace, displayname='Workspace') e += Label('Picasa Profile User', puser[2]) e += Label('Picasa Profile URL', puser[3]) e += Label('Published Date', puser[9]) response += e return response