Module: PWN::Plugins::BasicAuth
- Defined in:
- lib/pwn/plugins/basic_auth.rb
Overview
This plugin Base64 encodes/decodes AuthN credentials for passing to a ”Basic” authorization HTTP header.
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
-
0day Inc.
-
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::Plugins::BasicAuth.decode( base64_str: ‘required base64 encoded string’ ).
-
.encode(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::Plugins::BasicAuth.encode( username: ‘optional username’, password: ‘optional password’ ).
-
.help ⇒ Object
Display Usage for this Module.
Class Method Details
.authors ⇒ Object
- Author(s)
-
0day Inc. <[email protected]>
41 42 43 44 45 |
# File 'lib/pwn/plugins/basic_auth.rb', line 41 public_class_method def self. "AUTHOR(S): 0day Inc. <[email protected]> " end |
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::Plugins::BasicAuth.decode(
base64_str: 'required base64 encoded string'
)
31 32 33 34 35 36 37 |
# File 'lib/pwn/plugins/basic_auth.rb', line 31 public_class_method def self.decode(opts = {}) base64_str = opts[:base64_str] @base64_decoded_auth = Base64.decode64(base64_str) @base64_decoded_auth rescue StandardError => e raise e end |
.encode(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::Plugins::BasicAuth.encode(
username: 'optional username', password: 'optional password'
)
16 17 18 19 20 21 22 23 24 |
# File 'lib/pwn/plugins/basic_auth.rb', line 16 public_class_method def self.encode(opts = {}) basic_user = opts[:username].to_s.chomp unless opts[:username].nil? basic_pass = opts[:password].to_s.chomp unless opts[:password].nil? base64_str = "#{basic_user}:#{basic_pass}" @base64_encoded_auth = Base64.strict_encode64(base64_str).to_s.chomp @base64_encoded_auth rescue StandardError => e raise e end |
.help ⇒ Object
Display Usage for this Module
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/pwn/plugins/basic_auth.rb', line 49 public_class_method def self.help puts "USAGE: #{self}.encode( username: 'optional username', password: 'optional password' ) #{self}.decode(base64_str: 'base64 encoded string') #{self}.authors " end |