Skip to content

Instantly share code, notes, and snippets.

@kolbanidze
Created August 20, 2023 14:40
Show Gist options
  • Select an option

  • Save kolbanidze/a61e9ce93a032c984bd71f95e245af5e to your computer and use it in GitHub Desktop.

Select an option

Save kolbanidze/a61e9ce93a032c984bd71f95e245af5e to your computer and use it in GitHub Desktop.
Windows Nmap & Whois Auto install
# https://github.com/kolbanidze
# Windows nmap and whois auto-installer
from requests import get
from os import system, mkdir, remove
from os.path import exists
from zipfile import ZipFile
NMAP_DOWNLOAD_URL = "https://nmap.org/dist/nmap-7.94-setup.exe"
WHOIS_DOWNLOAD_URL = "https://download.sysinternals.com/files/WhoIs.zip"
WHOIS_INSTALL_FOLDER = "C:\whois"
INSTALL_NMAP = True
INSTALL_WHOIS = True
# Downloading and saving nmap
if INSTALL_NMAP:
nmap = get(NMAP_DOWNLOAD_URL)
with open('nmap.exe', 'wb') as file:
file.write(nmap.content)
system("nmap.exe")
# Downloading and installing whois
if INSTALL_WHOIS:
whois = get(WHOIS_DOWNLOAD_URL)
with open("whois.zip", 'wb') as file:
file.write(whois.content)
if not exists(WHOIS_INSTALL_FOLDER):
mkdir(WHOIS_INSTALL_FOLDER)
with ZipFile("whois.zip", "r") as archive:
archive.extractall(WHOIS_INSTALL_FOLDER)
# Adding whois to path
system(f'setx path "%PATH%;{WHOIS_INSTALL_FOLDER}"')
# Removing files/WhoIs
if INSTALL_NMAP:
remove("nmap.exe")
if INSTALL_WHOIS:
remove("whois.zip")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment