# arirang ruby script example
# by pilot

class Arirang

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

     def baedal
        $ari_info = {
        'description' => '-G option result to csv file',
        'author' => 'pilot pilot@monkey.org'
        }
        puts $ari_info['description'] + "\n\n"
     end

     def asadal
         ariconnect
         extra = "GET / HTTP/1.0\r\n\r\n"
         response = arisend(extra)
         response.each_line do |line|
         x = line.match(/^Server\: (.+)\r/)
            if x != nil
                y = "#{$ari_host} , #{x[1]}"
                puts y
                File.open("report.csv", "a") do |fd|
                fd.write(y)
                fd.write("\n")
                end
            end
        end
    end

end

