(String a)
| 2 | |
| 3 | public class passCheck { |
| 4 | public static String passCheck(String a) { |
| 5 | String result = "查看/etc/pam.d/system-auth密码复杂度"; |
| 6 | String[] b = {"ucredit=","lcredit=","minlen=","dcredit=","retry=","ocredit="}; |
| 7 | String[] c = a.split("\\s+"); |
| 8 | int flag = 0; |
| 9 | for(String d : c){ |
| 10 | if(d.contains("=")){ |
| 11 | for(String e : b){ |
| 12 | if(d.contains(e)){ |
| 13 | result = result + checkpassword(d)[0]; |
| 14 | flag = flag + Integer.parseInt(checkpassword(d)[1]); |
| 15 | } |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | if(flag<3){ |
| 20 | result = result + "不符合安全要求"; |
| 21 | } |
| 22 | return result; |
| 23 | } |
| 24 | |
| 25 | public static String[] checkpassword(String flag){ |
| 26 | String[] res = new String[2]; |
no test coverage detected