A powerful and awesome Ruby script for network scanning, pinging, port scanning with nmap, and fetching WHOIS domain info! π‘π It displays results with cool emojis and saves them in JSON and XML files. πΎ
- π IP Resolution: Resolves the IP address of a domain or host.
- π‘ Ping: Shows ping stats (packets transmitted/received, packet loss, and RTT).
- π Nmap Port Scan: Detects open ports (e.g., HTTP, HTTPS) using nmap.
- π° WHOIS Info: Checks domain availability, country, registrar, creation/expiration dates.
- πΎ Save Results: Stores results in JSON and XML files.
- π¨ Beautiful Output: Displays results with emojis and a clean, readable format.
To run this script, you need to install some tools and libraries. Donβt worry, weβll walk you through it step by step! π
- Linux or Termux (tested on Termux for Android).
- Windows: May work with proper tool installation, but not tested.
- Ruby 3.4.0 or higher
ruby --version
π¦ System Packages nmap: For port scanning. libxml2 and libxslt: Required for the nokogiri gem. iputils: For the ping command (optional if using net-ping gem). π Ruby Gems whois: For WHOIS queries. json: For JSON output. nokogiri: For XML output. π₯ Installation Follow these steps to set up the environment and run the script.
- Install System Packages In Termux (or Linux), install the required packages: pkg update && pkg upgrade pkg install nmap libxml2 libxslt iputils Verify nmap is installed: nmap --version
- Install Ruby Gems Install the necessary Ruby gems: gem install whois json nokogiri If you encounter issues with nokogiri, try a specific version: gem install nokogiri -v '1.16.7' Verify gems are installed: gem list You should see whois, json, and nokogiri in the list.
- Optional: Install net-ping for Robust Ping If the default ping command fails (common in Termux), install the net-ping gem: gem install net-ping
- Grant Storage Permissions (Termux) To allow saving JSON and XML files: termux-setup-storage
- Set File Permissions
Make the script executable:
chmod +x scanner.rb
π Usage
Run the script by passing a target domain or IP address as an argument:
ruby scanner.rb google.com
Or, if you made it executable:
./scanner.rb google.com
Example Output
πππ Super Cool Network Scan for google.com πππ
π Resolved IP: 142.250.185.174
π‘ Ping Stats:
π€ Transmitted: 4 packets
π₯ Received: 4 packets
π Packet Loss: 0.0%
β±οΈ RTT (min/avg/max/mdev): 10.123/12.456/14.789/1.234 ms
π Nmap Port Scan (Common Ports):
πͺ 80/tcp (http)
πͺ 443/tcp (https)
π Full Nmap Output:
Starting Nmap 7.98...
PORT STATE SERVICE
80/tcp open http
443/tcp open https
...
π° Domain WHOIS & Availability:
β Already registered. π
π Country: United States
π Registrar: MarkMonitor Inc.
π
Created: 1997-09-15
β° Expires: 2028-09-14
π Notes: π Secure domain, check renewal status.
β οΈ π Scan Complete! Results saved to XML and JSON files. πΎ Results are saved as google.com_results.json and google.com_results.xml in the current directory.β οΈ Troubleshooting If you run into issues, try these steps: - Ping Failure If you see β Ping failed: Check if ping works manually: ping -c 4 google.com Install iputils if missing: pkg install iputils Alternatively, use the net-ping gem (see Installation section). If root access is available (e.g., with tsu in Termux), try: tsu ruby scanner.rb google.com
- Nmap Issues If nmap shows unexpected results (e.g., too many open ports): Run nmap manually to verify: nmap -p 80,443,22,21,25,53,110,143,445,3389 google.com Ensure youβre not behind a proxy or firewall that interferes with results. Try running with root (if available): tsu nmap -p 80,443 google.com
- WHOIS Errors If WHOIS fails (e.g., "server not found"): Check your network connection. Test with another domain (e.g., example.com). Ensure the whois gem is installed: gem list | grep whois
- Gem Installation Issues If gems fail to install: Update RubyGems: gem update --system For nokogiri, ensure system dependencies are installed: pkg install libxml2 libxslt π‘ Tips Run as Root: Some nmap scans or ping commands may require root access in Termux. Install tsu for root: pkg install tsu Test with Different Targets: Try domains like example.com or IPs to ensure the script works as expected. Check Output Files: JSON and XML files are saved in the current directory. Use cat or a text editor to view them: cat google.com_results.json π License This project is licensed under the MIT License. Feel free to use, modify, and share! π π Contributing Got ideas to make this script even cooler? Submit a pull request or open an issue! Letβs make it more awesome together. π π¬ Contact Questions? Bugs? Suggestions? Reach out on GitHub Issues or ping me on X! π¦ Happy scanning! π