A fast, lightweight tool for analyzing IP subnet masks, ranges, and ownership information.
This version uses only native Python and the system whois command — no extra modules required.
- Accepts:
- CIDR format (e.g.,
/24) - Dotted netmask (e.g.,
255.255.255.0) - Hexadecimal netmask (e.g.,
0xffffff00) - Wildcard mask (e.g.,
0.0.0.255) - Full IP/mask combinations (e.g.,
192.168.1.10/24)
- CIDR format (e.g.,
- Outputs:
- CIDR notation
- Dotted decimal netmask
- Hexadecimal netmask
- Wildcard mask
- Number of usable IP addresses
- Network address and broadcast address
- First and last usable IPs
- Colorized warnings for unusual subnets (
/31,/32) - WHOIS lookup using system
whoisto find:- Organization
- Country
- Brief mode for compact one-line output
- Smart error handling:
- Detects if user inputs an IP instead of a netmask
- Clean guidance if mistakes are made
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/whatmask-python.git
cd whatmask-python
chmod +x getmask.py- (Optional) Install globally:
sudo cp getmask.py /usr/local/bin/whatmaskNow you can run whatmask from anywhere.
brew tap willcurtis/tools
brew install mac-lookup-tool- Python 3.6+
- System
whoiscommand
If needed, install whois:
# Ubuntu/Debian
sudo apt install whois
# RedHat/CentOS
sudo yum install whois
# macOS (Homebrew)
brew install whois./getmask.py 192.168.1.10 255.255.255.0
./getmask.py 192.168.1.10/255.255.255.0
./getmask.py 192.168.1.10/24Outputs a compact single line:
./getmask.py --brief 192.168.1.10/24Example:
CIDR: /24 | Network: 192.168.1.0 | Broadcast: 192.168.1.255 | Range: 192.168.1.1-192.168.1.254
Displays organization and country from the system's whois command:
./getmask.py --whois 8.8.8.8/24-
⚠️ If you input a/31or/32network, a colored warning is displayed:/31: Two-host subnet, point-to-point links/32: Single IP (host route)
-
⚠️ If you accidentally input an IP address without a subnet mask,
you are advised to use the correct format:
Example:
⚠️ Input 192.168.0.1 looks like an IP address, not a netmask.
⚠️ Hint: Use IP/mask format like 192.168.0.1/24
MIT License — see LICENSE for full terms.