BigIP Cookie 解码获取真实IP (python2)
作者:互联网
BIGip是对负载均衡的实现,主要通过Virtual Server、iRules、Pool、Node、Monitor和Persistent(会话保持)实现。BIGip在实现会话保持机制时会在用户首次发起请求时,会为用户设置一个cookie,即服务端会添加set-cookie响应头头(比如:Set-Cookie: BIGipServerFinanceAndAdminWebfo.unc.edu=105389996.20480.0000 )。后续的请求会判断并使用这个cookie值,服务端解码该cookie并使用服务器
工具需要python2的环境,使用方法:
python 1.py 110536896.20480.0000
1.py内容为以下代码
#!/usr/bin/python #python2 # example string: 110536896.20480.0000 import struct import sys if len(sys.argv) != 2: print "Usage: %s encoded_string" % sys.argv[0] exit(1) encoded_string = sys.argv[1] print("\n[*] String to decode: %s\n" % encoded_string) (host, port, end) = encoded_string.split('.') (a, b, c, d) = [ord(i) for i in struct.pack("<I", int(host))] (e) = [ord(e) for e in struct.pack("<H", int(port))] port = "0x%02X%02X" % (e[0],e[1]) print "[*] Decoded Host and Port: %s.%s.%s.%s:%s\n" % (a,b,c,d, int(port,16))
标签:sys,cookie,string,IP,argv,BigIP,Cookie,encoded,python2 来源: https://www.cnblogs.com/thespace/p/15630583.html