<s> import sys <EOL> import os <EOL> from Maltego import * <EOL> import stawk_db <EOL> import logging <EOL> from wigle_api_lite import fetchLocations <EOL> import time <EOL> from xml . sax . saxutils import escape <EOL> logging . basicConfig ( level = logging . DEBUG , filename = '<STR_LIT>' , format = '<STR_LIT>' , datefmt = '<STR_LIT>' ) <EOL> sys . stderr = sys . stdout <EOL> def main ( ) : <EOL> street_view_url = None <EOL> try : <EOL> p = os . path . dirname ( os . path . realpath ( __file__ ) ) <EOL> f = open ( "<STR_LIT>" % p , "<STR_LIT:r>" ) <EOL> street_view_url = f . readline ( ) . strip ( ) + "<STR_LIT>" <EOL> except : <EOL> logging . debug ( "<STR_LIT>" ) <EOL> print "<STR_LIT>" ; <EOL> MaltegoXML_in = sys . stdin . read ( ) <EOL> if MaltegoXML_in < > '<STR_LIT>' : <EOL> m = MaltegoMsg ( MaltegoXML_in ) <EOL> logging . debug ( MaltegoXML_in ) <EOL> cursor = stawk_db . dbconnect ( ) <EOL> TRX = MaltegoTransform ( ) <EOL> ssid = m . Value <EOL> try : <EOL> cursor . execute ( "<STR_LIT>" , ( ssid ) ) <EOL> results = cursor . fetchall ( ) <EOL> for row in results : <EOL> lat = row [ <NUM_LIT:0> ] <EOL> long = row [ <NUM_LIT:1> ] <EOL> country = row [ <NUM_LIT:2> ] . encode ( '<STR_LIT:utf8>' , '<STR_LIT>' ) <EOL> code = row [ <NUM_LIT:3> ] . encode ( '<STR_LIT:utf8>' , '<STR_LIT>' ) <EOL> address = row [ <NUM_LIT:4> ] . encode ( '<STR_LIT:utf8>' , '<STR_LIT>' ) <EOL> NewEnt = TRX . addEntity ( "<STR_LIT>" , country ) <EOL> NewEnt . addAdditionalFields ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:strict>" , lat ) <EOL> NewEnt . addAdditionalFields ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:strict>" , long ) <EOL> NewEnt . addAdditionalFields ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:strict>" , country ) <EOL> NewEnt . addAdditionalFields ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:strict>" , code ) <EOL> NewEnt . addAdditionalFields ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:strict>" , address ) <EOL> NewEnt . addAdditionalFields ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , escape ( "<STR_LIT>" % ( lat , long ) ) ) <EOL> logging . debug ( street_view_url ) <EOL> if ( street_view_url != None ) : <EOL> NewEnt . addAdditionalFields ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:strict>" , "<STR_LIT>" % ( street_view_url , lat , long ) ) <EOL> NewEnt . setIconURL ( "<STR_LIT>" % ( street_view_url , lat , long ) ) <EOL> except Exception , e : <EOL> logging . debug ( e ) <EOL> logging . debug ( TRX ) <EOL> TRX . returnOutput ( ) <EOL> def debug1 ( self ) : <EOL> print "<STR_LIT>" ; <EOL> print "<STR_LIT>" ; <EOL> print "<STR_LIT>" <EOL> for i in range ( len ( self . entities ) ) : <EOL> self . entities [ i ] . returnEntity ( ) ; <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> for i in range ( len ( self . UIMessages ) ) : <EOL> print "<STR_LIT>" + self . UIMessages [ i ] [ <NUM_LIT:0> ] + "<STR_LIT>" + self . UIMessages [ i ] [ <NUM_LIT:1> ] + "<STR_LIT>" ; <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" ; <EOL> print "<STR_LIT>" ; <EOL> main ( ) </s>
