Yuri Slobodyanyuk Blog on Information Security 2024年09月12日
Bash script to generate random passwords
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

本文介绍了一个由 John Kristoff 启发的 Bash 脚本,用于生成随机密码,可设置密码长度和生成数量,还提供了下载链接及作者的社交媒体信息。

🎯该 Bash 脚本可生成包含可打印字符的随机密码。用户可通过命令行参数指定密码长度(默认为 9 个字符)和生成的密码数量(默认为 1 个)。脚本通过从 /dev/urandom 读取随机数据,并进行一系列处理来生成密码。

📄作者提供了脚本的下载链接,方便用户获取和使用。同时,还提到了通过特定命令行参数的示例来生成指定长度和数量的密码,如 #randompass.sh 7 7 。

🌐作者在文中提及了自己的社交媒体信息,如 LinkedIn 账号,以便读者关注其在 LinkedIn、Github、博客等平台上发布的更多内容。

Here I stumbled on an intro into Bash scripting for NetOps by John Kristoff " Introduction to Shell and Perl scripting for Network Operators" https://www.cymru.com/jtk/talks/nanog54-intro-scripting.pdf and could't help but do it my way. Here it is, bash script that generates random password of printable characters, up to 15 at least.

 1 2 3 4 5 6 7 8 91011121314
#!/bin/bash# usage: randompass.sh [n] [count]  - n is number of characters in password# to generate 9 by default, and count - number of passwords to generate, 1 by defaultn=${1:-9}counter=${2:-1}for ii in `seq 1 $counter` ;dodd count=1 bs=15  if=/dev/urandom 2>/dev/null |   od -a   | sed '2d'  | sed 's/0000000 \(.*\)/\1/' | tr -d ' '  | cut -c 1-$n | sed 's/\([a-z]\)/\U&/3' | sed 's/\([A-Z]\)/\l&/4'done

Download the script Example.

#randompass.sh 7 7

o&sOh;~KdeL(HMddc23DBgHK?S@iE_$SL*Adsi|}Del%I-ba<B

Follow me on https://www.linkedin.com/in/yurislobodyanyuk/ not to miss what I publish on Linkedin, Github, blog, and more.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Bash 脚本 随机密码 John Kristoff 社交媒体
相关文章