Skip to content

Commit 782fe57

Browse files
authored
Merge pull request #18 from UzJu/main
fix: Compatible with the latest business edition
2 parents 9c34e5c + 125036c commit 782fe57

File tree

7 files changed

+59
-13
lines changed

7 files changed

+59
-13
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group 'cn.huoxian.dongtai.plugin'
7-
version '1.3.0'
7+
version '1.15.0.fix'
88

99
repositories {
1010
mavenCentral()

src/main/java/cn/huoxian/dongtai/plugin/dialog/RemoteConfigDialog.form

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</hspacer>
5050
</children>
5151
</grid>
52-
<grid id="e3588" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
52+
<grid id="e3588" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
5353
<margin top="0" left="0" bottom="0" right="0"/>
5454
<constraints>
5555
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -182,6 +182,23 @@
182182
<toolTipText value="非必填(非兼容Idea的使用)"/>
183183
</properties>
184184
</component>
185+
<component id="1f480" class="javax.swing.JLabel">
186+
<constraints>
187+
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
188+
</constraints>
189+
<properties>
190+
<text value="项目版本"/>
191+
<toolTipText value="非必填"/>
192+
</properties>
193+
</component>
194+
<component id="676d9" class="javax.swing.JTextField" binding="projectVersionTextArea">
195+
<constraints>
196+
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
197+
<preferred-size width="150" height="-1"/>
198+
</grid>
199+
</constraints>
200+
<properties/>
201+
</component>
185202
</children>
186203
</grid>
187204
</children>

src/main/java/cn/huoxian/dongtai/plugin/dialog/RemoteConfigDialog.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class RemoteConfigDialog extends JDialog {
2323
private JTextField serverTokenTextArea;
2424
private JTextField agentUrl;
2525
private JComboBox logLevelcomboBox;
26+
private JTextField projectVersionTextArea;
2627
private JTextField projectNameTextArea;
2728
public static boolean isNewToken = false;
2829
public static boolean isNewTokenToProject = false;
@@ -60,13 +61,19 @@ public RemoteConfigDialog() {
6061
if (logLevel != null &&!"".equals(logLevel)) {
6162
logLevelcomboBox.setSelectedItem(logLevel);
6263
}
64+
// UzzJu.com
65+
String projectVersion = properties.getProperty("PROJECTVERSION");
66+
if (logLevel != null &&!"".equals(projectVersion)) {
67+
logLevelcomboBox.setSelectedItem(projectVersion);
68+
}
6369
buttonOK.addActionListener(new ActionListener() {
6470
@Override
6571
public void actionPerformed(ActionEvent e) {
6672
String serverToken = serverTokenTextArea.getText();
6773
String openApitoken = openApiTokenTextArea.getText();
6874
String url = agentUrl.getText();
6975
String projectName = projectNameTextArea.getText();
76+
String projectVersion = projectVersionTextArea.getText();
7077
if (serverToken==null||serverToken.equals("")){
7178
TaintUtil.notificationWarning("serverToker不能为空,请重配置IAST云端!");
7279
new MsgTPDialog(remoteConfigDialog, "IAST云端提示", true, "Sorry! serverToker必须填写,请重配置IAST云端!!");
@@ -87,6 +94,7 @@ public void actionPerformed(ActionEvent e) {
8794
remoteConfig.put("TOKEN", serverToken);
8895
remoteConfig.put("OPENAPITOKEN", openApitoken);
8996
remoteConfig.put("PROJECTNAME", projectName);
97+
remoteConfig.put("PROJECTVERSION", projectVersion);
9098
String logLevel = String.valueOf(logLevelcomboBox.getSelectedItem());
9199
if (!logLevel.equals("请选择等级类型")){
92100
remoteConfig.put("LOGLEVEL", logLevel);

src/main/java/cn/huoxian/dongtai/plugin/dialog/TaintConfigDialogAdd.form

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<children>
7777
<component id="88a1f" class="javax.swing.JLabel" binding="ruleSetLabel">
7878
<constraints>
79-
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
79+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
8080
</constraints>
8181
<properties>
8282
<text value="规则集"/>

src/main/java/cn/huoxian/dongtai/plugin/runner/RunCodeRunner.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNul
5555
parametersList.add("-Ddongtai.server.token=" +ConfigUtil.getOpenApiToken() );
5656
parametersList.add("-Ddongtai.log.level="+ConfigUtil.getLoglevel());
5757
parametersList.add("-Ddongtai.server.url=" +ConfigUtil.getURL());
58+
parametersList.add("-Ddongtai.app.version=" +ConfigUtil.getProjectVersion());
5859
ConfigUtil.env=env;
59-
logger.info("IDEA"+ConfigUtil.getRunerIdeaVersion()+"Run With IAST 启动项目:" +ConfigUtil.projectName);
60-
TaintUtil.notificationWarning("IDEA:"+ConfigUtil.getRunerIdeaVersion()+"Run With IAST 启动项目:" +ConfigUtil.projectName);
60+
logger.info("IDEA"+ConfigUtil.getRunerIdeaVersion()+"Run With IAST 启动项目:" +ConfigUtil.projectName + "项目版本: " + ConfigUtil.projectVersion);
61+
TaintUtil.notificationWarning("IDEA:"+ConfigUtil.getRunerIdeaVersion()+"Run With IAST 启动项目:" +ConfigUtil.projectName + "项目版本: " + ConfigUtil.projectVersion);
6162
RunContentDescriptor runContentDescriptor=null;
6263
try {
6364
runContentDescriptor = super.doExecute(state, env);
@@ -81,9 +82,10 @@ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNul
8182
parametersList.add("-Ddongtai.server.token=" +ConfigUtil.getOpenApiToken() );
8283
parametersList.add("-Ddongtai.log.level="+ConfigUtil.getLoglevel());
8384
parametersList.add("-Ddongtai.server.url=" +ConfigUtil.getURL());
85+
parametersList.add("-Ddongtai.app.version=" +ConfigUtil.getProjectVersion());
8486
ConfigUtil.env=env;
85-
logger.info("IDEA"+ConfigUtil.getRunerIdeaVersion()+"Run With IAST 启动项目:" +ConfigUtil.projectName);
86-
TaintUtil.notificationWarning("IDEA:"+ConfigUtil.getRunerIdeaVersion()+"Run With IAST 启动项目:" +ConfigUtil.projectName);
87+
logger.info("IDEA"+ConfigUtil.getRunerIdeaVersion()+"Run With IAST 启动项目:" +ConfigUtil.projectName + "项目版本: " + ConfigUtil.projectVersion);
88+
TaintUtil.notificationWarning("IDEA:"+ConfigUtil.getRunerIdeaVersion()+"Run With IAST 启动项目:" +ConfigUtil.projectName + "项目版本: " + ConfigUtil.projectVersion);
8789
Promise promise =null;
8890
try {
8991
promise = super.doExecuteAsync(state, env);

src/main/java/cn/huoxian/dongtai/plugin/util/ConfigUtil.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public class ConfigUtil {
5656
}
5757
public static ExecutionEnvironment env;
5858
public static String projectName;
59+
60+
public static String projectVersion;
5961
public static String getOpenApiToken(){
6062
String token = VMProperties.get("dongtai.server.token");
6163
if (!("").equals(token)&&token!=null){
@@ -111,7 +113,22 @@ public static String getLoglevel(){
111113
}
112114
return level;
113115
}
114-
public static String getProjectName(ExecutionEnvironment env, JavaParameters parametersList){
116+
public static String getProjectVersion(){
117+
String r_version;
118+
String version = TaintUtil.config("PROJECTVERSION");
119+
logger.info("Get Project Version: " + version);
120+
if (!("").equals(version)&&version!=null){
121+
r_version = version;
122+
}
123+
else {
124+
r_version = VMProperties.get("project.version");
125+
}
126+
ConfigUtil.projectVersion = r_version;
127+
logger.info("Return Project Version" + r_version);
128+
System.out.println("Get Project Version: " + r_version);
129+
return r_version;
130+
}
131+
public static String getProjectName(ExecutionEnvironment env, JavaParameters parametersList){
115132
String projectName =env.getProject().getName();
116133
//todo 不兼容的版本
117134
if (!isNormal()){

src/main/java/cn/huoxian/dongtai/plugin/util/TaintConstant.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,18 @@ public interface TaintConstant {
7878

7979
DefaultTableModel TABLE_MODEL = new DefaultTableModel(null, COLUMN_NAME);
8080

81-
String TAINT_DETAIL = "/vuln/vulnDetail/1/";
81+
String TAINT_DETAIL = "/project/vulnDetail/1/";
8282

8383
String AGENT_PATH = TaintUtil.os();
8484

8585
String REQUEST_JSON_ERROR_STATUS = "202";
8686
String REQUEST_JSON_SUCCESS_STATUS = "201";
87-
String TOKEN="1f6b147d1790d2226e49ae6b822d83f2f911b55b";
87+
String TOKEN="";
8888
String LOGLEVEL="info";
89-
String OPENAPITOKEN="1f6b147d1790d2226e49ae6b822d83f2f911b55b";
90-
String DEFAULT_URL = "https://iast-test.huoxian.cn";
91-
String DEFAULT_AGENT_URL = "https://iast-test.huoxian.cn";
89+
90+
String PROJECTVERSION = "v1.0";
91+
String OPENAPITOKEN="";
92+
String DEFAULT_URL = "";
93+
String DEFAULT_AGENT_URL = "";
9294

9395
}

0 commit comments

Comments
 (0)