Module: PWN::Plugins::AuthenticationHelper

Defined in:
lib/pwn/plugins/authentication_helper.rb

Overview

This plugin is used to assist in masking a password when entered in via STDIN to prevent would-be shoulder surfers from obtaining password information. This plugin is useful when demonstrating the functionality of other SP plugins/modules.

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



59
60
61
62
63
# File 'lib/pwn/plugins/authentication_helper.rb', line 59

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.helpObject

Display Usage for this Module



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/pwn/plugins/authentication_helper.rb', line 67

public_class_method def self.help
  puts "USAGE:
    #{self}.username(
      prompt: 'optional - string to display at prompt'
    )

    #{self}.mask_password(
      prompt: 'optional - string to display at prompt'
    )

    #{self}.mfa(
      prompt: 'optional - string to display at prompt'
    )

    #{self}.authors
  "
end

.mask_password(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::AuthenticationHelper.mask_password(

prompt: 'optional - string to display at prompt (Default: Password)'

)



30
31
32
33
34
35
36
37
38
39
# File 'lib/pwn/plugins/authentication_helper.rb', line 30

public_class_method def self.mask_password(opts = {})
  prompt = opts[:prompt] ||= 'Password'

  pass = TTY::Prompt.new.mask("#{prompt}: ")
  pass.to_s.strip.chomp.scrub
rescue Interrupt
  puts "#{self}.#{__method__} => Goodbye."
rescue StandardError => e
  raise e
end

.mfa(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::AuthenticationHelper.mfa(

prompt: 'optional - string to display at prompt (Default: MFA Token)'

)



46
47
48
49
50
51
52
53
54
55
# File 'lib/pwn/plugins/authentication_helper.rb', line 46

public_class_method def self.mfa(opts = {})
  prompt = opts[:prompt] ||= 'MFA Token'

  mfa = TTY::Prompt.new.ask("#{prompt}: ")
  mfa.to_s.strip.chomp.scrub
rescue Interrupt
  puts "#{self}.#{__method__} => Goodbye."
rescue StandardError => e
  raise e
end

.usernameObject

Supported Method Parameters

PWN::Plugins::AuthenticationHelper.username(

prompt: 'optional - string to display at prompt (Default: Username)'

)



17
18
19
20
21
22
23
# File 'lib/pwn/plugins/authentication_helper.rb', line 17

public_class_method def self.username
  prompt = opts[:prompt] ||= 'Username'
  user = TTY::Prompt.new.ask("#{prompt}: ")
  user.to_s.strip.chomp.scrub
rescue StandardError => e
  raise e
end