Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
f2a4b2b1
Commit
f2a4b2b1
authored
Dec 14, 2020
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Plain Diff
fix(genpass): in `genpass-xkcd`, add warnings and make it compatible with macOS
Closes #9515 Closes #9516
parents
2a0ae331
2db42c6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
genpass.plugin.zsh
plugins/genpass/genpass.plugin.zsh
+13
-2
No files found.
plugins/genpass/genpass.plugin.zsh
View file @
f2a4b2b1
...
@@ -73,8 +73,19 @@ genpass-monkey() {
...
@@ -73,8 +73,19 @@ genpass-monkey() {
genpass-xkcd
()
{
genpass-xkcd
()
{
# Generates a 128-bit XKCD-style passphrase
# Generates a 128-bit XKCD-style passphrase
#
EG
, 9-mien-flood-Patti-buxom-dozes-ickier-pay-ailed-Foster
#
e.g
, 9-mien-flood-Patti-buxom-dozes-ickier-pay-ailed-Foster
# Can take a numerical argument for generating extra passwords
# Can take a numerical argument for generating extra passwords
if
((
!
$+
commands[shuf]
))
;
then
echo
>
&2
"
$0
:
\`
shuf
\`
command not found. Install coreutils (
\`
brew install coreutils
\`
on macOS)."
return
1
fi
if
[[
!
-e
/usr/share/dict/words
]]
;
then
echo
>
&2
"
$0
: no wordlist found in
\`
/usr/share/dict/words
\`
. Install one first."
return
1
fi
local
-i
i num
local
-i
i num
[[
$1
=
~
'^[0-9]+$'
]]
&&
num
=
$1
||
num
=
1
[[
$1
=
~
'^[0-9]+$'
]]
&&
num
=
$1
||
num
=
1
...
@@ -90,6 +101,6 @@ genpass-xkcd() {
...
@@ -90,6 +101,6 @@ genpass-xkcd() {
for
i
in
{
1..
$num
}
;
do
for
i
in
{
1..
$num
}
;
do
printf
"
$n
-"
printf
"
$n
-"
printf
"
$dict
"
|
shuf
-n
"
$n
"
|
paste
-sd
'-'
printf
"
$dict
"
|
shuf
-n
"
$n
"
|
paste
-sd
'-'
-
done
done
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment