How to use the pocsuite3.lib.core.data.logger function in pocsuite3

To help you get started, we’ve selected a few pocsuite3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github knownsec / pocsuite3 / pocsuite3 / lib / core / plugin.py View on Github external
def add_target(self, target):
        ret = False
        if isinstance(target, bytes):
            target = target.decode()

        if isinstance(target, str):
            kb.targets.add(target)
            ret = True
        else:
            err_msg = "[PLUIGIN] invalid target format: {0}".format(target)
            logger.error(err_msg)

        return ret
github knownsec / pocsuite3 / pocsuite3 / modules / fofa / __init__.py View on Github external
def check_token(self):
        if self.token_is_available():
            return True
        else:

            user = input("Fofa API user:")
            new_token = getpass.getpass("Fofa API  token:")
            self.token = new_token
            self.user = user
            if self.token_is_available():
                self.write_conf()
                return True
            else:
                logger.error("The Fofa api token is incorrect. "
                             "Please enter the correct api token.")
                self.check_token()
github knownsec / pocsuite3 / pocsuite3 / lib / core / interpreter.py View on Github external
def command_setg(self, *args, **kwargs):
        key, _, value = args[0].partition(" ")
        if key in self.current_module.global_options:
            self.current_module.setg_option(key, value)
            logger.info("{} => {}".format(key, value))
        else:
            logger.error("You can't set option '{}'.\n"
                         "Available options: {}".format(key, self.current_module.options))
github knownsec / pocsuite3 / pocsuite3 / lib / core / threads.py View on Github external
def exception_handled_function(thread_function, args=(), silent=False):
    try:
        thread_function(*args)
    except KeyboardInterrupt:
        kb.thread_continue = False
        kb.thread_exception = True
        raise
    except Exception as ex:
        if not silent:
            logger.error("thread {0}: {1}".format(threading.currentThread().getName(), str(ex)))

            if conf.verbose > 1:
                traceback.print_exc()
github knownsec / pocsuite3 / pocsuite3 / lib / core / common.py View on Github external
def wrapper(self, *args, **kwargs):
        if not self.current_module:
            logger.error("You have to activate any module with 'use' command.")
            return
        return fn(self, *args, **kwargs)
github knownsec / pocsuite3 / pocsuite3 / modules / shodan / __init__.py View on Github external
self.token,
                                                                                                  urllib.parse.quote(
                                                                                                      dork),
                                                                                                  page)
                resp = requests.get(url)
                if resp and resp.status_code == 200 and "total" in resp.json():
                    content = resp.json()
                    for match in content['matches']:
                        ans = match['ip_str']
                        if 'port' in match:
                            ans += ':' + str(match['port'])
                        search_result.add(ans)
                else:
                    logger.error("[PLUGIN] Shodan:{}".format(resp.text))
        except Exception as ex:
            logger.error(str(ex))
        return search_result
github knownsec / pocsuite3 / pocsuite3 / modules / listener / reverse_tcp.py View on Github external
elif cmd.lower() == "clear":
                clear_history()
                data_to_stdout("[i] history cleared\n")

            elif cmd.lower() in ("x", "q", "exit", "quit", "bye"):
                break

            client.conn.send(str.encode(cmd + '\n'))

            resp = poll_cmd_execute(client)

            data_to_stdout(resp)

        except Exception as ex:
            logger.error(str(ex))
            data_to_stdout("Connection Lost\n")
            break
    return True
github knownsec / pocsuite3 / pocsuite3 / cli.py View on Github external
def check_environment():
    try:
        os.path.isdir(module_path())
    except Exception:
        err_msg = "your system does not properly handle non-ASCII paths. "
        err_msg += "Please move the pocsuite's directory to the other location"
        logger.critical(err_msg)
        raise SystemExit
github knownsec / pocsuite3 / pocsuite3 / modules / listener / reverse_tcp.py View on Github external
listen_host = "::"
    else:
        s = socket.socket(socket.AF_INET, protocol)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

    try:
        s.bind((listen_host, listen_port))
    except socket.error:
        s.close()
        # import traceback
        # traceback.print_exc()
        return None

    if protocol == socket.SOCK_STREAM:
        msg = "listening on {0}:{1}".format(listen_host, listen_port)
        logger.log(CUSTOM_LOGGING.SYSINFO, msg)
        s.listen(5)
    return s