Created
June 30, 2023 12:52
-
-
Save Patrick-Kelley/e4ff1d68b0f6d23ee3ac2143f09d8545 to your computer and use it in GitHub Desktop.
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
import subprocess | |
def run_nmap(cidr_block, output_file): | |
command = f"nmap -A -oX {output_file} {cidr_block}" | |
try: | |
subprocess.check_call(command, shell=True) | |
print(f"Nmap scan results saved to: {output_file}") | |
except subprocess.CalledProcessError as e: | |
print(f"Error executing Nmap command: {e}") | |
def main(): | |
cidr_blocks = input("Enter CIDR blocks (comma-separated): ").split(",") | |
output_file = input("Enter the output XML file name: ") | |
for cidr_block in cidr_blocks: | |
cidr_block = cidr_block.strip() | |
run_nmap(cidr_block, output_file) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment