Module: Ronin::CLI::PatternOptions Private
- Includes:
- Support::Text::Patterns
- Included in:
- Commands::Extract, Commands::Grep
- Defined in:
- lib/ronin/cli/pattern_options.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Adds pattern options to a command.
Options
-N, --number Searches for all numbers
-X, --hex-number Searches for all hexadecimal numbers
-V, --version-number Searches for all version numbers
-w, --word Searches for all words
--mac-addr Searches for all MAC addresses
-4, --ipv4-addr Searches for all IPv4 addresses
-6, --ipv6-addr Searches for all IPv6 addresses
-I, --ip Searches for all IP addresses
-H, --host Searches for all host names
-D, --domain Searches for all domain names
--uri Searches for all URIs
-U, --url Searches for all URLs
--user-name Searches for all user names
-E, --email-addr Searches for all email addresses
--obfuscated-email-addr Searches for all obfuscated email addresses
--phone-number Searches for all phone numbers
--ssn Searches for all Social Security Numbers (SSNs)
--amex-cc Searches for all AMEX Credit Card numbers
--discover-cc Searches for all Discover Card numbers
--mastercard-cc Searches for all MasterCard numbers
--visa-cc Searches for all VISA Credit Card numbers
--visa-mastercard-cc Searches for all VISA MasterCard numbers
--cc Searches for all Credit Card numbers
--file-name Searches for all file names
--dir-name Searches for all directory names
--relative-unix-path Searches for all relative UNIX paths
--absolute-unix-path Searches for all absolute UNIX paths
--unix-path Searches for all UNIX paths
--relative-windows-path Searches for all relative Windows paths
--absolute-windows-path Searches for all absolute Windows paths
--windows-path Searches for all Windows paths
--relative-path Searches for all relative paths
--absolute-path Searches for all absolute paths
-P, --path Searches for all paths
--variable-name Searches for all variable names
--function-name Searches for all function names
--md5 Searches for all MD5 hashes
--sha1 Searches for all SHA1 hashes
--sha256 Searches for all SHA256 hashes
--sha512 Searches for all SHA512 hashes
--hash Searches for all hashes
--ssh-private-key Searches for all SSH private key data
--ssh-public-key Searches for all SSH public key data
--private-key Searches for all private key data
--rsa-public-key Searches for all RSA public key data
--dsa-public-key Searches for all DSA public key data
--ec-public-key Searches for all EC public key data
--public-key Searches for all public key data
--aws-access-key-id Searches for all AWS access key IDs
--aws-secret-access-key Searches for all AWS secret access keys
-A, --api-key Searches for all API keys
--single-quoted-string Searches for all single-quoted strings
--double-quoted-string Searches for all double-quoted strings
-S, --string Searches for all quoted strings
-B, --base64 Searches for all Base64 strings
-e, --regexp /REGEXP/ Custom regular expression to search for
Instance Attribute Summary collapse
-
#pattern ⇒ Regexp?
readonly
private
The pattern to search for.
Class Method Summary collapse
-
.define_credentials_options(command) ⇒ Object
private
Defines credentials pattern options.
-
.define_crypto_options(command) ⇒ Object
private
Defines cryptographic pattern options.
-
.define_file_system_options(command) ⇒ Object
private
Defines File System pattern options.
-
.define_language_options(command) ⇒ Object
private
Defines language pattern options.
-
.define_network_options(command) ⇒ Object
private
Defines network pattern options.
-
.define_numeric_options(command) ⇒ Object
private
Defines numeric pattern options.
-
.define_pii_options(command) ⇒ Object
private
Defines PII pattern options.
-
.define_source_code_options(command) ⇒ Object
private
Defines source code pattern options.
-
.included(command) ⇒ Object
private
Adds pattern options to the command.
Instance Attribute Details
#pattern ⇒ Regexp? (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 pattern to search for.
454 455 456 |
# File 'lib/ronin/cli/pattern_options.rb', line 454 def pattern @pattern end |
Class Method Details
.define_credentials_options(command) ⇒ 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.
Defines credentials pattern options.
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/ronin/cli/pattern_options.rb', line 415 def self.(command) command.option :ssh_private_key, desc: 'Searches for all SSH private key data' do @pattern = SSH_PRIVATE_KEY end command.option :dsa_private_key, desc: 'Searches for all DSA private key data' do @pattern = DSA_PRIVATE_KEY end command.option :ec_private_key, desc: 'Searches for all EC private key data' do @pattern = EC_PRIVATE_KEY end command.option :rsa_private_key, desc: 'Searches for all RSA private key data' do @pattern = RSA_PRIVATE_KEY end command.option :private_key, short: '-K', desc: 'Searches for all private key data' do @pattern = PRIVATE_KEY end command.option :aws_access_key_id, desc: 'Searches for all AWS access key IDs' do @pattern = AWS_ACCESS_KEY_ID end command.option :aws_secret_access_key, desc: 'Searches for all AWS secret access keys' do @pattern = AWS_SECRET_ACCESS_KEY end command.option :api_key, short: '-A', desc: 'Searches for all API keys' do @pattern = API_KEY end end |
.define_crypto_options(command) ⇒ 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.
Defines cryptographic pattern options.
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/ronin/cli/pattern_options.rb', line 379 def self.(command) command.option :md5, desc: 'Searches for all MD5 hashes' do @pattern = MD5 end command.option :sha1, desc: 'Searches for all SHA1 hashes' do @pattern = SHA1 end command.option :sha256, desc: 'Searches for all SHA256 hashes' do @pattern = SHA256 end command.option :sha512, desc: 'Searches for all SHA512 hashes' do @pattern = SHA512 end command.option :hash, desc: 'Searches for all hashes' do @pattern = HASH end command.option :ssh_public_key, desc: 'Searches for all SSH public key data' do @pattern = SSH_PUBLIC_KEY end command.option :public_key, desc: 'Searches for all public key data' do @pattern = PUBLIC_KEY end end |
.define_file_system_options(command) ⇒ 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.
Defines File System pattern options.
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/ronin/cli/pattern_options.rb', line 252 def self.(command) command.option :file_name, desc: 'Searches for all file names' do @pattern = FILE_NAME end command.option :dir_name, desc: 'Searches for all directory names' do @pattern = DIR_NAME end command.option :relative_unix_path, desc: 'Searches for all relative UNIX paths' do @pattern = RELATIVE_UNIX_PATH end command.option :absolute_unix_path, desc: 'Searches for all absolute UNIX paths' do @pattern = ABSOLUTE_UNIX_PATH end command.option :unix_path, desc: 'Searches for all UNIX paths' do @pattern = UNIX_PATH end command.option :relative_windows_path, desc: 'Searches for all relative Windows paths' do @pattern = RELATIVE_WINDOWS_PATH end command.option :absolute_windows_path, desc: 'Searches for all absolute Windows paths' do @pattern = ABSOLUTE_WINDOWS_PATH end command.option :windows_path, desc: 'Searches for all Windows paths' do @pattern = WINDOWS_PATH end command.option :relative_path, desc: 'Searches for all relative paths' do @pattern = RELATIVE_PATH end command.option :absolute_path, desc: 'Searches for all absolute paths' do @pattern = ABSOLUTE_PATH end command.option :path, short: '-P', desc: 'Searches for all paths' do @pattern = PATH end end |
.define_language_options(command) ⇒ 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.
Defines language pattern options.
140 141 142 143 144 145 |
# File 'lib/ronin/cli/pattern_options.rb', line 140 def self.(command) command.option :word, short: '-w', desc: 'Searches for all words' do @pattern = WORD end end |
.define_network_options(command) ⇒ 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.
Defines network pattern options.
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 |
# File 'lib/ronin/cli/pattern_options.rb', line 153 def self.(command) command.option :mac_addr, desc: 'Searches for all MAC addresses' do @pattern = MAC_ADDR end command.option :ipv4_addr, short: '-4', desc: 'Searches for all IPv4 addresses' do @pattern = IPV4_ADDR end command.option :ipv6_addr, short: '-6', desc: 'Searches for all IPv6 addresses' do @pattern = IPV6_ADDR end command.option :ip, short: '-I', desc: 'Searches for all IP addresses' do @pattern = IP end command.option :host, short: '-H', desc: 'Searches for all host names' do @pattern = HOST_NAME end command.option :domain, short: '-D', desc: 'Searches for all domain names' do @pattern = DOMAIN end command.option :uri, desc: 'Searches for all URIs' do @pattern = URI end command.option :url, short: '-U', desc: 'Searches for all URLs' do @pattern = URL end end |
.define_numeric_options(command) ⇒ 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.
Defines numeric pattern options.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/ronin/cli/pattern_options.rb', line 117 def self.(command) command.option :number, short: '-N', desc: 'Searches for all numbers' do @pattern = NUMBER end command.option :hex_number, short: '-X', desc: 'Searches for all hexadecimal numbers' do @pattern = HEX_NUMBER end command.option :version_number, short: '-V', desc: 'Searches for all version numbers' do @pattern = VERSION_NUMBER end end |
.define_pii_options(command) ⇒ 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.
Defines PII pattern options.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/ronin/cli/pattern_options.rb', line 199 def self.(command) command.option :user_name, desc: 'Searches for all user names' do @pattern = USER_NAME end command.option :email_addr, short: '-E', desc: 'Searches for all email addresses' do @pattern = EMAIL_ADDRESS end command.option :obfuscated_email_addr, desc: 'Searches for all obfuscated email addresses' do @pattern = OBFUSCATED_EMAIL_ADDRESS end command.option :phone_number, desc: 'Searches for all phone numbers' do @pattern = PHONE_NUMBER end command.option :ssn, desc: 'Searches for all Social Security Numbers (SSNs)' do @pattern = SSN end command.option :amex_cc, desc: 'Searches for all AMEX Credit Card numbers' do @pattern = AMEX_CC end command.option :discover_cc, desc: 'Searches for all Discover Card numbers' do @pattern = DISCOVER_CC end command.option :mastercard_cc, desc: 'Searches for all MasterCard numbers' do @pattern = MASTERCARD_CC end command.option :visa_cc, desc: 'Searches for all VISA Credit Card numbers' do @pattern = VISA_CC end command.option :visa_mastercard_cc, desc: 'Searches for all VISA MasterCard numbers' do @pattern = VISA_MASTERCARD_CC end command.option :cc, desc: 'Searches for all Credit Card numbers' do @pattern = CC end end |
.define_source_code_options(command) ⇒ 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.
Defines source code pattern options.
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/ronin/cli/pattern_options.rb', line 305 def self.(command) command.option :identifier, desc: 'Searches for all identifier names' do @pattern = IDENTIFIER end command.option :variable_name, desc: 'Searches for all variable names' do @pattern = VARIABLE_NAME end command.option :variable_assignment, desc: 'Searches for all variable assignments' do @pattern = VARIABLE_ASSIGNMENT end command.option :function_name, desc: 'Searches for all function names' do @pattern = FUNCTION_NAME end command.option :single_quoted_string, desc: 'Searches for all single-quoted strings' do @pattern = SINGLE_QUOTED_STRING end command.option :double_quoted_string, desc: 'Searches for all double-quoted strings' do @pattern = DOUBLE_QUOTED_STRING end command.option :string, short: '-S', desc: 'Searches for all quoted strings' do @pattern = STRING end command.option :base64, short: '-B', desc: 'Searches for all Base64 strings' do @pattern = BASE64 end command.option :c_comment, desc: 'Searches for all C comments' do @pattern = C_COMMENT end command.option :cpp_comment, desc: 'Searches for all C++ comments' do @pattern = CPP_COMMENT end command.option :java_comment, desc: 'Searches for all Java comments' do @pattern = JAVA_COMMENT end command.option :javascript_comment, desc: 'Searches for all JavaScript comments' do @pattern = JAVASCRIPT_COMMENT end command.option :shell_comment, desc: 'Searches for all Shell comments' do @pattern = SHELL_COMMENT end command.option :ruby_comment, desc: 'Searches for all Ruby comments' do @pattern = RUBY_COMMENT end command.option :python_comment, desc: 'Searches for all Python comments' do @pattern = PYTHON_COMMENT end command.option :comment, desc: 'Searches for all comments' do @pattern = COMMENT end end |
.included(command) ⇒ 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.
Adds pattern options to the command.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/ronin/cli/pattern_options.rb', line 94 def self.included(command) (command) (command) (command) (command) (command) (command) (command) (command) command.option :regexp, short: '-e', value: {type: Regexp}, desc: 'Custom regular expression to search for' do |regexp| @pattern = regexp end end |