def linker(target, path, proto, folder, out): fullpath = str(folder) + "/" + str(out) fulllinks = str(folder) + "/links.txt" url = 0 parsing = 0 i = 0 progress = 0 percent = 0 nb_lines = total_lines(folder, out) if os.path.exists(fullpath): print(status.ok(), "File found: " + fullpath) f = open(fullpath, 'r') if os.path.exists(fulllinks): os.remove(fulllinks) r = open(fulllinks, 'w+') print(status.st(), "Searching Urls") line = f.readline() while line: progress += 1 sys.stdout.write("Found: " + colors.green() + str(url) + colors.reset() + " Progress: " + colors.cyan() + "%d" % percent + colors.reset() + "%") sys.stdout.flush() sys.stdout.write('\b' * (7 + 11 + len(str(url)) + len(str(percent)))) sys.stdout.flush() while i < len(line) - 1: if line[i] == '/' and line[i - 1] == "\"" and line[i + 1] != '>': while line[i] != "\"" and i < len(line) - 1: r.write(line[i]) i += 1 r.write('\n') url += 1 if line[i] == '/' and line[i - 1] == "'" and line[i + 1] != '>': while line[i] != "'" and i < len(line) - 1: r.write(line[i]) i += 1 r.write('\n') i += 1 i = 0 line = f.readline() percent = ((nb_lines / progress) * 100) f.close() r.close() print("Found: " + colors.green() + str(url) + colors.reset() + " Progress: " + colors.cyan() + "%d" % percent + colors.reset() + "% => '" + colors.purple() + fulllinks + colors.reset() + "'") else: print(status.ok(), "File not found: " + fullpath)
def custom(target): script = None extracted = None choice = input(status.iu() + " Do you want to start custom nmap's scripts [Y|n]: ") if choice == 'Y': print(status.io(), "When you finished type 'exit' to stop 'NMAP' session") print( status.io(), "Default path of the nmap's scripts: '" + colors.purple() + "/usr/share/nmap/scripts" + colors.reset() + "'") while script != "exit": script = input(status.iu() + " FULL path of the nmap script: ") if script != "exit": print(status.st(), "Checking the script's file") if os.path.exists(script): print(status.ok(), "Script's file found") extracted = extract_script(script) execute(target, extracted) else: print(status.ko(), "Script's file no found")
def iu(): iu = colors.reset() + "[" + colors.yellow() + " >> " + colors.reset() + "]" return (iu)
def info(): no = colors.reset() + "[" + colors.white() + "INFO" + colors.reset() + "]" return (no)
def no(): no = colors.reset() + "[" + colors.red() + " NO " + colors.reset() + "]" return (no)
def st(): start = colors.reset() + "[" + colors.cyan() + "----" + colors.reset( ) + "]" return (start)
def ye(): ye = colors.reset() + "[" + colors.yellow() + " -> " + colors.reset() + "]" return (ye)
def io(): io = colors.reset() + "[" + colors.purple() + " ?? " + colors.reset() + "]" return (io)
def ok(): ok = colors.reset() + "[" + colors.green() + " OK " + colors.reset() + "]" return (ok)
def ko(): ko = colors.reset() + "[" + colors.red() + " KO " + colors.reset() + "]" return (ko)
def resume(posts, followers, following): print("%s %s: %s%s%s Posts | %s%s%s Followers | %s%s%s Following" % (status.info(), settings.USER, colors.cyan(), posts, colors.reset(), colors.cyan(), followers, colors.reset(), colors.cyan(), following, colors.reset()))
def input(): iu = colors.reset() + "[" + colors.yellow() + " ~> " + colors.reset() + "]" return (iu)
def error(): no = colors.reset() + "[" + colors.red() + " E: " + colors.reset() + "]" return (no)
def found(): ye = colors.reset() + "[" + colors.yellow() + " ## " + colors.reset() + "]" return (ye)