# arirang script example


class Arirang

#@ari_port = 80
#@ari_recvsize = 1024
#@ari_recvflag = 3

    def baedal
        ari_title   = "nginx webserver heap overflow version check\n"
        ari_desc    = "CVE-2009-2629  \n"
        ari_author  = "pilot <pilot@monkey.org>\n"
        license     = "BSD \n"

        puts "title: #{ari_title}"
        puts "desc: #{ari_desc}"
        puts "author: #{ari_author}"
        puts "license: #{license}"
    end

    def asadal
        buf =  "GET / HTTP/1.0\r\n\r\n"
        ariconnect
        res = arisend(buf)

        res.each_line do |line|
        x = line.match(/^Server\: nginx\/(.+)\r/)

            if x != nil
            if x[1] > "0.6.0" and x[1] < "0.6.39" and x[1] != nil
                $y = x[1].gsub(/\r\n/,"") 
                z = "#{$ari_host} - nginx running with " + "#{$y} - overflow version CVE-2009-2629\n"  
                ariprint(z)
            end
            end
        end 
    end

end

