11package com .drops .poc ;
22
3+ import com .drops .entity .ControllersFactory ;
4+ import com .drops .ui .MainController ;
35import com .drops .utils .HTTPUtils ;
46import com .drops .utils .ReUtil ;
7+ import com .drops .utils .Utils ;
58
69/**
710 * @ClassName: SnakeYAMLRCE
1316 **/
1417public class SnakeYAMLRCEPOC {
1518
19+ public final MainController mainController ;
20+
21+ public SnakeYAMLRCEPOC () {
22+ this .mainController = (MainController ) ControllersFactory .controllers .get (MainController .class .getSimpleName ());
23+
24+ }
1625
1726 /**
1827 * @Description: 判断是否存在依赖spring-boot-starter-actuator
@@ -21,27 +30,27 @@ public class SnakeYAMLRCEPOC {
2130 *
2231 * @return:
2332 */
24- public static boolean hasSnakeYAMLRCE (String target ){
33+ public boolean hasSnakeYAMLRCE (String target ){
2534 String regex = "spring-cloud-starter-([A-Za-z0-9.-]+).jar" ;
2635 String context = HTTPUtils .getRequest (target ).body ();
2736 String version = "spring-cloud-starter-1.3.0" ;
28- System . out . println ( "正在验证是否存在依赖spring-boot-starter-actuator以及 spring-cloud-starter 版本 < 1.3.0!" );
37+ this . mainController . logTextArea . appendText ( Utils . log ( "正在验证是否存在依赖spring-boot-starter-actuator以及 spring-cloud-starter 版本 < 1.3.0!" ) );
2938 if (context .contains ("spring-boot-starter-actuator" )){
30- System . out . println ( "存在依赖:spring-boot-starter-actuator" );
39+ this . mainController . logTextArea . appendText ( Utils . log ( "存在依赖:spring-boot-starter-actuator" ) );
3140 String result = ReUtil .hasVersion (context ,regex );
3241 if (result != null ){
3342 if (result .compareToIgnoreCase (version ) >= 0 ){
34- System . out . println ( "依赖版本不符合,版本为:" + result );
43+ this . mainController . logTextArea . appendText ( Utils . log ( "依赖版本不符合,版本为:" + result ) );
3544 }else {
36- System . out . println ( "依赖版本:" + result );
45+ this . mainController . logTextArea . appendText ( Utils . log ( "依赖版本:" + result ) );
3746 return true ;
3847 }
3948 }else {
40- System . out . println ( "spring-cloud-starte 依赖不存在!" );
49+ this . mainController . logTextArea . appendText ( Utils . log ( "spring-cloud-starte 依赖不存在!" ) );
4150 }
4251
4352 }else {
44- System . out . println ( "spring-boot-starter-actuator 依赖不存在!" );
53+ this . mainController . logTextArea . appendText ( Utils . log ( "spring-boot-starter-actuator 依赖不存在!" ) );
4554 return false ;
4655 }
4756 return false ;
0 commit comments