# arirang ruby script example 
# by pilot
#
# chunk.rb - converted scanrule/apache.uxe to arirang ruby script
#

class Arirang

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

    def baedal
        ari_title   = "converted scanrule/apache.uxe to arirang ruby script\n"
        ari_desc    = "apache chunked handling vulnerability               \n"
        ari_desc   += "Affected Apache Version 1.3.X: Apache < 1.3.26      \n"
        ari_desc   += "Affected Apache Version 2.x: Apache < 2.0.39        \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
        chunk =  "POST /check.html HTTP/1.1\r\n"
        chunk += "Host: 192.168.1.1\r\n"
        chunk += "Transfer-Encoding: chunked\r\n\r\naaaaaaaaaaaa\r\n\r\n"

        ariconnect
        res = arisend(chunk)
        buf = res.split("\r\n")[0]
        if buf != "HTTP\/1.1 400 Bad Request"
            z = "#{$ari_host} - apache chunked handling vulnerability found !!! \n"
            ariprint(z)
        elsif buf == "HTTP\/1.1 400 Bad Request"
            z = "#{$ari_host} - apache chunked handling vulnerability not affected !!! \n"
            ariprint(z)
        end
    end

end


