<s> from canari . maltego . message import Field , UIMessage <EOL> from canari . easygui import multenterbox <EOL> from canari . framework import configure <EOL> from common . dbconnect import db_connect <EOL> from common . entities import KippoHoneypot , KippoSession <EOL> __author__ = '<STR_LIT>' <EOL> __copyright__ = '<STR_LIT>' <EOL> __credits__ = [ ] <EOL> __license__ = '<STR_LIT>' <EOL> __version__ = '<STR_LIT>' <EOL> __maintainer__ = '<STR_LIT>' <EOL> __email__ = '<STR_LIT>' <EOL> __status__ = '<STR_LIT>' <EOL> __all__ = [ <EOL> '<STR_LIT>' <EOL> ] <EOL> @ configure ( <EOL> label = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> uuids = [ '<STR_LIT>' ] , <EOL> inputs = [ ( '<STR_LIT>' , KippoHoneypot ) ] , <EOL> debug = False <EOL> ) <EOL> def dotransform ( request , response ) : <EOL> msg = '<STR_LIT>' <EOL> title = '<STR_LIT>' <EOL> fieldNames = [ "<STR_LIT>" ] <EOL> fieldValues = [ ] <EOL> fieldValues = multenterbox ( msg , title , fieldNames ) <EOL> if fieldValues [ <NUM_LIT:0> ] != '<STR_LIT>' : <EOL> s_ip = fieldValues [ <NUM_LIT:0> ] <EOL> else : <EOL> return response + UIMessage ( '<STR_LIT>' ) <EOL> host = request . fields [ '<STR_LIT>' ] <EOL> x = db_connect ( host ) <EOL> try : <EOL> cursor = x . cursor ( ) <EOL> query = "<STR_LIT>" <EOL> cursor . execute ( query , ( s_ip , ) ) <EOL> for ( id , starttime , endtime , sensor , ip , termsize , client ) in cursor : <EOL> e = KippoSession ( '<STR_LIT:%s>' % ( id ) ) <EOL> e . starttime = ( '<STR_LIT:%s>' % ( starttime ) ) <EOL> e . endtime = ( '<STR_LIT:%s>' % ( endtime ) ) <EOL> e . sensor = ( '<STR_LIT:%s>' % ( sensor ) ) <EOL> e . ipaddr = ( '<STR_LIT:%s>' % ( ip ) ) <EOL> e . termsize = ( '<STR_LIT:%s>' % ( termsize ) ) <EOL> e . client = ( '<STR_LIT:%s>' % ( client ) ) <EOL> e += Field ( '<STR_LIT>' , host , displayname = '<STR_LIT>' ) <EOL> response += e <EOL> return response <EOL> except Exception as e : <EOL> return response + UIMessage ( str ( e ) ) </s>
