I am currently lost with where to go from here. I assume it won't matter that I am using the decimal numbers for each octet int he IPv4 address but I could be wrong. When I do the calculations by hand on paper I do the math in binary but was unsure how to translate that logic into this application.
I will eventually go back and edit this but for now this is the part I am stuck at. What would you all recommend, besides using the ipcalc module, that will help me reach my goal?
Here is the function I have so far to get the addresses:
#determine netid, first host, last host, and broadcast addresses
def netaddrs(genaddr):
netinfo.netaddr
noctets = []
octets = genaddr.split('/')[0].split('.')
netbits = int(genaddr.split('/')[1])
#set nclass equal the octet number network bits end to set network class
nclass = 0
if 8 <= netbits < 16:
nclass = 2
elif 16 <= netbits < 24:
nclass = 3
elif 24 <= netbits:
nclass = 4
n = 255 - (mp(2, (8 * nclass) - netbits))
if nclass == 2:
elif nclass == 3:
elif nclass == 4:

New Topic/Question
Reply




MultiQuote






|