Skip to content

Outputs a bunch of useful information about a given subnet.

Notifications You must be signed in to change notification settings

Lyssers/subnetter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Subnetter

Useful for network admin and pentesting to get a quick and easy summary of a network

  1. Compile with gcc like:

gcc subnetter.c -o subnetter.o

  1. Run like:

./subnetter.o <ip_address> <subnet> e.g. ./subnetter.o 192.168.0.30 255.255.255.0

  1. Output:
This is subnetter
Arguments passed: 2

IP Address: 192.168.0.30
NetMask: 255.255.255.0

Decimal IP: 3232235550
Decimal Netmask: 4294967040

Decimal Network Starting Address: 3232235520

Starting address is:
192.168.0.1

Decimal Network Last Address: 3232235775

Last Address is:
192.168.0.255

Usable Hosts: 255

Optional: sudo cp ./subnetter.o /usr/bin/subnetter to run it with just subnetter

Output is very verbose by default which works for my needs, if you'd like a more parseable mode please let me know!

Alternatively use tail and awklike e.g. with cidr2mask

echo $(ifconfig wlan0 | grep 'inet' | head -1 | awk -F ' ' '{print $2}')  $(cidr2mask 24 | tail -1 |  awk -F ': ' '{print $2}') | xargs subnetter | tail -1 | awk -F ': ' '{print $2}'

The above outputs usable hosts for the network on the wlan0 network interace

About

Outputs a bunch of useful information about a given subnet.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages