Skip to content

Commit

Permalink
Parser
Browse files Browse the repository at this point in the history
  • Loading branch information
SummerSec committed Mar 1, 2022
1 parent 72459ee commit b8dd9f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/sumsec/core/ast/util/DotHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String[] RunCmd(String[] dotPath){
cmd = new String[]{"cmd.exe", "/c", "dot", "-Tpng", dotPath[i], "-o", imgPath};
} else {
//linux下的命令
cmd = new String[]{"/bin/sh", "-c", "dot", "-Tpng" + dotPath[i] + "-o", imgPath};
cmd = new String[]{"/bin/sh", "-c", "dot", "-Tpng" , dotPath[i] , "-o", imgPath};
}
try {

Expand All @@ -50,7 +50,8 @@ public String[] RunCmd(String[] dotPath){
sleep(1000);
String charsetName = isWindowsOS ? "GBK" : "UTF-8";
byte[] bytes = new Scanner(Runtime.getRuntime().exec(cmd).getInputStream(), charsetName).useDelimiter("\\A").next().getBytes(charsetName);
if (bytes.length > 17) {
File file = new File(imgPath);
if (!file.exists()) {
logger.info("bytes.length = " + bytes.length);
logger.info("something wrong");
Alert alert = new Alert(Alert.AlertType.WARNING);
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/sumsec/core/cfg/uitls/OSUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
Expand Down Expand Up @@ -47,7 +48,7 @@ public String[] RunCmd(String[] dotPath){
cmd = new String[]{"cmd.exe", "/c", "dot", "-Tpng", dotPath[i], "-o", imgPath};
} else {
//linux下的命令
cmd = new String[]{"/bin/sh", "-c", "dot", "-Tpng" + dotPath[i] + "-o", imgPath};
cmd = new String[]{"/bin/sh", "-c", "dot", "-Tpng" , dotPath[i] ,"-o", imgPath};
}
try {

Expand All @@ -56,7 +57,8 @@ public String[] RunCmd(String[] dotPath){
sleep(1000);
String charsetName = isWindowsOS ? "GBK" : "UTF-8";
byte[] bytes = new Scanner(Runtime.getRuntime().exec(cmd).getInputStream(), charsetName).useDelimiter("\\A").next().getBytes(charsetName);
if ( bytes.length > 17) {
File file = new File(imgPath);
if (!file.exists()) {
logger.info("bytes.length = " + bytes.length);
logger.info("something wrong");
Alert alert = new Alert(Alert.AlertType.WARNING);
Expand Down

0 comments on commit b8dd9f5

Please sign in to comment.