def refresh(bot_input, bot_output): if bot_output.master.lower() in bot_input.nick.lower(): bot_output.say("Refreshing Plugins") reload.reload(bot_input.bot) config.config(bot_input.bot) bot_output.say("I'm all shiny and new now") else: bot_output.say("I'm gonna refresh my fist into your face!")
def __init__(self): cfg= config() self.listen_port = int(cfg.get('global', 'listen_port')) self.__re = self.__recv() # 用来接收数据包 self.me_url = None # 记录自己的ip,暂时弃用
def parsing_argument(args): global options if args.config: options['config'] = args.config if args.query: options['query'] = args.query if args.query_list: options['query_list'] = args.query_list # query multi source by send json if args.source_list: options['source_list'] = args.source_list # pattern: software | version if args.target: options['target'] = args.target if args.target_list: options['target_list'] = args.target_list options = config.config(options, args) source_parsing(options)
def __init__(self, server_address, RequestHandlerClass, secret, dirname): TCPServer.__init__(self, server_address, RequestHandlerClass) self.secret = secret self.dirname = dirname self.block_size = int(config().get('global', 'block_size'))
def __init__(self): self.io = io() self.parser = parser() self.config = config() self.badges = badges() self.colors_script = colors_script()
def __init__(self): self.db = db() self.badges = badges() self.importer = importer() self.storage = storage() self.config = config() self.modules = modules()
def __init__(self): self.io = io() self.badges = badges() self.parser = parser() self.config = config() self.helper = helper() self.details = { 'Name': "exploit/macos/safari_app/safari_reaper", 'Authors': ['enty8080'], 'Description': "macOS Safari.app crash.", 'Comments': [''] } self.options = { 'LHOST': { 'Description': "Local host.", 'Value': self.helper.getip(), 'Required': True }, 'LPORT': { 'Description': "Local port.", 'Value': 80, 'Required': True } }
def __init__(self): self.db = db() self.badges = badges() self.local_storage = local_storage() self.helper = helper() self.config = config() self.modules = modules() self.exceptions = exceptions()
def output_html(): for db in config(): name = db.get("name") try: db_info = get_db_table_info_data(**db) render_html(db_name=name, db_real_name=db.get("db"), tables=db_info) except Exception as e: print("exception {}".format(e))
def __init__(self): self.main = main() self.io = io() self.tip = tip() self.execute = execute() self.loader = loader() self.config = config() self.badges = badges() self.banner = banner() self.storage = storage()
def __init__(self): self.io = io() self.tip = tip() self.execute = execute() self.loader = loader() self.config = config() self.badges = badges() self.banner = banner() self.storage = storage() self.modules = modules() self.exceptions = exceptions()
def __init__(self): self.badges = badges() self.config = config() self.local_storage = local_storage() self.modules = modules() self.execute = execute() self.details = { 'Category': "developer", 'Name': "edit", 'Description': "Open module in editor.", 'Usage': "edit <module>", 'MinArgs': 1 }
def __init__(self): self.io = io() self.tip = tip() self.jobs = jobs() self.execute = execute() self.loader = loader() self.config = config() self.badges = badges() self.banner = banner() self.colors = colors() self.local_storage = local_storage() self.modules = modules() self.exceptions = exceptions() self.history = self.config.path_config['base_paths']['history_path']
def main(): log = mylog.my_logger(BASE_PATH + '\\log\\' + 'execute\ _log.log', logging.DEBUG, 'pengtaolog') # 打开日志 data_file_path = login.register(log) # 用户登录,返回该用户数据文件名 log.info('用户登录,返回该用户数据文件名') memo_o = memo_out.MemoOut(data_file_path) # 生成Memo_Out对象 log.info('利用数据文件名进行操作') if len(sys.argv) >= 2: if sys.argv[1] in ['-se', '--send_email']: # 系统命令行参数调用发邮件 log.debug('系统命令行参数调用发邮件') while True: try: ask = input('输出整年(year),整月(month)') if ask == 'year': data_path, choose = memo_o.out_all_a_year() log.debug('获得json文件的路径,和用户年份选择') if ask == 'month': data_path, choose = memo_o.out_all_a_month() log.debug('获得json文件的路径,和用户月份选择') break except Exception: print('输入错误') send_email.send_email_attach(f'这是{choose}的数据,请查看!', data_path, 'lv\ [email protected]') # 发送给特定人物的邮件 if len(sys.argv) >= 2: if sys.argv[1] in ['-rj', '--return_json']: # 系统命令行参数调用返回json数据 log.debug('系统命令行参数调用返回json数据') print(memo_o.get_all_a_month()) # 打印按月份返回的json数据 MemoAdmin.memoadmin(data_file_path) # 利用数据文件名进行操作 config.config(data_file_path) # 用户配置文件生成 log.info('用户配置文件生成')
def __init__(self): self.badges = badges() self.config = config() self.storage = storage() self.modules = modules() self.execute = execute() self.details = { 'Category': "developer", 'Name': "edit", 'Description': "Open module in editor.", 'Usage': "edit <module>", 'ArgsCount': 1, 'NeedsArgs': True, 'Args': list() }
def __init__(self): self.badges = badges() self.config = config() self.storage_path = self.config.path_config['base_paths']['storage_path'] self.local_storage = local_storage() self.global_storage = global_storage(self.storage_path) self.details = { 'Category': "developer", 'Name': "storage", 'Description': "Manage storage variables.", 'Usage': "storage [global|local] [-l|-v <name>|-s <name> <value>|-d <name>]", 'MinArgs': 2 }
def main(): import os cwd = os.path.dirname(os.path.abspath(sys.argv[0])) os.chdir(cwd) # 切换成程序所在目录 from core.config import config cfg = config() directory = cfg.get('global', 'share_dir') if not os.path.isdir(directory): sys.stderr.write("%s not is exist\n" % directory) sys.exit(1) url = 'http://localhost:' + cfg.get('global', 'data_port') client = Client(url, directory) client.cmdloop()
def __init__(self, local_host, local_port, client): self.local_host = local_host self.local_port = local_port self.client = client self.badges = badges() self.helper = helper() self.config = config() self.terminator = terminator() self.exceptions = exceptions() self.first_stage = "uname -smp" self.first_stage_size = self.helper.len_line(self.first_stage) self.second_stage = self.config.path_config['base_paths']['data_path'] + "modules/exploit/linux/stager/zetant_reverse_tcp/bin/" self.second_stage_size = self.helper.len_file(self.second_stage) self.second_stage_path = "/private/var/tmp/." + self.terminator.generate_terminator()
def __init__(self): self.badges = badges() self.config = config() self.history = self.config.path_config['base_paths']['history_path'] self.storage_path = self.config.path_config['base_paths'][ 'storage_path'] self.local_storage = local_storage() self.global_storage = global_storage(self.storage_path) self.details = { 'Category': "developer", 'Name': "history", 'Description': "Manage HatSploit history.", 'Usage': "history [-l|on|off]", 'MinArgs': 1 }
def output_ddl_sql(): for db in config(): name = db.get("name") file = open(os.path.join("ddl_export", name + ".sql"), "w", encoding="utf8") try: ddl_builder = MySqlDDLBuilder(db.get("host"), db.get("user"), db.get("pass"), db.get("db"), db.get("port")) table_list = get_db_table_info_data(**db) for table in table_list: ddl_sql = ddl_builder.get_ddl(table.get("table_name")) if ddl_sql: file.write(ddl_sql) file.write(";\n\n") file.close() except Exception as e: print("exception {}".format(e))
def output_md(): for db in config(): name = db.get("name") markdown_output = "markdown_output" if not os.path.exists(markdown_output): os.makedirs(markdown_output) file_path = os.path.join(markdown_output, name + ".md") with open(file_path, "w", encoding="utf8") as file: try: result = get_db_table_info_data(**db) for d in result: table_name = d.get("table_name") table_fields = d.get("table_fields") write_to_md(table_name=table_name, field=table_fields, file=file) file.flush() except Exception as e: print("exception {}".format(e)) print("remove {}".format(file_path)) file.close() os.remove(file_path)
def parsing_argument(args): global options if args.config: options['config'] = args.config if args.query: options['query'] = args.query if args.query_list: options['query_list'] = args.query_list options = config.config(options, args) if options.get('query_list'): queris = utils.just_read(options.get('query_list')).splitlines() for query in queris: options['query'] = query single_query(options) else: single_query(options)
def __init__(self): self.badges = badges() self.parser = parser() self.config = config() self.web_tools = web_tools() self.details = { 'Name': "auxiliary/web/scanner/directory_scanner", 'Authors': ['enty8080'], 'Description': "Website directory scanner.", 'Dependencies': [''], 'Comments': [''], 'Risk': "medium" } self.options = { 'URL': { 'Description': "Target URL.", 'Value': None, 'Required': True } }
def __init__(self): self.config = config() requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def parsing_argument(args): options = config.config(args) routine.source_parsing(options)
def run_bot(): bot = Bot() bot._config_mtime = 0 parser = argparse.ArgumentParser(description="It's a Bot. Nuff Said") parser.add_argument('-a','--adapter', help='Adapter (console or flowbot). Default is console.') args = parser.parse_args() adapter_name = args.adapter if not adapter_name or not hasattr(adapters, adapter_name.lower()): logger.log("Adapter not found. Try console or flowbot. Using console") adapter_name = "console" adapter_class = getattr(adapters, adapter_name.lower()) sys.path += ['plugins'] # so 'import hook' works without duplication os.chdir(sys.path[0] or '.') # do stuff relative to the install directory print('Loading plugins') config.config(bot) reload.reload(bot, init=True) if not hasattr(bot, 'config'): logger.log("no config found for bot", logging.ERROR) exit() logger.log("Connecting") bot.conns = {} bot.credentials = {} try: if adapter_name in bot.config['adapters']: for room, conf in bot.config['adapters'][adapter_name]["rooms"].items(): conf["responses"] = personality.load_personality(conf["personality"].lower()) bot.conns[room] = adapter_class.BotOutput(conf) else: error_message = "Adapter not found in config: {0}".format(adapter_name) print(error_message) logger.error(error_message) sys.exit() for name, conf in bot.config['credentials'].items(): bot.credentials[name] = conf except Exception as e: logger.log("malformed config file %s" % e, logging.ERROR) sys.exit() bot.persist_dir = os.path.abspath('persist') if not os.path.exists(bot.persist_dir): os.mkdir(bot.persist_dir) logger.log("Running main loop") last_error = datetime(2000,1,1) last_run = datetime.now() while (last_error - last_run).seconds > 10: reload.reload(bot) # these functions only do things config.config(bot) # if changes have occurred for conn, adapter in bot.conns.items(): try: last_run = datetime.now() adapter.run(bot) except SystemExit as ex: last_error = last_run except Exception as e: logger.error(traceback.format_exc()) for info in sys.exc_info(): logger.log("error info: " + str(info)) #logger.log("Unexpected error: %s" % sys.exc_info()) last_error = datetime.now() logger.log("So tired... sleeping for 5 seconds") time.sleep(5)
def __init__(self): self.badges = badges() self.importer = importer() self.config = config()
# Copyright (c) 2020-2021 EntySec # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # from core.config import config config = config() config.configure() from tests.perform_tests import perform_tests perform_tests = perform_tests() perform_tests.perform_tests()
def __init__(self, secret, dirname): port = int(config().get('global', 'listen_port')) self.s = Server(('', port), Session, secret, dirname)