Class: Pastenum::Pastie

Inherits:
Target
  • Object
show all
Defined in:
lib/pastenum/targets/pastie.rb

Instance Attribute Summary

Attributes inherited from Target

#dork, #max_pages, #raw, #raw_url, #results, #vendor, #verbose

Instance Method Summary collapse

Methods inherited from Target

#summary, #verify_ssl_mode, #verify_ssl_mode=

Constructor Details

#initialize(dork) ⇒ Pastie

Returns a new instance of Pastie.



12
13
14
15
16
17
# File 'lib/pastenum/targets/pastie.rb', line 12

def initialize(dork)
  @dork = URI.escape(dork)
  @vendor = "http://pastie.org"

  super
end

Instance Method Details

#searchObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/pastenum/targets/pastie.rb', line 19

def search
  puts "[*] Searching Pastie.com (Limit: First #{@max_pages} Pages)".green if @verbose
  q = GScraper::Search.query(:query => @dork + " inurl:pastes -inurl:page", :site => 'pastie.org')
  print "[*] Parsing pages:".green if @verbose
  begin
    for i in 1..@max_pages do
      print ".".green if @verbose
      page = q.page(i)
      page.each do |result|
        if result.url.to_s.match(/pastes\/[0-9]+$/)
          code = result.url.to_s.split("/").last
          # code -> "6700343"
          if @raw 
            @results << "http://pastie.org/pastes/#{code}/text"
          else
            @results << "http://pastie.org/pastes/#{code}"
          end
        end
      end
    end
  rescue
    raise TargetUnreachable, "[!] ERROR: Google search unreachable , Maybe the googles banned you?"
  end
  puts "\n" if @verbose
  return @results.uniq!
end