Class: PwnedPasswordsWish

Inherits:
Djinni::Wish
  • Object
show all
Defined in:
lib/rubeepass/wish/pwned_passwords.rb

Instance Method Summary collapse

Instance Method Details

#aliasesObject



5
6
7
# File 'lib/rubeepass/wish/pwned_passwords.rb', line 5

def aliases
    return ["check", "pwned"]
end

#descriptionObject



9
10
11
12
13
14
# File 'lib/rubeepass/wish/pwned_passwords.rb', line 9

def description
    return [
        "Check passwords against",
        "https://haveibeenpwned.com/passwords"
    ].join(" ")
end

#execute(args, djinni_env = Hash.new) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rubeepass/wish/pwned_passwords.rb', line 16

def execute(args, djinni_env = Hash.new)
    if (!args.empty?)
        usage
        return
    end

    pwned = djinni_env["keepass"].pwnedpasswords
    pwned.each do |entry|
        puts "#{entry.path.cyan} was pwned: #{entry.password.red}"
    end
    puts "No passwords are known to be pwned" if (pwned.empty?)
end

#usageObject



29
30
31
32
# File 'lib/rubeepass/wish/pwned_passwords.rb', line 29

def usage
    puts "#{aliases.join(", ")}"
    puts "    #{description}."
end