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]>



56
57
58
59
60
# File 'lib/pwn/plugins/authentication_helper.rb', line 56

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

.helpObject

Display Usage for this Module



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/pwn/plugins/authentication_helper.rb', line 64

public_class_method def self.help
  puts "USAGE:
    #{self}.username

    #{self}.mask_password

    #{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'

)



27
28
29
30
31
32
33
34
35
36
# File 'lib/pwn/plugins/authentication_helper.rb', line 27

public_class_method def self.mask_password(opts = {})
  opts[:prompt].nil? ? prompt = 'Password' : prompt = opts[:prompt].to_s.scrub.strip.chomp

  pass = TTY::Prompt.new.mask("#{prompt}: ")
  pass.to_s.strip.chomp.scrub
rescue Interrupt
  puts 'CTRL+C detected...goodbye.'
rescue StandardError => e
  raise e
end

.mfa(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::AuthenticationHelper.mfa(

prompt: 'optional - string to display at prompt'

)



43
44
45
46
47
48
49
50
51
52
# File 'lib/pwn/plugins/authentication_helper.rb', line 43

public_class_method def self.mfa(opts = {})
  opts[:prompt].nil? ? prompt = 'MFA Token' : prompt = opts[:prompt].to_s.scrub.strip.chomp

  mfa = TTY::Prompt.new.ask("#{prompt}: ")
  mfa.to_s.strip.chomp.scrub
rescue Interrupt
  puts 'CTRL+C detected...goodbye.'
rescue StandardError => e
  raise e
end

.usernameObject

Supported Method Parameters

PWN::Plugins::AuthenticationHelper.username



15
16
17
18
19
20
# File 'lib/pwn/plugins/authentication_helper.rb', line 15

public_class_method def self.username
  user = TTY::Prompt.new.ask('Username: ')
  user.to_s.strip.chomp.scrub
rescue StandardError => e
  raise e
end