def __init__(self): self.modules = None self.currentmodule = None self.db = db_handler.DBHandler() self.commands = [("search", "Search for malwares according to a filter,\n\t\t\te.g 'search cpp worm'."), ("list all", "Lists all available modules"), ("use", "Selects a malware by ID"), ("info", "Retreives information about malware"), ("get", "Downloads selected malware"), ("report-mal", "Report a malware you found"), ("update-db", "Updates the databse"), ("help", "Displays this help..."), ("exit", "Exits...")] self.commandsWithoutDescription = {'search': '', 'list all': '', 'use': '', 'info': '', 'get': '', 'report-mal': '', 'update-db': '', 'help': '', 'exit': ''} self.searchmeth = [("arch", "which architecture etc; x86, x64, arm7 so on..."), ("plat", "platform: win32, win64, mac, android so on..."), ("lang", "c, cpp, vbs, bin so on..."), ("vip", "1 or 0")] self.modules = self.GetPayloads() completer = globals.Completer(self.commandsWithoutDescription) readline.parse_and_bind("tab: complete") readline.set_completer(completer.complete)
def getZooFilePath(): db = db_handler.DBHandler() details = db.get_full_details() filePath = list() #病毒文件解压后的文件路径 file_mal_familly = list() #与文件路径对应的病毒类型 for itms in details: if itms[6] == 'bin' and (itms[9] == 'win32' or itms[9] == 'win64'): templist = file_extract(itms[1]) filePath.extend(templist) for i in range(len(templist)): file_mal_familly.append(itms[2]) return filePath, file_mal_familly
def printInfAboutTheZoo(): result_dict = {} db = db_handler.DBHandler() details = db.get_full_details() tcount = 0 for itms in details: if itms[2] in result_dict: result_dict[itms[2]] += 1 else: result_dict[itms[2]] = 1 if (itms[6] == 'bin'): tcount += 1 print('the zoo has %d kinds of Malware' % len(result_dict)) for k, v in result_dict.items(): print(k, v) print('there are %d .exe' % tcount)
def __init__(self): self.modules = None self.currentmodule = '' self.db = db_handler.DBHandler() self.commands = [("search", "Search for malwares according to a filter,\n\t\t\te.g 'search cpp worm'."), ("list all", "Lists all available modules"), ("use", "Selects a malware by ID"), ("get", "Downloads selected malware"), ("report-mal", "Report a malware you found"), ("update-db", "Updates the databse"), ("help", "Displays this help..."), ("exit", "Exits...")] self.searchmeth = [("arch", "which architecture etc; x86, x64, arm7 so on..."), ("plat", "platform: win32, win64, mac, android so on..."), ("lang", "c, cpp, vbs, bin so on..."), ("vip", "1 or 0")] self.modules = self.GetPayloads()
def __init__(self): self.db = db_handler.DBHandler()
def __init__(self): self.db = db_handler.DBHandler() self.names = [x.lower() for x in self.db.get_mal_names()] self.tags = [x.lower() for x in self.db.get_mal_tags()]
def main(): # Much much imports :) updateHandler = Updater eulaHandler = EULA() bannerHandler = muchmuchstrings.banners() db = db_handler.DBHandler() terminalHandler = Controller() def filter_array(array, colum, value): ret_array = [row for row in array if value in row[colum]] return ret_array def getArgvs(): parser = OptionParser() parser = OptionParser() parser.add_option("-f", "--filter", dest="mal_filter", default=[], help="Filter the malwares.", action="append") parser.add_option("-u", "--update", dest="update_bol", default=0, help="Updates the DB of theZoo.", action="store_true") parser.add_option("-v", "--version", dest="ver_bol", default=0, help="Shows version and licensing information.", action="store_true") parser.add_option("-w", "--license", dest="license_bol", default=0, help="Prints the GPLv3 license information.", action="store_true") (options, args) = parser.parse_args() return options # Here actually starts Main() arguments = getArgvs() # Checking for EULA Agreement a = eulaHandler.check_eula_file() if a == 0: eulaHandler.prompt_eula() # Get arguments # Check if update flag is on if arguments.update_bol == 1: a = Updater() with open('conf/db.ver', 'r') as f: a.update_db(f.readline()) sys.exit(1) # Check if version flag is on if arguments.ver_bol == 1: print(vars.maldb_banner) sys.exit(1) # Check if license flag is on if arguments.license_bol == 1: bannerHandler.print_license() sys.exit(1) if len(arguments.mal_filter) > 0: manySearch = manysearches.MuchSearch() print(vars.maldb_banner) manySearch.sort(arguments.mal_filter) sys.exit(1) # Initiate normal run. No arguments given. os.system('cls' if os.name == 'nt' else 'clear') print(vars.maldb_banner) while 1: terminalHandler.MainMenu() sys.exit(1)