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.



9
10
11
12
13
# File 'lib/snackhack2/bypass_403.rb', line 9

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.



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

def bypass
  @bypass
end

#siteObject

Returns the value of attribute site.



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

def site
  @site
end

#wordlistObject

Returns the value of attribute wordlist.



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

def wordlist
  @wordlist
end

Instance Method Details

#basicObject



43
44
45
# File 'lib/snackhack2/bypass_403.rb', line 43

def basic
  web_request('//')
end

#dotsObject



64
65
66
# File 'lib/snackhack2/bypass_403.rb', line 64

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

#forward_forObject



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

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



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

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



60
61
62
# File 'lib/snackhack2/bypass_403.rb', line 60

def url_encode
  web_request('%2e')
end

#web_request(bypass) ⇒ Object



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

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