MCPcopy Create free account
hub / github.com/R4gd0ll/LazyAnFuZai / passCheck

Class passCheck

src/main/java/System/passCheck.java:3–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1package System;
2
3public 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];
27 String result = "";
28 int f = 0;
29 String i = flag.substring(flag.length()-1);
30 if(flag.contains("ucredit=")){
31 if(!i.contains("=")){
32 f = f+1;
33 result = result + "至少"+i+"个大写字母,";
34 }else{
35 result = result + "大写字母数量不符合要求,";
36 }
37 }else{
38 result = result + "大写字母数量不符合要求,";
39 }
40
41 if(flag.contains("lcredit=")){
42 if(!i.contains("=")){
43 f = f+1;
44 result = result + "至少"+i+"个小写字母,";
45 }else{
46 result = result + "小写字母数量不符合要求,";
47 }
48 }else{
49 result = result + "小写字母数量不符合要求,";
50 }
51
52 if(flag.contains("dcredit=")){
53 if(!i.contains("=")){
54 f = f+1;
55 result = result + "至少"+i+"个数字,";
56 }else{
57 result = result + "数字数量不符合要求,";
58 }
59 }else{
60 result = result + "数字数量不符合要求,";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected