Class: Pastenum::CLI
- Inherits:
-
Object
- Object
- Pastenum::CLI
- Defined in:
- lib/pastenum/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
14 15 16 17 18 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/pastenum/cli.rb', line 14 def initialize = {} [:pastebin] = true [:gist] = true [:github] = true [:pastie] = true [:pastee] = true [:raw] = Pastenum::Defaults::Raw [:onion] = false [:test] = false [:verbose] = Pastenum::Defaults::Verbose [:maxpages] = Pastenum::Defaults::MaxPages [:tos] = false [:ssl_verify] = true opt_parser = OptionParser.new do |opt| opt. = "Usage: pastenum [OPTIONS] \"search string\"" opt.separator "" opt.separator "Sources::" opt.on("","--[no-]pastebin","Search Pastebin.com (Gscraper)"," Default: #{[:pastebin]}") do |value| [:pastebin] = value end opt.on("","--[no-]gist","Search Gist.github.com"," Default: #{[:gist]}") do |value| [:gist] = value end opt.on("","--[no-]github","Search github.com"," Default: #{[:github]}") do |value| [:github] = value end opt.on("","--[no-]pastie","Search pastie.org (Gscraper)"," Default: #{[:pastie]}") do |value| [:pastie] = value end opt.on("","--[no-]pastee","Search pastee.org (Gscraper)"," Default: #{[:pastie]}") do |value| [:pastee] = value end opt.separator "Report Output:: (Default output to STDOUT)" opt.on("-H","--html-report","Create an html iframed (report.html) ") do [:report] = true end opt.on("-J", "--json-report", "Create a JSON file (report.json) ") do [:json] = true end opt.separator "Options::" opt.on("-r","--[no-]raw","use 'raw' urls instead if available" ," Default: #{[:raw]}") do |value| [:raw] = value end opt.on("-m","--maxpages=","maximum number of search results pages to iterate through" ," Default: #{[:maxpages]}") do |value| [:maxpages] = value end opt.on("-x", "--tos", "Acknowledge Google INC. 'Terms of Service'") do [:tos] = true end =begin opt.on("-o","--onion","use tor-network socks mode?") do options[:onion] = true end opt.on("-t", "--test", "Run Test suite") do options[:test] = v end =end opt.on("-V", "--[no-]ssl-verify", "Verify SSL certificates"," Default: #{[:ssl_verify]}") do |value| [:ssl_verify] = value end opt.on("-v", "--verbose", "Run verbosely") do [:verbose] = true end opt.on_tail("-h","--help","Display this screen") do puts opt_parser exit 0 end end #Verify the options begin raise unless ARGV.size > 0 opt_parser.parse! #If options fail display help #rescue Exception => e # puts e.message # puts e.backtrace.inspect rescue puts opt_parser exit end dork = ARGV[0] if [:onion] session.set_tor puts "Fetching Tor Exit IP" session.tor_check ensure_tor = ask("Are you protected? [NO/yes]") exit 1 if ensure_tor != 'yes' end if !([:tos]) puts "You are using Gscraper, a non-compliant Google Search API screen scraping utility.".red puts "" puts "*** Google Terms of Service: March 1, 2012 " puts " [..] This license is for the sole purpose of enabling you to " puts " use and enjoy the benefit of the Services as provided by Google," puts " in the manner permitted by these terms. [..] *** " puts "" ensure_tos = ask("Do you want to continue? [NO/yes]") exit 1 if ensure_tos != 'yes' end if [:verbose] puts "++++++++++++++++++++++++++++++++++++++++++++++".green puts "+ Pastie Enum".green puts "+ Version #{VERSION}".green puts "++++++++++++++++++++++++++++++++++++++++++++++\n".green end @gist = Pastenum::Gist.new(dork) @github = Pastenum::Github.new(dork) @pastebin = Pastenum::Pastebin.new(dork) @pastie = Pastenum::Pastie.new(dork) @pastee = Pastenum::Pastee.new(dork) if [:gist] @gist.verbose = [:verbose] @gist.max_pages = [:maxpages] @gist.verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE unless [:ssl_verify] @gist.search @gist.summary if [:raw] @gist.results.each { |hit| puts "#{@gist.raw_url}#{hit}" } if ![:report] && ![:json] else @gist.results.each { |hit| puts "#{@gist.vendor}#{hit}" } if ![:report] && ![:json] end end if [:github] @github.verbose = [:verbose] @github.max_pages = [:maxpages] @github.verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE unless [:ssl_verify] @github.raw = true if [:raw] @github.search @github.summary puts @github.results if ![:report] && ![:json] end if [:pastebin] @pastebin.verbose = [:verbose] @pastebin.max_pages = [:maxpages] @pastebin.search @pastebin.summary if [:raw] @pastebin.results.each { |hit| puts "#{@pastebin.raw_url}#{hit}" } if ![:report] && ![:json] else @pastebin.results.each { |hit| puts "http://pastebin.com/#{hit}" } if ![:report] && ![:json] end end if [:pastie] @pastie.verbose = [:verbose] @pastie.max_pages = 2 @pastie.raw = true if [:raw] @pastie.search @pastie.summary puts @pastie.results if ![:report] && ![:json] end if [:pastee] @pastee.verbose = [:verbose] @pastee.max_pages = 2 @pastee.search @pastee.summary puts @pastee.results if ![:report] && ![:json] end if [:report] Pastenum::Report.new(dork, @pastie.results, @pastee.results, @pastebin.results, @github.results, @gist.results).to_file end if [:json] Pastenum::JSON.new(dork, [@gist, @github, @pastebin, @pastie, @pastee]).to_file end end |
Class Method Details
.invoke ⇒ Object
9 10 11 |
# File 'lib/pastenum/cli.rb', line 9 def self.invoke self.new end |