add show count finded records
This commit is contained in:
parent
f7bb266cac
commit
b2ec5fdfe1
@ -9,6 +9,7 @@
|
||||
## 0.2.3 - [09/04/2022]
|
||||
- ♻️ - Password outdated date change to 3 month
|
||||
- ➕ - Added `pmng` logo
|
||||
- ➕ - Added show count finded records
|
||||
|
||||
## 0.2.2 - [08/04/2022]
|
||||
- ➕ - Added check permissions for password file
|
||||
|
23
src/pmng.cr
23
src/pmng.cr
@ -63,17 +63,11 @@ rescue ex
|
||||
puts ex.message, ""
|
||||
end
|
||||
|
||||
# password_file_path = PROGRAM_NAME.split("/")
|
||||
# password_file_path.pop
|
||||
# password_file_path.insert(-1, "pwd.yml")
|
||||
# password_file_path = password_file_path.join("/")
|
||||
|
||||
# TODO: Fix later
|
||||
password_file_path = "#{ENV["HOME"]}/.pwd.yml"
|
||||
PASSWORD_FILE_PATH = "#{ENV["HOME"]}/.pwd.yml"
|
||||
|
||||
# check password file exists
|
||||
if File.exists?(password_file_path)
|
||||
yaml = File.open(password_file_path) do |file|
|
||||
if File.exists?(PASSWORD_FILE_PATH)
|
||||
yaml = File.open(PASSWORD_FILE_PATH) do |file|
|
||||
YAML.parse(file)
|
||||
end
|
||||
else
|
||||
@ -91,7 +85,7 @@ while count < yaml.size
|
||||
end
|
||||
|
||||
# check file ppermissions
|
||||
password_file_permissions = File.info(password_file_path).permissions.to_s
|
||||
password_file_permissions = File.info(PASSWORD_FILE_PATH).permissions.to_s
|
||||
|
||||
if /\d{3}/.match(password_file_permissions).try &.[0] != "600"
|
||||
puts "Password file permissions is not RW for you.".colorize(:red)
|
||||
@ -158,6 +152,8 @@ while loop
|
||||
# list search password
|
||||
system "clear"
|
||||
|
||||
passwords_finded_array = 0
|
||||
|
||||
passwords_array.each do |item|
|
||||
if item.url.includes?(password_string.to_s)
|
||||
print "🌐 "
|
||||
@ -190,9 +186,16 @@ while loop
|
||||
end
|
||||
|
||||
puts "-----".colorize(:dark_gray).mode(:bold)
|
||||
|
||||
passwords_finded_array += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts
|
||||
print "Finded ".colorize(:yellow).mode(:bold)
|
||||
print passwords_finded_array.colorize(:red).mode(:bold)
|
||||
puts " records".colorize(:yellow).mode(:bold)
|
||||
puts "-----".colorize(:dark_gray).mode(:bold)
|
||||
puts
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user