Compare commits
2 Commits
bc7ebefe61
...
b2ec5fdfe1
Author | SHA1 | Date |
---|---|---|
Alexander Popov | b2ec5fdfe1 | |
Alexander Popov | f7bb266cac |
|
@ -8,6 +8,8 @@
|
|||
|
||||
## 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
|
||||
|
|
12
README.md
12
README.md
|
@ -1,2 +1,10 @@
|
|||
# pmng
|
||||
The very simple password manager for humans
|
||||
# The very simple password manager for humans
|
||||
|
||||
```
|
||||
██████╗ ███╗ ███╗███╗ ██╗ ██████╗
|
||||
██╔══██╗████╗ ████║████╗ ██║██╔════╝
|
||||
██████╔╝██╔████╔██║██╔██╗ ██║██║ ███╗
|
||||
██╔═══╝ ██║╚██╔╝██║██║╚██╗██║██║ ██║
|
||||
██║ ██║ ╚═╝ ██║██║ ╚████║╚██████╔╝
|
||||
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
|
||||
```
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: pmng
|
||||
version: 0.2.2
|
||||
version: 0.2.3
|
||||
|
||||
authors:
|
||||
- Alexander Popov <iiiypuk@iiiypuk.me>
|
||||
|
|
36
src/pmng.cr
36
src/pmng.cr
|
@ -22,7 +22,16 @@ class Password
|
|||
property update : Int32
|
||||
end
|
||||
|
||||
VERSION = "0.2.2"
|
||||
VERSION = "0.2.3b"
|
||||
|
||||
ASCII_LOGO = "
|
||||
██████╗ ███╗ ███╗███╗ ██╗ ██████╗
|
||||
██╔══██╗████╗ ████║████╗ ██║██╔════╝
|
||||
██████╔╝██╔████╔██║██╔██╗ ██║██║ ███╗
|
||||
██╔═══╝ ██║╚██╔╝██║██║╚██╗██║██║ ██║
|
||||
██║ ██║ ╚═╝ ██║██║ ╚████║╚██████╔╝
|
||||
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
|
||||
"
|
||||
|
||||
# program options
|
||||
begin
|
||||
|
@ -30,6 +39,7 @@ begin
|
|||
parser.banner = "The very simple password manager for humans\n"
|
||||
|
||||
parser.on "-v", "--version", "Show version" do
|
||||
puts ASCII_LOGO
|
||||
puts "The very simple password manager for humans."
|
||||
puts "Version #{VERSION}"
|
||||
exit(0)
|
||||
|
@ -53,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
|
||||
|
@ -81,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)
|
||||
|
@ -91,6 +95,7 @@ end
|
|||
|
||||
# pmng title
|
||||
system "clear"
|
||||
puts ASCII_LOGO.colorize(:yellow)
|
||||
puts "The very simple password manager for humans".colorize(:yellow).mode(:bold)
|
||||
puts "-------------------------------------------".colorize(:yellow).mode(:bold)
|
||||
|
||||
|
@ -147,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 "🌐 "
|
||||
|
@ -179,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