Created
September 23, 2009 00:43
-
-
Save postmodern/191592 to your computer and use it in GitHub Desktop.
Filters an Array of proxies, and returns speed statistics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'ronin/network/http' | |
require 'ronin/extensions/kernel' | |
require 'xmpp4r' | |
require 'xmpp4r/muc' | |
require 'uri' | |
require 'set' | |
include Ronin | |
include Jabber | |
jid = JID.new('[email protected]/proxies') | |
client = Client.new(jid) | |
client.connect | |
client.auth('loldacted') | |
client.send(Presence.new.set_status('Scanning proxies')) | |
muc = MUC::SimpleMUCClient.new(client) | |
muc.join(JID.new('[email protected]/ronin')) | |
trap(:INT) do | |
muc.exit | |
client.close | |
exit | |
end | |
scanned_proxies = SortedSet[] | |
ARGV.each do |path| | |
File.open(path) do |file| | |
file.each_line do |line| | |
url = line.strip | |
unless (url.empty? || scanned_proxies.include?(url)) | |
proxy = Network::HTTP::Proxy.parse(url) | |
if proxy.valid? | |
attempt do | |
body = Net.http_get_body(:host => proxy.host, :port => proxy.port, :path => '/') | |
if body.include?('CoDeeN') | |
STDERR.puts "[!] CoDeeN proxy detected: #{url}" | |
next | |
end | |
end | |
puts url | |
muc.say "Proxy detected: #{url}" | |
else | |
STDERR.puts "[!] Bad proxy: #{url}" | |
end | |
scanned_proxies << url | |
end | |
end | |
end | |
end | |
muc.exit | |
client.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment