Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tasix networks parser
require 'net/http'
require 'uri'
def parseme(text)
text.each_line do |l|
l.gsub!(/[^\d.\/\s]/, '')
if l.match(/\d+\.\d+\.\d+\.\d+/)
if !l.match(/^[[:blank:]]{3,}/)
l.strip!
l = l.split[0]
if !l.match(/\//)
l = l + '/24'
end
puts l
end
end
end
end
uri = URI.parse("http://mrlg.tas-ix.uz/index.cgi")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/x-www-form-urlencoded"
request["Referer"] = "http://mrlg.tas-ix.uz/index.cgi"
request["Origin"] = "http://mrlg.tas-ix.uz"
request["User-Agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
request.set_form_data(
"router" => "cisco",
"pass1" => "",
"query" => "1",
"arg" => "",
)
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
# response.code
parseme(response.body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.