From 02467c1d6fe5dc058a8c62a9f3cf6fb855846cf4 Mon Sep 17 00:00:00 2001 From: mosesrenegade Date: Fri, 29 Apr 2022 20:37:12 -0400 Subject: [PATCH] I added some IPv4 in IPv6 items, I made the system Python3 compatible, and I fixed some multi-line prints --- ipfuscator.py | 65 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/ipfuscator.py b/ipfuscator.py index 3deff5f..50b1182 100644 --- a/ipfuscator.py +++ b/ipfuscator.py @@ -15,11 +15,14 @@ def get_args(): return parser.parse_args() def banner(): - print "IPFuscator" - print "Author: Vincent Yiu (@vysecurity)" - print "https://www.github.com/vysec/IPFuscator" - print "Version: {}".format(__version__) - print "" + print( + ''' +IPFuscator +Author: Vincent Yiu (@vysecurity) +https://www.github.com/vysec/IPFuscator +Version: {} + + '''.format(__version__)) def checkIP(ip): m = re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\Z',ip) @@ -42,16 +45,21 @@ def printOutput(ip): parts = ip.split('.') decimal = int(parts[0]) * 16777216 + int(parts[1]) * 65536 + int(parts[2]) * 256 + int(parts[3]) - print "" - - print "Decimal:\t{}".format(decimal) #hexadecimal = "0x%02X%02X%02X%02X" % (int(parts[0]), int(parts[1]), int(parts[2]), int(parts[3])) - print "Hexadecimal:\t{}".format(hex(decimal)) - #octal = oct(decimal) - print "Octal:\t\t{}".format(oct(decimal)) - - print "" + print( + ''' +Decimal:\t{} +Hexadecimal:\t{} +Octal:\t\t{} + +IPv4 in IPv6: [::ffff:{}] +IPv4 in IPv6: [0:0:0:0:0:ffff:{}] + '''.format(decimal, + hex(decimal), + oct(decimal), + ip, + ip)) hexparts = [] octparts = [] @@ -60,11 +68,14 @@ def printOutput(ip): hexparts.append(hex(int(i))) octparts.append(oct(int(i))) - print "Full Hex:\t{}".format('.'.join(hexparts)) - print "Full Oct:\t{}".format('.'.join(octparts)) + print( + ''' +Full Hex:\t{} +Full Oct:\t{} + '''.format('.'.join(hexparts), + ('.'.join(octparts)))) - print "" - print "Random Padding: " + print("Random Padding: ") randhex = "" @@ -72,7 +83,7 @@ def printOutput(ip): randhex += i.replace('0x','0x' + '0' * random.randint(1,30)) + '.' randhex = randhex[:-1] - print "Hex:\t{}".format(randhex) + print("Hex:\t{}".format(randhex)) randoct = "" for i in octparts: @@ -80,10 +91,10 @@ def printOutput(ip): randoct = randoct[:-1] - print "Oct:\t{}".format(randoct) + print("Oct:\t{}".format(randoct)) - print "" - print "Random base:" + print("") + print("Radom base:") randbase = [] @@ -102,11 +113,11 @@ def printOutput(ip): randbaseval += octparts[i] + '.' # oct randbase.append(randbaseval[:-1]) - print "#{}:\t{}".format(count+1, randbase[count]) + print("#{}:\t{}".format(count+1, randbase[count])) count += 1 - print "" - print "Random base with random padding:" + print("") + print("Random base with random padding:") randbase = [] @@ -125,7 +136,7 @@ def printOutput(ip): randbaseval += '0' * random.randint(1,30) + octparts[i] + '.' # oct randbase.append(randbaseval[:-1]) - print "#{}:\t{}".format(count+1, randbase[count]) + print("#{}:\t{}".format(count+1, randbase[count])) count += 1 @@ -135,10 +146,10 @@ def main(): args = get_args() if checkIP(args.ip): - print "IP Address:\t{}".format(args.ip) + print("IP Address:\t{}".format(args.ip)) printOutput(args.ip) else: - print "[!] Invalid IP format: {}".format(args.ip) + print("[!] Invalid IP format: {}".format(args.ip)) if __name__ == '__main__':