def check_for_updates(version): try: http_conn = httplib.HTTPSConnection("www.encripto.no", 443, timeout=10) headers = { "User-Agent": "Mozilla/5.0 (compatible; Maligno-Srv/" + version + ")" } http_conn.request("HEAD", "/tools/maligno-" + version + ".tar.gz", None, headers) http_resp = http_conn.getresponse() if http_resp.status == 404: malout.print_ok("There is a new version of Maligno!") malout.print_ok( "Check https://www.encripto.no/tools for more information.\n") elif http_resp.status == 200: malout.print_info( "You are running the latest version of Maligno.\n") else: malout.print_warning("Could not check for updates...\n") http_conn.close() except: malout.print_warning("Could not check for updates...\n") return
def get_cache_file_path(payload_id, folder_name, default_file): cache_file = str(payload_id) cache_path = "%s/%s" % (folder_name, cache_file) if os.path.isfile(cache_path): malout.print_ok("Requested payload OK...") # Uses the first (default) generated payload if not found else: cache_path = "%s/%s" % (folder_name, default_file) malout.print_warning("Requested payload not found in cache. Using default payload instead...") return cache_path
def get_cache_file_path(payload_id, folder_name, default_file): cache_file = str(payload_id) cache_path = "%s/%s" % (folder_name, cache_file) if os.path.isfile(cache_path): malout.print_ok("Requested payload OK...") # Uses the first (default) generated payload if not found else: cache_path = "%s/%s" % (folder_name, default_file) malout.print_warning( "Requested payload not found in cache. Using default payload instead..." ) return cache_path
def generate_client_file(script_code, output_file): try: fw = open(output_file, "w") fw.write("#!/usr/bin/python\n") for line in script_code: fw.write(line + "\n") fw.close() malout.print_ok('Client file "%s" successfully written!\n' % output_file) except IOError: malout.print_error("Could not save client code in %s.\n" % output_file) return
def generate_client_file(script_code, output_file): try: fw = open(output_file, 'w') fw.write("#!/usr/bin/python\n") for line in script_code: fw.write(line + "\n") fw.close() malout.print_ok("Client file \"%s\" successfully written!\n" % output_file) except IOError: malout.print_error("Could not save client code in %s.\n" % output_file) return
def check_for_updates(version): try: http_conn = httplib.HTTPConnection("www.encripto.no", 80, timeout=10) headers = {"User-Agent": "Mozilla/5.0 (compatible; Maligno-Srv/" + version + ")"} http_conn.request("HEAD", "/tools/maligno-" + version + ".tar.gz", None, headers) http_resp = http_conn.getresponse() if http_resp.status == 404: print "" malout.print_ok("There is a new version of Maligno!") malout.print_ok("Check http://www.encripto.no/tools for more information.\n") elif http_resp.status == 200: malout.print_ok("You are running the latest version of Maligno.\n") http_conn.close() except: malout.print_error("Could not check for updates...\n") return