首先說下需求:
1、長度不少於8個字元
2、口令應該為以下4類字元的組合:大寫字母(a-z)、小寫字母(a-z)、數字(0-9)和特殊字元。
每類字元至少包含乙個,如果某類字元只包含乙個,那麼該字元不應該為首字元或尾字元。
3、不為重複某些字元的組合(如a1a#a1a#)。
4、不包含本人姓名、出生日期、登入名、email等與本人相關的資訊
5、不為歷史口令
然後就是實現啦,直接貼**
public ******resultvo checkuserpwd(string password) ]+.*$";
for (int i = 0; i < password.length(); i++) else if (ch >= 'a' && ch <= 'z') else if (ch >= 'a' && ch <= 'z') else if (ch1.matches(regex)) else
}// system.out.println("number=" + number);
// system.out.println("lowercase=" + lowercase);
// system.out.println("uppercase=" + uppercase);
// system.out.println("specialcase=" + specialcase);
// 獲取口令的首尾字元
char index = password.charat(0);
char end = password.charat(password.length() - 1);
string index1 = string.valueof(index);
string end1 = string.valueof(end);
// 口令不少於8位
if (password.matches("^.$")) else if (end >= '0' && end <= '9' && number == 1) else if (index >= 'a' && index <= 'z' && lowercase == 1) else if (end >= 'a' && end <= 'z' && lowercase == 1) else if (index >= 'a' && index <= 'z' && uppercase == 1) else if (end >= 'a' && end <= 'z' && uppercase == 1) else if (index1.matches(regex) && specialcase == 1) else if (end1.matches(regex) && specialcase == 1)
// 不為重複某些字元的組合(如a1a#a1a#) 2代表某連續兩個字元重複(abab)
if (!password.matches("^.*(.)(.*)\\1+.*$")) else else
} else
}} else
} else
} else
logger.info("口令驗證結果:" + ******resultvo.tostring());
return ******resultvo;
}
弱口令總結(什麼是弱口令)
空口令 口令長度小於8 口令不應該為連續的某個字元 qqqqqq 賬號密碼相同 例 root root 口令與賬號相反 例 root toor 口令純數字 例 112312324234,號 口令純字母 例 asdjfhask 口令已數字代替字母 例 hello word,hell0 w0rd 口令採...
PowerShell批量檢查域密碼弱口令
需求 標題就是需求,想用密碼庫批量檢測一下域內的弱密碼。解決 powershell來實現,不需要第三方工具,不怕被人偷了密碼。本指令碼需要3個檔案,空的即可,位於d pwd下 1 name.csv,儲存需要測試的使用者名稱列表 2 pwd.csv,儲存需要測試的密碼列表 3 name2.csv,儲存...
弱口令和萬能密碼
一 弱口令 1 弱口令介紹 一般弱口令為系統預設密碼或設定的簡單密碼,這些密碼非常容易被攻擊者猜到。在實際的滲透測試中,弱口令是乙個攻擊難度低,攻擊成功率偏高的漏洞。2 弱口令一般出現在什麼地方呢?對於web層面就是後台管理員登入 普通使用者登入等 對於中介軟體層面就是mysql弱口令 mssql弱...