Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import subprocess
- def main():
- print("Tools Scanner\n")
- n = input("1 - nmap\n2 - detection\n3 - exploit\nEnter number: ")
- if n == '1':
- nmap()
- elif n == '2':
- vuln()
- elif n == '3':
- os.system('msfconsole')
- else:
- print("Invalid choice. Please enter a number between 1 and 3.")
- def nmap():
- print("Running nmap scan...\n")
- ip = input("Enter target IP: ")
- port_range = input("Enter port range (e.g., 1-1024): ")
- try:
- # Use subprocess to call nmap for better control over the command
- result = subprocess.run(['nmap', '-p', port_range, ip], capture_output=True, text=True)
- print(result.stdout)
- except Exception as e:
- print(f"Error running nmap: {e}")
- def vuln():
- print("Running vulnerability scan...\n")
- ip = input("Enter target IP: ")
- try:
- # Correct the vulnerability scan command formatting
- result = subprocess.run(['nmap', '-sV', '--script=vulscan.nse', ip], capture_output=True, text=True)
- print(result.stdout)
- except Exception as e:
- print(f"Error running vulnerability scan: {e}")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement