| 1 | package System; |
| 2 | |
| 3 | public class systemCheck { |
| 4 | public static String installCheck(String a){ |
| 5 | String result = "yum grouplist查看已安装组件,"; |
| 6 | if(a.contains("最小安装") || a.contains("Minimal Install")){ |
| 7 | result += "存在环境分组且具备最小安装"; |
| 8 | }else { |
| 9 | result += "存在环境分组且不具备最小安装,不符合安全要求"; |
| 10 | } |
| 11 | return result; |
| 12 | } |
| 13 | public static String portCheck(String a){ |
| 14 | String[] b = a.split("\n"); |
| 15 | String result = "netstat查看开放端口,"; |
| 16 | if(b.length == 0 ) { |
| 17 | result += "没有开放高危端口。"; |
| 18 | return result; |
| 19 | }else{ |
| 20 | result += "开放"; |
| 21 | } |
| 22 | for(String i : b){ |
| 23 | if(i.contains("22")){ |
| 24 | result += "22、"; |
| 25 | }else if(i.contains("135")){ |
| 26 | result += "135、"; |
| 27 | }else if(i.contains("137")){ |
| 28 | result += "137、"; |
| 29 | }else if(i.contains("138")){ |
| 30 | result += "138、"; |
| 31 | }else if(i.contains("139")){ |
| 32 | result += "139、"; |
| 33 | }else if(i.contains("445")){ |
| 34 | result += "445、"; |
| 35 | }else if(i.contains("3389")){ |
| 36 | result += "3389、"; |
| 37 | } |
| 38 | } |
| 39 | result += "共"+b.length+"个高危端口,不符合安全要求"; |
| 40 | |
| 41 | return result; |
| 42 | } |
| 43 | public static String killCheck(){ |
| 44 | String result = "未发现常用杀毒软件,不符合安全要求"; |
| 45 | return result; |
| 46 | } |
| 47 | |
| 48 | public static String budingCheck(String a){ |
| 49 | String[] b = a.split("\n"); |
| 50 | String d = b[3].replace("|","@").split("@")[2]; |
| 51 | String result = "yum history list查看补丁安装情况,最近补丁安装时间为"+d; |
| 52 | if(d.contains("2022")||d.contains("2023")||d.contains("2024")){ |
| 53 | return result; |
| 54 | } |
| 55 | return result+",不符合安全要求"; |
| 56 | } |
| 57 | |
| 58 | public static String otherCheck(){ |
| 59 | String result = "自行查看,默认不符合安全要求"; |
| 60 | return result; |
nothing calls this directly
no outgoing calls
no test coverage detected