两款不错的Linux密码生成工具

database

两款不错的Linux密码生成工具

先介绍最简单的方法,Linux自带的

$ strings /dev/urandom |tr -dc A-Za-z0-9 | head -c 20; echo

whucNWhr35W6ZP0MxrLQ

 

$ head -c 12  /dev/random | base64 | tr -d "

="

Z9Xx4neDb+P3jHkD


-c 参数调整密码长度


pwgen

项目地址:https://sourceforge.net/projects/pwgen/

安装

$ sudo apt-get install pwgen -y

使用

$ pwgen --help

Usage: pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]

 

使用案例:

$ pwgen

oNgequ6k aen7aeCi MahBual8 sa6uox7E hai8Xo9j Voo0Oi7o chae3OLa ooFohQu0

ughi0Aer Ing2Ekai thopie9C ahk5Aiyi Thee6eup aing6EiX diV8Loe0 iT6tae0k

ohYiequ7 eeD9aefu Eith8uow Oorai3Ai ojem0ahH ij6Yeoce ooGuchu2 ijoPh8oo

aiK8xomu EiTaes6a eituth9G fohZo9pa GuT6gao5 Kaivei3t eeP3iNge Teivah1H

AeCh9eil ieCh0eeC ua9buoSh epa2Hei3 unoW0koh tuiPhae0 uYaip4sh shuo5Ieb

sheRoo9e aiZee2sh aeF6hi8t eik8Chei Cei1oim8 OiRoo7ei ez2aiYee TeiM2thi

Ubie8hai Eeghie0a ieVo5Ook eGingah5 waeXoo6o aiGoh0nu aeTe9eiy zuumooT2

Caj0dee9 au0phuPh ot0Suv5O Quiid7uo Zohbeek8 ahF2ohlo Aedo6Ohl ieth0Ein

OXie4ieY vee6aeHu Ozouciu2 eez9ohSe xo3fu2Ae chi6Eelu quohY7ai ooRocha8

Aej3ieph iemouT9o thahFei6 CaRe8Haz Ahl4woh4 vae8ieCh wu2Ahh4u goXood5k

aiJae8Co ahT0aesh eit8geiL Ce0fephi He3Eila4 puhaMoo3 Aixais5m Aigho8ie

zaeWiqu5 uwee3Ahs tieDo2ph eeyahs5S Juz0AeNe Ighai7es xieQu7el hooNgai6

Wogh8Iey eeMeig2x xuinai7E heiTaiw4 Je9sho4i ooheLus0 ail4eiPh Shoh0azi

aiB0ooza Chie3evo pheeD1to Nei8yahv raB4opah Shoojoh0 ou7Oe9ei Gimoo1li

yo1Eexoo xoo5Euth aichoo6A Phoo3rej Te1joebo YaDu3ahX aiR8eequ leuw6Ahd

ufei8eeH aeseeTh5 achuv9Ai eethoh6E Ahso1loh ohViaW7U opook7Va Ga3faino

iDee0ic3 Ax4Vaina Theex6eo uu2soo2I bi4ovaVi Othech8b Aim4aego Xahb4aeC

shuth8Ae Ieghoh7j Hahmee8J BeaPah4o yoozaCh0 tho4Evio eengeeJ8 fiep4eiC

Xiephai9 Airu6pae ciB5Oi0t Ra3ahCai Ahqu0Val puTha8ka Paecos3f oBaePae4

Ahqu4jau EabaGhu0 zi6GeeTh ceeY2aiy Chin7shi Jeel3lie Ae2zaeti IePhu8ze

 

$ pwgen -1

Dejux2th

 

$ pwgen -ysBv 15

Xb7:b[Lthw-zmVx k%vrdn]R>T4#+PW <%!4~ }.MH!9&+ f?9|/MN3CJc_"[{ 4,rVVq?$gK@s@*_

4""_RsN4c;W_"k= $>MX,|T9TVWt"_s PW?;MHN+tzF7>g[ mb3+`tnx*/KrWPN zpqK$>)_-?CVk4`

N`4NH;f3q*"r+xz s|:~,>L"NP7m-jX FF"3"jTp9/R!H Ht<(b^X<93*^q/+ |!^c]P+mgN$4C=s

`^"HK3sm$F>;whb _XwWcFpW)4!xxpn 9#3VkCVXW&]*7P ;Lvc?L#mpM9xdL 3@hNm/@*`zW%Tf

Cmr+&"wH4#tr9,> @p.N)KCtT=@9{mX `Ph[#Jx|X:.3*#V F@/,tF":n7T_JsL /:r7Rr]*z#^@n.(

sJzppz%<-7C-C;T &c]3`Vd_7$g#:x xLKF};M4#%v-7Rg +*/[wpp]{nF9bVF @r9(~w"[WzfCTt)

WfpvV9g~&gm$`h~ >!#qsfF3zN;+.>" j3M{`H$zft<~Nwg 7RbL?zPwJ$Mbd>} F9`*ksWp77Cx#=

K[cPz3FnzgK}fv: ^f7M"|z>][Hp$=( hV}>V7.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-w1 |shuf|tr -d "

"

q3?bH;

 

解释:

fold -w1 将字符串拆分,一行一个字符

shuf 打乱字符串

tr -d "

" 将一个个字符拼起来,用 tr "

" "" 也行

 

xkcdpass 一个用Python编写的密码生成器

 

可以从这里下载: https://pypi.python.org/pypi/xkcdpass/


安装

$ sudo apt-get install xkcdpass -y

 

使用

$ xkcdpass --help

usage: xkcdpass [-h] [-w WORDFILE] [--min MIN_LENGTH] [--max MAX_LENGTH]

[-n NUM_WORDS] [-i] [-v VALID_CHARS] [-V] [-a ACROSTIC]

[-c COUNT] [-d DELIM] [--allow-weak-rng]

 

使用案例:

               
先简单运行下xkcdpass
 

$ xkcdpass

coastal palpable spiny delicacy removal mobster

将会随机给出你几个像上面这样的字典单词

 

 

$ xkcdpass -c 6

saffron sixth duller bargraph unpinned gaffe

dangle hurling croon elevation untitled justly

muster pastrami unruffled armful purging stack

exceeding january outline preorder petticoat stubborn

elective doorman giddily clapping valium handled

moonstone direction spoiling debit antiviral yodel

会生成6行随机字典单词
 

 

你可以用这些单词作为其他命令,比如 md5sum 的输入,来获取随机密码(就像下面这样)。
 

$ xkcdpass | md5sum

e0c54cdbbd25ad71664b38e8b391f219 -

 


默认情况下,xkcdpass使用的是EFF的“Long”字典表,但是你也可以使用自己的字典表。(自己生成字典表可以参考crunch--字典生成工具)
 

$ xkcdpass -w wordlist1.txt -w wordlist2.txt

 

两者结合脚本使用

将 pwgen 和 xkcdpass 结合起来用,生成 12 位密码的脚本
 

#!/bin/bash

p1=`xkcdpass | md5sum`

p2=`pwgen -ysBv 6 -1 | fold -w1 |shuf|tr -d "

"`

p3=`echo ${p1:0:6}${p2} | fold -w1 |shuf|tr -d "

"`

echo ${p3}

 

wpjamer

以上是 两款不错的Linux密码生成工具 的全部内容, 来源链接: utcz.com/z/534713.html

回到顶部