grep实战:查找所有type=password的input的name

#找出当前目录及子目录下所有jsp文件,并过滤出type=password的表单记录,将结果输出到文件1.out
find . -name "*.jsp" | xargs grep -E "(type=\"password\"|type=password|type='password')" > 1.out
#对结果进行匹配,找出所有name,并排序去重复
cat 1.out | grep -P -o 'name=".+?"' | sort | uniq 

grep 的-P参数是正则表达式,并使用非贪婪模式,-E是正则表达式,贪婪模式

结果很完美

name="bankCardPassword"
name="bankPassword"
name="cfmPassword"
name="confirmPassword"
name="confirmpwd"
name="entity.password"
name="newpwd"
name="newPwd"
name="newpwd1"
name="obj.old"
name="obj.password"
name="obj.phonePWD"
name="oldpass"
name="oldPassword"
name="oldpwd"
name="oldPwd"
name="password"
name="passWord"
name="password1"
name="password2"
name="password3"
name="passwords"
name="phonePWD1"
name="pwd"
name="pwd1"
name="rnewpwd"
name="specialforAudit.password1"
name="tpassword"
name="truePassword"
name="upassword"

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注