class Pr0xy
Attributes
proto[RW]
tmp[RW]
Public Class Methods
new()
click to toggle source
# File lib/m4dh4v45b1n/rand-util.rb, line 36 def initialize @tmp = [] end
Public Instance Methods
check_if_the_proxy_is_up(host, port)
click to toggle source
# File lib/m4dh4v45b1n/rand-util.rb, line 39 def check_if_the_proxy_is_up(host, port) proxy = Net::HTTP::Proxy( host, port ) begin Timeout::timeout(10) do uri = URI "http://ifconfig.me/" req = Net::HTTP::Get::new(uri.path) res = proxy.start(uri.host,uri.port) do |http| http.request(req) end if res.code == '200' and res.body.length <= 16 and res.body.length >= 7 and res.body.split(".").length == 4 print "." return true end end rescue => e end return false end
get_proxies(file, check)
click to toggle source
# File lib/m4dh4v45b1n/rand-util.rb, line 63 def get_proxies(file, check) if check print "\e[33;1mChecking Proxy status\e[0m" end if File.file? file File.open(file, "r").readlines.map do |l| sleep 0.02 Thread.new do if l.strip[0] != "#" l = l.strip.split(":") if check if check_if_the_proxy_is_up(l[0],l[1]) @tmp.append([l[0],l[1]]) end else @tmp.append([l[0], l[1]]) end end end while Thread::list.length > 100;end end else puts "\rUnable to locate proxy file.'#{file}'" exit end while Thread::list.length > 1;end;puts if @tmp.length < 1 print "\rThere is no proxy is alive.\n" + "please add proxy in ~/.proxies.txt to take default"+ " or specify fresh list with -D flag.\n" exit elsif @tmp.length <= 5 puts "\r#{@tmp.length} decoys are \e[31mDeductable\e[0m.\nAdd More decoy for better evation." sleep 3 end return @tmp end