begin prologix class
This commit is contained in:
@@ -57,7 +57,7 @@ def ValidateNetParams(ip_str, mask_str, gw_str):
|
||||
# Validate network mask
|
||||
|
||||
# Convert to integer from byte array
|
||||
mask = struct.unpack("!L", mask)[0]
|
||||
mask = struct.unpack("!L", mask)[0]
|
||||
|
||||
# Exclude restricted masks
|
||||
if (mask == 0) or (mask == 0xFFFFFFFF):
|
||||
@@ -75,7 +75,7 @@ def ValidateNetParams(ip_str, mask_str, gw_str):
|
||||
octet1 = ord(gw[0])
|
||||
|
||||
# Convert to integer from byte array
|
||||
gw = struct.unpack("!L", gw)[0]
|
||||
gw = struct.unpack("!L", gw)[0]
|
||||
|
||||
# Exclude restricted addresses
|
||||
# 0.0.0.0 is valid
|
||||
@@ -88,7 +88,7 @@ def ValidateNetParams(ip_str, mask_str, gw_str):
|
||||
octet1 = ord(ip[0])
|
||||
|
||||
# Convert to integer from byte array
|
||||
ip = struct.unpack("!L", ip)[0]
|
||||
ip = struct.unpack("!L", ip)[0]
|
||||
|
||||
# Exclude restricted addresses
|
||||
if ((octet1 == 0) or (octet1 == 127) or (octet1 > 223)):
|
||||
@@ -197,8 +197,12 @@ def main():
|
||||
else:
|
||||
|
||||
try:
|
||||
eth_addr = eth_addr.strip().replace(":", "").replace("-", "")
|
||||
eth_addr = eth_addr.decode('hex')
|
||||
#eth_addr = eth_addr.strip().replace(":", "").replace("-", "")
|
||||
#eth_addr = eth_addr.decode('hex')
|
||||
eth_addr = eth_addr.replace(" ", "")
|
||||
eth_addr = eth_addr.replace(":", "")
|
||||
eth_addr = eth_addr.replace("-", "")
|
||||
eth_addr = bytes.fromhex(eth_addr)
|
||||
except:
|
||||
print("Invalid Ethernet address.")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user