Class: Ronin::Recon::CLI::Commands::New Private
- Inherits:
-
Ronin::Recon::CLI::Command
- Object
- Core::CLI::Command
- Ronin::Recon::CLI::Command
- Ronin::Recon::CLI::Commands::New
- Includes:
- Core::CLI::Generator, Core::CLI::Generator::Options::Author, Core::CLI::Generator::Options::Description, Core::CLI::Generator::Options::Reference, Core::CLI::Generator::Options::Summary
- Defined in:
- lib/ronin/recon/cli/commands/new.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Creates a new recon worker file.
Usage
ronin-recon new [options] FILE
Options
-t, --type worker|dns|web The type for the new recon worker
-a, --author NAME The name of the author (Default: Postmodern)
-e, --author-email EMAIL The email address of the author (Default: postmodern.mod3@gmail.com)
-S, --summary TEXT One sentence summary
-D, --description TEXT A longer description
-R, --reference URL Adds a reference URL
-A cert|domain|email_address|host|ip_range|ip|mailserver|nameserver|open_port|url|website|wildcard,
--accepts The value type(s) the worker accepts
-O cert|domain|email_address|host|ip_range|ip|mailserver|nameserver|open_port|url|website|wildcard,
--outputs The value type(s) the worker outputs
-I passive|active|aggressive, Specifies the intensity of the recon worker
--intensity
-h, --help Print help information
Arguments
PATH The path to the new recon workerfile
Constant Summary collapse
- WORKER_TYPES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mapping of recon worker types and their file/class names.
{ worker: { file: 'worker', class: 'Worker' }, dns: { file: 'dns_worker', class: 'DNSWorker' }, web: { file: 'web_worker', class: 'WebWorker' } }
- VALUE_TYPES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mapping of value types and their class names.
{ cert: 'Cert', domain: 'Domain', email_address: 'EmailAddress', host: 'Host', ip_range: 'IPRange', ip: 'IP', mailserver: 'Mailserver', nameserver: 'Nameserver', open_port: 'OpenPort', url: 'URL', website: 'Website', wildcard: 'Wildcard' }
Instance Attribute Summary collapse
-
#accepts ⇒ Set<String>
readonly
private
The values class names which the new worker will accept.
-
#intensity ⇒ :passive, ...
readonly
private
The intensity level for the new worker.
-
#outputs ⇒ Set<String>
readonly
private
The values class names which the new worker will output.
-
#worker_type ⇒ Hash{Symbol => String}?
readonly
private
The worker type information.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ New
constructor
private
Initializes the
ronin-recon new
command. -
#run(file) ⇒ Object
private
Runs the
ronin-recon new
command.
Constructor Details
#initialize(**kwargs) ⇒ New
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the ronin-recon new
command.
174 175 176 177 178 179 180 |
# File 'lib/ronin/recon/cli/commands/new.rb', line 174 def initialize(**kwargs) super(**kwargs) @worker_type = WORKER_TYPES.fetch(:worker) @accepts = Set.new @outputs = Set.new end |
Instance Attribute Details
#accepts ⇒ Set<String> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The values class names which the new worker will accept.
156 157 158 |
# File 'lib/ronin/recon/cli/commands/new.rb', line 156 def accepts @accepts end |
#intensity ⇒ :passive, ... (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The intensity level for the new worker.
166 167 168 |
# File 'lib/ronin/recon/cli/commands/new.rb', line 166 def intensity @intensity end |
#outputs ⇒ Set<String> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The values class names which the new worker will output.
161 162 163 |
# File 'lib/ronin/recon/cli/commands/new.rb', line 161 def outputs @outputs end |
#worker_type ⇒ Hash{Symbol => String}? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The worker type information.
151 152 153 |
# File 'lib/ronin/recon/cli/commands/new.rb', line 151 def worker_type @worker_type end |
Instance Method Details
#run(file) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Runs the ronin-recon new
command.
188 189 190 191 192 193 194 195 196 197 |
# File 'lib/ronin/recon/cli/commands/new.rb', line 188 def run(file) @directory = File.dirname(file) @file_name = File.basename(file,File.extname(file)) @class_name = CommandKit::Inflector.camelize(@file_name) mkdir @directory unless File.directory?(@directory) erb "worker.rb.erb", file chmod '+x', file end |