zoukankan      html  css  js  c++  java
  • 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))
    本人小白,不接受任何合作,文章多为转载,如有侵权请联系。
  • 相关阅读:
    消息队列设计
    抓包工具Fiddler
    分布式系统和CAP
    Topshelf组件
    Parallel.For
    MVC插件
    Azure Messaging-ServiceBus Messaging
    MVC
    requireJS
    第一次react-native项目实践要点总结 good
  • 原文地址:https://www.cnblogs.com/thespace/p/15630583.html
Copyright © 2011-2022 走看看