Class: Snackhack2::Drupal
- Inherits:
-
Object
- Object
- Snackhack2::Drupal
- Defined in:
- lib/snackhack2/drupal.rb
Instance Attribute Summary collapse
-
#site ⇒ Object
Returns the value of attribute site.
Instance Method Summary collapse
- #all ⇒ Object
- #drupal_score ⇒ Object
-
#initialize ⇒ Drupal
constructor
A new instance of Drupal.
- #user_brute ⇒ Object
Constructor Details
#initialize ⇒ Drupal
Returns a new instance of Drupal.
9 10 11 |
# File 'lib/snackhack2/drupal.rb', line 9 def initialize @site = site end |
Instance Attribute Details
#site ⇒ Object
Returns the value of attribute site.
7 8 9 |
# File 'lib/snackhack2/drupal.rb', line 7 def site @site end |
Instance Method Details
#all ⇒ Object
13 14 15 16 |
# File 'lib/snackhack2/drupal.rb', line 13 def all drupal_score user_brute end |
#drupal_score ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/snackhack2/drupal.rb', line 18 def drupal_score drupal_score = 0 d = Snackhack2.get(@site) if d.code == 200 d.headers.each do |k| drupal_score += 10 if k.include?('drupal') end end d.headers.each do |v| drupal_score += 10 if v.include?('drupal') end doc = Nokogiri::HTML(URI.open(@site)) posts = doc.xpath('//meta') posts.each do |l| puts "\n\n[+] Drupal Version: #{l.attributes['content']}\n" if l.attributes['content'].to_s.include?('Drupal') end puts "\nDrupal Score: #{drupal_score}\n" end |
#user_brute ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/snackhack2/drupal.rb', line 37 def user_brute (1..1000).each do |user| u = Snackhack2.get(File.join(@site, 'user', user.to_s)).body if u.include?('Page not found') puts "\nUser count: #{user - 1}\n" break end end end |