pastenum 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source :rubygems
2
+ gemspec
3
+
4
+ gem "mechanize", "~> 2.0"
5
+ gem "gscraper", "~> 0.4"
6
+ gem "uri-query_params", "~> 0.7"
7
+ gem "colored", "~> 1.2"
8
+ gem "bump", "~> 0.3"
9
+ gem "json", "~> 1.7"
10
+ gem "highline"
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011-2013 corelan, nullthreat, shadowbq
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,54 @@
1
+ #Pastenum
2
+
3
+ Pastenum is a gem rewrite of nullthreat's original pastenum2 google scrapper.
4
+
5
+ Install:
6
+ ------
7
+ * Install Ruby 1.9.*
8
+
9
+ * Install RubyGems
10
+
11
+ * gem install pastenum
12
+
13
+ Troubleshooting:
14
+ ======
15
+
16
+ ** Note: nokogiri in the gemfile requires native libxslt and libxml2 to be installed
17
+
18
+ Usage:
19
+ ------
20
+ `$> pastenum.rb`
21
+
22
+ When prompted enter a search term.
23
+ Once the application is complete it will generate "report.html"
24
+
25
+ ** Note: If more then 100 results are found, it can take some time to load the "report.html" file.
26
+
27
+
28
+ Notes on Future Versions:
29
+ ------
30
+
31
+ Gist / Github
32
+ ------
33
+
34
+ Use the appropriate API for github
35
+
36
+ http://developer.github.com/v3/repos/
37
+
38
+ Gscaper -> Google Custom Search API:
39
+ ------
40
+
41
+ Important: The Google Custom Search API requires the use of an API key, which you can get from the Google APIs console. The API provides 100 search queries per day for free. If you need more, you may sign up for billing in the console.
42
+
43
+ https://developers.google.com/custom-search/v1/overview
44
+
45
+ Original Pastenum Credits:
46
+ ------
47
+
48
+ Pastenum - A Corelan Team Production
49
+ Written by: Nullthreat
50
+
51
+ www.corelan.be
52
+ www.nullthreat.net
53
+ irc.freenode.net #corelan
54
+
@@ -0,0 +1,16 @@
1
+
2
+ RELEASE NOTES:
3
+ 6/05/2011
4
+ v .2
5
+ Added BT5 install instructions to README
6
+ Fixed some formatting
7
+ Generally Cleaned Code
8
+
9
+ 3/25/2011
10
+ v .1 RC2
11
+ Added github support
12
+ Added ability to enable and disable searches individually
13
+
14
+ 3/22/2011
15
+ v .1 RC1
16
+ Initial public release
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'rubygems'
5
+ require 'bundler'
6
+ Bundler.setup(:default)
7
+ rescue ::Exception => e
8
+ end
9
+
10
+ # Executable with absolute path to lib for hacking and development
11
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'pastenum', 'cli')
12
+
13
+ Pastenum::CLI.invoke
@@ -0,0 +1,24 @@
1
+ #STDLIBS
2
+ require 'uri'
3
+ require 'rubygems'
4
+
5
+ # RubyGems
6
+ require 'mechanize'
7
+ require 'uri/query_params'
8
+ require 'gscraper'
9
+ require 'colored'
10
+ require 'json'
11
+
12
+ # Internal
13
+ module Pastenum
14
+ $:.unshift(File.dirname(__FILE__))
15
+ require 'pastenum/main'
16
+ require 'pastenum/report'
17
+ require 'pastenum/json'
18
+ require 'pastenum/version'
19
+ require 'pastenum/target'
20
+ require 'pastenum/targets/gist'
21
+ require 'pastenum/targets/github'
22
+ require 'pastenum/targets/pastie'
23
+ require 'pastenum/targets/pastebin'
24
+ end
@@ -0,0 +1,180 @@
1
+ require 'optparse'
2
+ require 'pastenum'
3
+ require 'colored'
4
+ require 'highline/import'
5
+
6
+ module Pastenum
7
+ class CLI
8
+
9
+ def self.invoke
10
+ self.new
11
+ end
12
+
13
+
14
+ def initialize
15
+ options = {}
16
+
17
+ options[:pastebin] = true
18
+ options[:gist] = true
19
+ options[:github] = true
20
+ options[:pastie] = false
21
+
22
+ options[:onion] = false
23
+ options[:test] = false
24
+ options[:verbose] = false
25
+ options[:maxpages] = 2
26
+ options[:tos] = false
27
+
28
+ opt_parser = OptionParser.new do |opt|
29
+ opt.banner = "Usage: pastenum [OPTIONS] \"search string\""
30
+ opt.separator ""
31
+ opt.separator "Sources::"
32
+
33
+ opt.on("-p","--[no-]pastebin","Search Pastebin.com (Gscraper)"," Default: #{options[:pastebin]}") do
34
+ options[:pastebin] = true
35
+ end
36
+
37
+ opt.on("-g","--[no-]gist","Search Gist.github.com"," Default: #{options[:gist]}") do
38
+ options[:gist] = true
39
+ end
40
+
41
+ opt.on("-G","--[no-]github","Search github.com"," Default: #{options[:github]}") do
42
+ options[:github] = true
43
+ end
44
+
45
+ opt.on("-i","--[no-]pasties","Search pastie.org (Gscraper)"," Default: #{options[:pastie]}") do
46
+ options[:pastie] = true
47
+ end
48
+
49
+ opt.separator "Output:: (Default output to STDOUT)"
50
+
51
+ opt.on("-R","--report","Create an iframed report.html ") do
52
+ options[:report] = true
53
+ end
54
+
55
+ opt.on("-J", "--json", "Create a JSON file with results ") do
56
+ options[:json] = true
57
+ end
58
+
59
+
60
+ opt.separator "Options::"
61
+
62
+ opt.on("-m","--maxpages=","maximum number of search results pages to iterate through" ," Default: #{options[:maxpages]}") do |v|
63
+ options[:maxpages] = v
64
+ end
65
+
66
+ opt.on("-x", "--tos", "Acknowledge Google INC. 'Terms of Service'") do
67
+ options[:tos] = true
68
+ end
69
+ =begin
70
+ opt.on("-o","--onion","use tor-network socks mode?") do
71
+ options[:onion] = true
72
+ end
73
+
74
+ opt.on("-t", "--test", "Run Test suite") do
75
+ options[:test] = v
76
+ end
77
+ =end
78
+ opt.on("-v", "--verbose", "Run verbosely") do
79
+ options[:verbose] = v
80
+ end
81
+
82
+ opt.on_tail("-h","--help","Display this screen") do
83
+ puts opt_parser
84
+ exit 0
85
+ end
86
+
87
+
88
+ end
89
+
90
+ #Verify the options
91
+ begin
92
+ raise unless ARGV.size > 0
93
+ opt_parser.parse!
94
+
95
+ #If options fail display help
96
+ rescue
97
+ puts opt_parser
98
+ exit
99
+ end
100
+
101
+ dork = ARGV[0]
102
+
103
+ if options[:onion]
104
+ session.set_tor
105
+ puts "Fetching Tor Exit IP"
106
+ session.tor_check
107
+ ensure_tor = ask("Are you protected? [NO/yes]")
108
+ exit 1 if ensure_tor != 'yes'
109
+ end
110
+
111
+ if !(options[:tos])
112
+ puts "You are using Gscraper, a non-compliant Google Search API screen scraping utility.".red
113
+ puts ""
114
+ puts "*** Google Terms of Service: March 1, 2012 "
115
+ puts " [..] This license is for the sole purpose of enabling you to "
116
+ puts " use and enjoy the benefit of the Services as provided by Google,"
117
+ puts " in the manner permitted by these terms. [..] *** "
118
+ puts ""
119
+ ensure_tos = ask("Do you want to continue? [NO/yes]")
120
+ exit 1 if ensure_tos != 'yes'
121
+ end
122
+
123
+ if options[:verbose]
124
+ puts "++++++++++++++++++++++++++++++++++++++++++++++".green
125
+ puts "+ Pastie Enum".green
126
+ puts "+ Version #{VERSION}".green
127
+ puts "++++++++++++++++++++++++++++++++++++++++++++++\n".green
128
+ end
129
+
130
+ @gist = Pastenum::Gist.new(dork)
131
+ @github = Pastenum::Github.new(dork)
132
+ @pastebin = Pastenum::Pastebin.new(dork)
133
+ @pastie = Pastenum::Pastie.new(dork)
134
+
135
+
136
+ if options[:gist]
137
+
138
+ @gist.verbose = options[:verbose]
139
+ @gist.max_pages = options[:maxpages]
140
+ @gist.search
141
+ @gist.summary
142
+ @gist.results.each { |hit| puts "https://gist.github.com#{hit}" } if !options[:report] && !options[:json]
143
+ end
144
+
145
+ if options[:github]
146
+ @github.verbose = options[:verbose]
147
+ @github.max_pages = options[:maxpages]
148
+ @github.search
149
+ @github.summary
150
+ puts @github.results if !options[:report] && !options[:json]
151
+ end
152
+
153
+ if options[:pastebin]
154
+ @pastebin.verbose = options[:verbose]
155
+ @pastebin.max_pages = options[:maxpages]
156
+ @pastebin.search
157
+ @pastebin.summary
158
+ @pastebin.results.each { |hit| puts "http://pastebin.com#{hit}" } if !options[:report] && !options[:json]
159
+ end
160
+
161
+ if options[:pastie]
162
+ @pastie.verbose = options[:verbose]
163
+ @pastie.max_pages = 2
164
+ @pastie.search
165
+ @pastie.summary
166
+ puts @pastie.results if !options[:report] && !options[:json]
167
+ end
168
+
169
+ if options[:report]
170
+ Pastenum::Report.new(dork, @pastie.results, @pastebin.results, @github.results, @gist.results).to_file
171
+ end
172
+
173
+ if options[:json]
174
+ Pastenum::JSON.new(dork, @gist, @github, @pastebin, @pastie)
175
+ end
176
+
177
+ end
178
+
179
+ end
180
+ end
@@ -0,0 +1,14 @@
1
+ module Pastenum
2
+ class JSON
3
+
4
+ def initialize(dork, pastie, pastebin, github, gist)
5
+ file = File.open('report.json', 'w')
6
+ data = [{:search => dork}, {gist.vendor => gist.results}, {github.vendor => github.results}, {pastebin.vendor => pastebin.results}, {pastie.vendor => pastie.results} ].to_json
7
+ file.write(data)
8
+ file.close
9
+
10
+ return data
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ module Pastenum
2
+
3
+ class TargetTemplateErrorDirectCall < StandardError; end
4
+ class TargetUnreachable < StandardError; end
5
+
6
+
7
+
8
+
9
+ end
@@ -0,0 +1,83 @@
1
+ module Pastenum
2
+ class Report
3
+
4
+ def initialize(dork,addresses_pastie,addresses_pastebin,addresses_github,addresses_gist)
5
+ @dork = dork
6
+ @addresses_pastie = addresses_pastie
7
+ @addresses_pastebin = addresses_pastebin
8
+ @addresses_github = addresses_github
9
+ @addresses_gist = addresses_gist
10
+ end
11
+
12
+ def to_file
13
+ puts "[*] Creating HTML Report".green
14
+ print "[*] Status: ".green
15
+ file = File.open('report.html', 'w')
16
+
17
+ # Header
18
+
19
+ file.write("<html><head><title>Pastenum - #{@dork}</title>\n")
20
+ file.write("<style>\n")
21
+ file.write("body{background-color:#931b1c;color:#aaa;font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:.75em}#container{background-color:#000;margin:0 auto;padding:10px;width:90%}#logo{float:left;width:124px}#menu{background-color:#333;float:right;padding:10px;text-align:right;width:70%;height:17px}#footer{background-color:#333;clear:both;font-size:.80em;padding:2px;text-align:center;width:100%}#content{clear:both;padding-top:5px;padding-bottom:10px}img{border:0}#menu li{display:inline;margin-left:10px}#menu ul{margin:0;padding:0;list-style-type:none}#portfolio li{display:inline;margin-right:10px}#portfolio ul{margin:0;padding:0;list-style-type:none;padding-bottom:10px}a:hover{color:#ccc;text-decoration:none}a{color:#888;text-decoration:none}a.on{color:#ccc;text-decoration:none}h1{font-family:Georgia,\"Times New Roman\",Times,serif;font-weight:normal;font-size:1.3em}.center{text-align:center}input{background-color:#000;font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:1em;color:#fff;border-color:#fff;border-width:thin}textarea{background-color:#fff;font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:1em;color:#000;border-color:#fff;border-width:thin}\n")
22
+
23
+ file.write("</style>\n")
24
+ file.write("</head>\n")
25
+
26
+ file.write("<body><div id=\"container\"><div id=\"logo\">")
27
+ file.write("<img alt=\"Corelan Logo\" src=\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gAxSW1hZ2UgU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iMlIm85NowBuj6k1yPh7w5D4H8IeBfF0WgXGqyslzZ+JdCdHX7ZayTzLGxA55CMpP8LJCepFeSN8R/FrlC3ijWmKHKk6hN8pxjI+b0J/OoP8AhOPEZ1H+0P8AhINU+3+X5P2r7bJ5uzOdu7dnbnnHSvXp0adHm9nFK7u7dW+r8zFyct2ek/ETwPeP8OdF8Q3dld3njLXtXvLzVCsJJt4mjgeCMgD5SwlaX/dljHauT+OilfjP44VgQRrN2CD2/etWFaeOPEdhPczW3iDVLea5fzJ5Ir2RWlbpuYhvmPuax7i4lup5Jp5HmmkYu8kjFmZickknqTWxIyiiigAooooAKKKKACiiigAooooAKKKKACiiigD/2Q==\" />\n")
28
+
29
+
30
+ file.write("</div>\n")
31
+ file.write("<div id=\"menu\">Pastenum - Search Results for: '#{@dork}'</div>\n")
32
+ file.write("<div id=\"content\">")
33
+
34
+ #gist.github.com
35
+ unless @addresses_gist.empty?
36
+ file.write("<br /><h2>Site: Github Gist - Found: #{@addresses_gist.count} Items</h2>\n")
37
+ @addresses_gist.each do |links|
38
+ file.write("<p><script src=\"https://gist.github.com#{links}.js\"></script><p>link: <a href=\"#{links}\" target=\"_blank\">#{links}</a>\n")
39
+ print ".".green
40
+ end
41
+ end
42
+
43
+ #Github.com
44
+ unless @addresses_github.empty?
45
+ file.write("<br /><h2>Site: Github - Found: #{@addresses_github.count} Items</h2>\n")
46
+ file.write("NOTE: Github passes 'x-frame-options deny' so iframes are useless.\n")
47
+ @addresses_github.each do |links|
48
+ file.write("<p>link: <a href=\"#{links}\" target=\"_blank\">#{links}</a></p>\n")
49
+ print ".".green
50
+ end
51
+ end
52
+
53
+ # Pastebin.com
54
+ unless @addresses_pastebin.empty?
55
+ file.write("<br /><h2>Site: Pastebin - Found: #{@addresses_pastebin.count} Items</h2>\n")
56
+ @addresses_pastebin.each do |links|
57
+ file.write("<p><iframe src=\"http://pastebin.com/embed_iframe.php?i=#{links}\" style=\"border:none;width:100%;height:300px\"></iframe><p>link: <a href=\"http://pastebin.com/#{links}\" target=\"_blank\">http://pastebin.com/#{links}</a>\n")
58
+ print ".".green
59
+ end
60
+ file.write("<hr><hr>")
61
+ end
62
+
63
+ #Pastie.org
64
+ unless @addresses_pastie.empty?
65
+ file.write("<h2>Search Term: \"#{@dork}\" <br /> Site: Pastie - Found: #{@addresses_pastie.count} Items</h2>\n")
66
+ @addresses_pastie.each do |links|
67
+ file.write("<p><iframe src=#{links}/text style=\"width: 100%; height: 300px; background-color: white\"></iframe><p>link: <a href=\"#{links}\" target=\"_blank\">#{links}</a>\n")
68
+ print ".".green
69
+ end
70
+ file.write("<hr><hr>")
71
+ end
72
+
73
+ # Footer
74
+
75
+ file.write("</div>\n")
76
+ file.write("<div id=\"footer\">&copy; Corelan Team | Written by Nullthreat\n")
77
+ file.write("</div></body></html>\n")
78
+ file.close
79
+
80
+ puts "\n[*] HTML Report Created".green
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,26 @@
1
+ module Pastenum
2
+ class Target
3
+
4
+ attr_accessor :max_pages, :verbose
5
+ attr_reader :dork, :results, :vendor
6
+
7
+ def initialize(dork_url)
8
+ @dork = dork_url
9
+ @vendor = "TargetTemplate"
10
+ @results = Array.new
11
+ end
12
+
13
+ def search
14
+ raise TargetTemplateErrorDirectCall
15
+ end
16
+
17
+ def summary
18
+ if results.count == 0
19
+ puts "[!] No Items Found on #{@vendor}, Try Harder".red if @verbose
20
+ else
21
+ puts "[*] Total Items found on #{@vendor}: #{@results.count}".green if @verbose
22
+ end
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,77 @@
1
+ # Internal Gist Gist.github Search
2
+ module Pastenum
3
+ class Gist < Target
4
+
5
+ def initialize(dork)
6
+ @dork = URI.escape(dork)
7
+ @agent = Mechanize.new
8
+ @max_pages = 25
9
+ @results = Array.new
10
+ @vendor = "gist.github.com"
11
+ end
12
+
13
+ def search
14
+ puts "[*] Searching Gist".green if @verbose
15
+ current_page = 1
16
+ page_numbers.times do
17
+ print ".".green if @verbose
18
+ page = @agent.get("https://gist.github.com/search?page=#{current_page}&q=#{@dork}")
19
+ page.links.each do |link|
20
+
21
+ # Example Hits to find
22
+ # "/shadowbq/4556950"
23
+ # "/shadowbq/2718948"
24
+
25
+ if link.href.match(/\w+\/[0-9]+/)
26
+ @results << link.href unless @results.include?(link.href)
27
+ end
28
+ end
29
+ current_page += 1
30
+ end
31
+ puts "\n" if @verbose
32
+ return @results
33
+ end
34
+
35
+ private
36
+
37
+ #TODO: This is very inefficient. This is double fetch reading.
38
+ def page_numbers
39
+ page_num = 1
40
+ next_page = true
41
+
42
+ print "[*] Parsing pages:".green if @verbose
43
+ while next_page && page_num < @max_pages
44
+
45
+ print "#".green if @verbose
46
+ begin
47
+ page = @agent.get("https://gist.github.com/search?page=#{page_num}&q=#{@dork}")
48
+ rescue
49
+ raise TargetUnreachable, "[!] ERROR: Can not load gist.github - Check Connectivity"
50
+ end
51
+
52
+ # Find the link with the -> arrow, is it enabled?
53
+ # //div[@class='pagination']
54
+ pagination_parsed = false
55
+
56
+ page.links.each do |link|
57
+ if link.href.match(/\/search\?page\=/)
58
+ if link.text.match(/#x2192/)
59
+ page_num += 1
60
+ else
61
+ next_page = false
62
+ end
63
+ pagination_parsed = true
64
+ end
65
+ end
66
+
67
+ #handle single page of results
68
+ next_page = false unless pagination_parsed
69
+
70
+ end
71
+
72
+ return page_num
73
+
74
+ end
75
+
76
+ end
77
+ end
@@ -0,0 +1,67 @@
1
+ #Internal www.github.com search scraper
2
+ module Pastenum
3
+ class Github < Target
4
+
5
+ def initialize(dork)
6
+ @dork = URI.escape(dork)
7
+ @agent = Mechanize.new
8
+ @max_pages = 25
9
+ @results = Array.new
10
+ @vendor = "github.com"
11
+ end
12
+
13
+ def search
14
+ puts "[*] Searching Github".green if @verbose
15
+ current_page = 1
16
+ page_numbers.times do
17
+ print ".".green if @verbose
18
+ page = @agent.get("https://github.com/search?langOverride=&language=&q=#{@dork}&repo=&start_value=#{current_page}&type=Code&x=21&y=22")
19
+ page.links.each do |link|
20
+ if link.text.match(/\//)
21
+ address = "https://github.com#{link.href}"
22
+ @results << address unless @results.include?(address)
23
+ end
24
+ current_page += 1
25
+ end
26
+ end
27
+ puts "\n" if @verbose
28
+ return @results
29
+ end
30
+
31
+ private
32
+
33
+ def page_numbers
34
+ print "[*] Parsing pages:".green if @verbose
35
+
36
+ print "#".green if @verbose
37
+
38
+ begin
39
+ page = @agent.get("http://github.com/search?langOverride=&language=&q=#{@dork}&repo=&start_value=1&type=Code&x=21&y=22")
40
+ rescue
41
+ raise TargetUnreachable, "[!] ERROR: Can not load github - Check Connectivity"
42
+ end
43
+
44
+ page_count = []
45
+
46
+ page.links.each do |link|
47
+ if link.href.match(/search\?langOverride/)
48
+ pagenum = link.text
49
+ if pagenum.match(/\d/)
50
+ page_count << pagenum.to_i
51
+ end
52
+ else
53
+ end
54
+ end
55
+
56
+ if page_count.max > @max_pages
57
+ #puts "[*] #{page_count.max} pages of results found.".green
58
+ #puts "[*] Getting the first #{@max_pages} pages".green
59
+ return @max_pages
60
+ else
61
+ #puts "[*] #{page_count.max} pages of results found.".green
62
+ return page_count.max
63
+ end
64
+ end
65
+
66
+ end
67
+ end
@@ -0,0 +1,45 @@
1
+ #Google sitesearch for pastebin using GScraper
2
+ module Pastenum
3
+ class Pastebin < Target
4
+
5
+ def initialize(dork)
6
+ @dork = dork
7
+ @max_pages = 25
8
+ @results = Array.new
9
+ @vendor = "pastebin.com"
10
+ end
11
+
12
+ def search
13
+ puts "[*] Searching Pastebin.com (Limit: First #{@max_pages} Pages)".green if @verbose
14
+ q = GScraper::Search.query(:query => @dork, :site => 'pastebin.com')
15
+ print "[*] Parsing pages: ".green if @verbose
16
+ begin
17
+ for i in 1..@max_pages do
18
+ print ".".green if @verbose
19
+ page = q.page(i)
20
+ page.each do |result|
21
+ result_url = result.url
22
+ url2 = result_url.to_s.split("&").first
23
+ url3 = url2.split("=").last
24
+ # url3 -> "http://pastebin.com/E7SmXKMs"
25
+ url4 = url3.split("/").last
26
+ # url4 -> "E7SmXKMs"
27
+ if url4.length == 8
28
+ if
29
+ @results.include?(url4) == true
30
+ else
31
+ # result.cached_url.to_s
32
+ @results << url4
33
+ end
34
+ end
35
+ end
36
+ end
37
+ rescue
38
+ raise TargetUnreachable, "[!] ERROR: Google search unreachable , Maybe the googles banned you?"
39
+ end
40
+ puts "\n" if @verbose
41
+ return @results
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,57 @@
1
+ #Internal search implementation for pastie.org (deprecated, migrate to Gscraper)
2
+ module Pastenum
3
+ class Pastie < Target
4
+
5
+ def initialize(dork)
6
+ @dork = URI.escape(dork)
7
+ @agent = Mechanize.new
8
+ @results = Array.new
9
+ @vendor = "pastie.org"
10
+ end
11
+
12
+ def search
13
+ print "[*] Parsing pages:".green if @verbose
14
+ current_page = 1
15
+ page_numbers.times do
16
+ print ".".green if @verbose
17
+ page = @agent.get("http://pastie.org/search?&commit=Start+Search&page=#{current_page}&q=#{@dork}")
18
+ page.links.each do |link|
19
+ if link.href.match(/pastie\.org\/pastes/)
20
+ @results << link.href
21
+ end
22
+ end
23
+ current_page += 1
24
+ end
25
+ puts "\n" if @verbose
26
+ return @results
27
+ end
28
+
29
+ private
30
+
31
+ def page_numbers
32
+ puts "[*] Getting Results".green
33
+ begin
34
+ results = @agent.get("http://pastie.org/search?&commit=Start+Search&page=1&q=#{@dork}")
35
+ rescue
36
+ raise TargetUnreachable, "[!] ERROR: Can not load pastie.org - Check Connectivity"
37
+ end
38
+ puts "[*] Searching Pastie.org (Limit: 1000 Results)".green if @verbose
39
+ page_count = []
40
+ results.links.each do |link|
41
+ if link.href.match(/pastie.org\/pastes\//)
42
+ page_count << 1
43
+ else
44
+ page_count << 0
45
+ end
46
+ if link.href.match(/Start%2BSearch&page=/)
47
+ uri = link.href
48
+ url = URI("http://pastie.org/search/" + uri)
49
+ page_num = url.query_params['page']
50
+ page_count << page_num.to_i
51
+ end
52
+ end
53
+ page_count.max
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,3 @@
1
+ module Pastenum
2
+ VERSION = '0.2.2'
3
+ end
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
+ name = "pastenum"
3
+ require "#{name}/version"
4
+
5
+ Gem::Specification.new name, Pastenum::VERSION do |s|
6
+ s.platform = Gem::Platform::RUBY
7
+ s.summary = "Search Pastebins for content, fork from nullthreat corelan pastenum2"
8
+ s.authors = ["nullthreat", "shadowbq"]
9
+ s.email = ["shadowbq@github.com"]
10
+ s.homepage = "http://github.com/shadowbq/#{name}"
11
+ s.files = `git ls-files`.split("\n")
12
+ s.license = 'MIT'
13
+
14
+ s.required_rubygems_version = ">= 1.8.1"
15
+
16
+ s.executables = ["pastenum"]
17
+ end
@@ -0,0 +1,121 @@
1
+ /* Layout */
2
+
3
+ body {
4
+ background-color: #931B1C;
5
+ color: #AAA;
6
+ font-family: Tahoma, Arial, Helvetica, sans-serif;
7
+ font-size: .75em;
8
+ }
9
+
10
+ #container {
11
+ background-color: #000000;
12
+ margin: 0 auto;
13
+ padding: 10px;
14
+ width: 90%;
15
+ }
16
+
17
+ #logo {
18
+ float: left;
19
+ width: 124px;
20
+ }
21
+
22
+ #menu {
23
+ background-color: #333333;
24
+ float: right;
25
+ padding: 10px;
26
+ text-align: right;
27
+ width: 70%;
28
+ height: 17px;
29
+ }
30
+
31
+ #footer {
32
+ background-color: #333333;
33
+ clear: both;
34
+ font-size: .80em;
35
+ padding: 2px;
36
+ text-align: center;
37
+ width: 100%;
38
+ }
39
+
40
+ #content {
41
+ clear: both;
42
+ padding-top: 5px;
43
+ padding-bottom: 10px;
44
+ }
45
+
46
+ img {
47
+ border: none;
48
+ }
49
+
50
+
51
+ /* Menu */
52
+ #menu li {
53
+ display: inline;
54
+ margin-left: 10px;
55
+ }
56
+
57
+ #menu ul{
58
+ margin: 0;
59
+ padding: 0;
60
+ list-style-type: none;
61
+ }
62
+
63
+
64
+ /* Portfolio */
65
+ #portfolio li {
66
+ display: inline;
67
+ margin-right: 10px;
68
+
69
+ }
70
+
71
+ #portfolio ul{
72
+ margin: 0;
73
+ padding: 0;
74
+ list-style-type: none;
75
+ padding-bottom: 10px;
76
+ }
77
+
78
+
79
+ /* Text */
80
+ a:hover {
81
+ color: #CCCCCC;
82
+ text-decoration: none;
83
+ }
84
+
85
+ a {
86
+ color: #888888;
87
+ text-decoration: none;
88
+ }
89
+
90
+ a.on {
91
+ color: #CCCCCC;
92
+ text-decoration: none;
93
+ }
94
+
95
+ h1 {
96
+ font-family: Georgia, "Times New Roman", Times, serif;
97
+ font-weight: normal;
98
+ font-size: 1.3em;
99
+ }
100
+
101
+ .center {
102
+ text-align: center;
103
+ }
104
+
105
+ input {
106
+ background-color:#000000;
107
+ font-family:Tahoma, Arial, Helvetica, sans-serif;
108
+ font-size:1em;
109
+ color:#FFFFFF;
110
+ border-color:#FFFFFF;
111
+ border-width:thin;
112
+ }
113
+
114
+ textarea {
115
+ background-color:#000000;
116
+ font-family:Tahoma, Arial, Helvetica, sans-serif;
117
+ font-size:1em;
118
+ color:#FFFFFF;
119
+ border-color:#FFFFFF;
120
+ border-width:thin;
121
+ }
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pastenum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - nullthreat
9
+ - shadowbq
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-02-14 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description:
16
+ email:
17
+ - shadowbq@github.com
18
+ executables:
19
+ - pastenum
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - Gemfile
24
+ - LICENSE
25
+ - README.md
26
+ - RELEASE_NOTES
27
+ - bin/pastenum
28
+ - lib/pastenum.rb
29
+ - lib/pastenum/cli.rb
30
+ - lib/pastenum/json.rb
31
+ - lib/pastenum/main.rb
32
+ - lib/pastenum/report.rb
33
+ - lib/pastenum/target.rb
34
+ - lib/pastenum/targets/gist.rb
35
+ - lib/pastenum/targets/github.rb
36
+ - lib/pastenum/targets/pastebin.rb
37
+ - lib/pastenum/targets/pastie.rb
38
+ - lib/pastenum/version.rb
39
+ - pastenum.gemspec
40
+ - public/css/main.css
41
+ - public/img/corelanlogo_small.jpg
42
+ homepage: http://github.com/shadowbq/pastenum
43
+ licenses:
44
+ - MIT
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: 1.8.1
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 1.8.24
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Search Pastebins for content, fork from nullthreat corelan pastenum2
67
+ test_files: []