Last active
January 28, 2025 23:26
-
-
Save Malayke/08223b1edabfd1f01a57ac2609a679c8 to your computer and use it in GitHub Desktop.
parse/convert nmap grep output(gnmap) to projectdiscovery httpx target
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| if not sys.stdin.isatty(): | |
| stdin = sys.stdin.read().splitlines() | |
| gnmap = stdin | |
| elif len(sys.argv) > 1: | |
| target = sys.argv[1] | |
| with open(GNMAP) as f: | |
| gnmap = f.read().splitlines() | |
| else: | |
| usage = f'''usage:\n\t1. python {sys.argv[0]} result.gnmap\n\t2. cat result.gnmap | python {sys.argv[0]}''' | |
| print(usage) | |
| sys.exit(1) | |
| content = [] | |
| for line in gnmap: | |
| if 'Ports:' in line: | |
| content.append(line) | |
| for line in content: | |
| host_info = line.split() | |
| ip = host_info[1] | |
| for items in host_info: | |
| if '/open/' in items: | |
| port = items.split('/')[0] | |
| print(f"{ip}:{port}") |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage
add execution permision
copy this file to
/usr/local/binor other directory defined inPATHnmap scan genere grep result file
convert result
httpx scan.