mirror of
https://github.com/lgandx/Responder.git
synced 2025-08-20 13:23:38 -07:00
Update settings.py to expand IPv6 addresses.
Still handles IPv4 addresses as well.
This commit is contained in:
parent
9c303d7bd5
commit
8953f87bbd
1 changed files with 44 additions and 17 deletions
27
settings.py
27
settings.py
|
@ -45,6 +45,33 @@ class Settings:
|
||||||
def expand_ranges(lst):
|
def expand_ranges(lst):
|
||||||
ret = []
|
ret = []
|
||||||
for l in lst:
|
for l in lst:
|
||||||
|
if ':' in l: #For IPv6 addresses, similar to the IPv4 version below but hex and pads :'s to expand shortend addresses
|
||||||
|
while l.count(':') < 7:
|
||||||
|
pos = l.find('::')
|
||||||
|
l = l[:pos] + ':' + l[pos:]
|
||||||
|
tab = l.split(':')
|
||||||
|
x = {}
|
||||||
|
i = 0
|
||||||
|
for byte in tab:
|
||||||
|
if byte == '':
|
||||||
|
byte = '0'
|
||||||
|
if '-' not in byte:
|
||||||
|
x[i] = x[i+1] = int(byte, base=16)
|
||||||
|
else:
|
||||||
|
b = byte.split('-')
|
||||||
|
x[i] = int(b[0], base=16)
|
||||||
|
x[i+1] = int(b[1], base=16)
|
||||||
|
i += 2
|
||||||
|
for a in range(x[0], x[1]+1):
|
||||||
|
for b in range(x[2], x[3]+1):
|
||||||
|
for c in range(x[4], x[5]+1):
|
||||||
|
for d in range(x[6], x[7]+1):
|
||||||
|
for e in range(x[8], x[9]+1):
|
||||||
|
for f in range(x[10], x[11]+1):
|
||||||
|
for g in range(x[12], x[13]+1):
|
||||||
|
for h in range(x[14], x[15]+1):
|
||||||
|
ret.append('%x:%x:%x:%x:%x:%x:%x:%x' % (a, b, c, d, e, f, g, h))
|
||||||
|
else:
|
||||||
tab = l.split('.')
|
tab = l.split('.')
|
||||||
x = {}
|
x = {}
|
||||||
i = 0
|
i = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue