Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'open-uri'
- require 'tempfile'
- require File.dirname(__FILE__) + '/regex_helpers'
- #http://spys.ru/free-proxy-list/GB/
- url = ARGV[0] || "http://spys.ru/free-proxy-list/GB/"
- OBFUS_JS_REGEX = />(eval.*?)<\/script>/m
- PROXY_REGEX = /<tr class=spy1xx?[^>]*><td[^>]*><font[^>]*>(?<number>[^<]*)<\/font>\s*<font[^>]*>(?<ip_address>[^<]+)<script type="text\/javascript">document\.write\("<font[^>]*>[^<]*<\\\/font>"[+](?<port_obfus>.*?)\)<\/script>.*?<\/td><td[^>]*>(?<type>[^<]*)<\/td><td[^>]*><font[^>]*>(?<anonymity>[^<]*)</m
- source = ""
- open(url).each { |l| source += l }
- obfus_match = OBFUS_JS_REGEX.match source
- proxy_matches = PROXY_REGEX.find_all_matches source
- if obfus_match and proxy_matches.length > 0
- file = Tempfile.new('proxies')
- file.write "#{obfus_match[1]};\n"
- proxies = {}
- proxy_matches.each do |proxy|
- file.write "console.log(''+#{proxy[:number]}+','+#{proxy[:port_obfus]});\n"
- proxies[proxy[:number]] = proxy
- end
- file.close
- `node #{file.path}`.split(/\n/).each do |line|
- parts = line.split /,/
- proxy = proxies[parts[0]]
- puts "#{parts[0]},#{proxy[:ip_address]},#{parts[1]},#{proxy[:type]},#{proxy[:anonymity]}"
- end
- else
- puts "Couldn't parse!"
- exit 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement