def start(self): path = self.generate() web.path = path if web.payloads is not None: if self.dbms: if self.dbms == 'Mongo': cmd = "run -id -p {0}:80 -v {1}:{2}:rw -v {3}:/etc/php5/fpm/php.ini:ro -v {4}:/usr/lib/php5/modules/mongodb.so:ro --link {5}:{6} --name VW --workdir {2} {7} ".format( self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), os.path.join(web.path, 'mongodb.so'), web.container_name, self.dbms.lower(), self.image) else: cmd = "run -id -p {0}:80 -v {1}:{2} -v {3}:/etc/php5/fpm/php.ini --link {4}:{5} --name VW --workdir {2} {6} ".format( self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), web.container_name, self.dbms.lower(), self.image) if self.command: cmd = cmd + self.command web.dAgent.send(cmd) else: cmd = "run -id -p {0}:80 -v {1}:{2}:rw -v {3}:/etc/php5/fpm/php.ini:ro --name VW --workdir {2} {4} ".format( self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), self.image) if self.command: cmd = cmd + self.command web.dAgent.send(cmd) web.ctr = web.dAgent.recv() if "cmd" in web.payloads: Logger.logInfo( "[INFO] " + "CMD: {0}".format(web.payloads['cmd'])) web.dAgent.send( "exec {0} -- {1}".format(web.ctr, web.payloads['cmd'])) if "warning" in web.payloads: for warning in web.payloads['warning']: Logger.logWarning("[WARNING] " + warning) if "error" in web.payloads: for error in web.payloads['error']: Logger.logError("[ERROR] " + error) url = ['http', '127.0.0.1:{0}'.format( self.expose), '/', '', '', ''] params = {} if web.payloads['key'] is not None: for index, _ in enumerate(web.payloads['key']): if re.search("page", web.payloads['key'][index], flags=re.IGNORECASE): web.payloads['value'][index] = "index" params.update({'{0}'.format(web.payloads['key'][index]): '{0}'.format( web.payloads['value'][index])}) query = params url[4] = urlencode(query) t = Terminal() with t.location(0, t.height - 1): Logger.logSuccess( t.center(t.blink("Browse: {0}".format(urlparse.urlunparse(url))))) web.dAgent.send("logs {0} -f".format(web.ctr))
def start(self): path = self.generate() web.path = path if web.payloads is not None: web.ctr = web.dAgent.startContainer(image='{0}'.format(self.image), ports=[80], volumes=['{0}'.format(self.mount_point), '/etc/php5/fpm/php.ini'], host_config=web.dAgent.createHostConfig( port_bindings={ 80: self.expose }, binds=self.bindsOperation(), links={'{0}'.format(web.container_name): '{0}'.format( self.dbms.lower())} if self.dbms is not None else None ), name='VW') if "cmd" in web.payloads: Logger.logInfo( "[INFO] " + "CMD: cd {0} && {1}".format(self.mount_point, web.payloads['cmd'])) web.dAgent.execute(web.ctr, web.payloads[ 'cmd'], self.mount_point) if "warning" in web.payloads: for warning in web.payloads['warning']: Logger.logWarning("[WARNING] " + warning) if "error" in web.payloads: for error in web.payloads['error']: Logger.logError("[ERROR] " + error) url = ['http', '{0}:{1}'.format( web.dAgent.host, self.expose), '/', '', '', ''] params = {} if web.payloads['key'] is not None: for index, _ in enumerate(web.payloads['key']): if re.search("page", web.payloads['key'][index], flags=re.IGNORECASE): web.payloads['value'][index] = "index" params.update({'{0}'.format(web.payloads['key'][index]): '{0}'.format( web.payloads['value'][index])}) query = params url[4] = urlencode(query) t = Terminal() with t.location(0, t.height - 1): Logger.logSuccess( t.center(t.blink("Browse: {0}".format(urlparse.urlunparse(url))))) web.dAgent.logs(web.ctr)
from blessed import Terminal t = Terminal() print(t.bold('Hi there!')) print(t.bold_red_on_bright_green('It hurts my eyes!')) with t.location(0, t.height - 3): print(t.center(t.blink('press any key to continue.'))) with t.cbreak(): inp = t.inkey() print('You pressed ' + repr(inp))
def start(self): path = self.generate() web.path = path if web.payloads is not None: if self.dbms: if self.dbms == 'Mongo': cmd = "run -id -p {0}:80 -v {1}:{2}:rw -v {3}:/etc/php5/fpm/php.ini:ro -v {4}:/usr/lib/php5/modules/mongodb.so:ro --link {5}:{6} --name VW --workdir {2} {7} ".format( self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), os.path.join(web.path, 'mongodb.so'), web.container_name, self.dbms.lower(), self.image) else: cmd = "run -id -p {0}:80 -v {1}:{2} -v {3}:/etc/php5/fpm/php.ini --link {4}:{5} --name VW --workdir {2} {6} ".format( self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), web.container_name, self.dbms.lower(), self.image) if self.command: cmd = cmd + self.command web.dAgent.send(cmd) else: cmd = "run -id -p {0}:80 -v {1}:{2}:rw -v {3}:/etc/php5/fpm/php.ini:ro --name VW --workdir {2} {4} ".format( self.expose, web.path, self.mount_point, os.path.join(web.path, 'php.ini'), self.image) if self.command: cmd = cmd + self.command web.dAgent.send(cmd) web.ctr = web.dAgent.recv() if "cmd" in web.payloads: Logger.logInfo("[INFO] " + "CMD: {0}".format(web.payloads['cmd'])) web.dAgent.send("exec {0} -- {1}".format( web.ctr, web.payloads['cmd'])) if "warning" in web.payloads: for warning in web.payloads['warning']: Logger.logWarning("[WARNING] " + warning) if "error" in web.payloads: for error in web.payloads['error']: Logger.logError("[ERROR] " + error) url = [ 'http', '127.0.0.1:{0}'.format(self.expose), '/', '', '', '' ] params = {} if web.payloads['key'] is not None: for index, _ in enumerate(web.payloads['key']): if re.search("page", web.payloads['key'][index], flags=re.IGNORECASE): web.payloads['value'][index] = "index" params.update({ '{0}'.format(web.payloads['key'][index]): '{0}'.format(web.payloads['value'][index]) }) query = params url[4] = urlencode(query) t = Terminal() with t.location(0, t.height - 1): Logger.logSuccess( t.center( t.blink("Browse: {0}".format( urlparse.urlunparse(url))))) web.dAgent.send("logs {0} -f".format(web.ctr))