Class: Pastenum::Pastebin

Inherits:
Target
  • Object
show all
Defined in:
lib/pastenum/targets/pastebin.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) ⇒ Pastebin

Returns a new instance of Pastebin.



5
6
7
8
9
10
11
# File 'lib/pastenum/targets/pastebin.rb', line 5

def initialize(dork)
  @dork = dork
  @vendor = "pastebin.com"
  @raw_url = "http://pastebin.com/raw.php?i="
  
  super
end

Instance Method Details

#searchObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pastenum/targets/pastebin.rb', line 13

def search
  puts "[*] Searching Pastebin.com (Limit: First #{@max_pages} Pages)".green if @verbose
  q = GScraper::Search.query(:query => @dork, :site => 'pastebin.com')
  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|
        url = result.url.to_s.split("&").first.split("=").last
        # url -> "http://pastebin.com/E7SmXKMs"
        code = url.split("/").last
        # code -> "E7SmXKMs"
        if code.length == 8
          @results << code
        end
      end
    end
  rescue
    raise TargetUnreachable, "[!] ERROR: Google search unreachable , Maybe the googles banned you?"
  end
  puts "\n" if @verbose
  return @results.uniq!  
end