Commit 4572162c by 钱炳权

测试通过

parent 41472db6
......@@ -43,7 +43,7 @@ public class TestServiceImpl implements TestService {
}
log.info("The cmd is [{}]", aflnetCmd);
try {
cmdTools.runProgramCmd(aflnetCmd,pythonCmd);
cmdTools.runProgramCmd(aflnetCmd,"");
} catch (JSchException e) {
throw new RuntimeException(e);
} catch (IOException e) {
......@@ -86,8 +86,11 @@ public class TestServiceImpl implements TestService {
}
private String dnsCmd(AlgorithmOneCmdParams algorithmOneCmdParams) {
Date date = new Date();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss-");
String outputFileName = df.format(date)+algorithmOneCmdParams.getProtopcol()+"-output";
String before = AlgorithmOneCmd.ALFNET_PATH + " -d " + AlgorithmOneCmd.ALFNET_INPUT_PATH + "/dnsmasq/in-dns "
+ AlgorithmOneCmd.ALFNET_OUTPUT_PATH + "/dnsmasq/src/output_dnsmasq_RLGfuzz";
+ AlgorithmOneCmd.ALFNET_OUTPUT_PATH + "/dnsmasq/src/"+outputFileName;
if (!"".equals(algorithmOneCmdParams.getTrainedModelInputPath())) {
before = before + " -z " + algorithmOneCmdParams.getTrainedModelInputPath();
}
......@@ -110,8 +113,11 @@ public class TestServiceImpl implements TestService {
}
private String sipCmd(AlgorithmOneCmdParams algorithmOneCmdParams) {
Date date = new Date();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss-");
String outputFileName = df.format(date) + algorithmOneCmdParams.getProtopcol() + "-output";
String before = AlgorithmOneCmd.ALFNET_PATH + AlgorithmOneCmd.ALFNET_INPUT_PATH + "/kamailio/in-sip "
+ AlgorithmOneCmd.ALFNET_OUTPUT_PATH + "/kamailio/output_kamailio_RLGfuzz";
+ AlgorithmOneCmd.ALFNET_OUTPUT_PATH + "/kamailio/"+outputFileName;
if (!"".equals(algorithmOneCmdParams.getTrainedModelInputPath()))
before = before + " -z " + algorithmOneCmdParams.getTrainedModelInputPath();
before = before + " -N " + algorithmOneCmdParams.getNetinfo() + " -m none -t 3000+ " + " -P " + algorithmOneCmdParams.getProtopcol() + " -l 5061 " + " -D "
......@@ -132,8 +138,11 @@ public class TestServiceImpl implements TestService {
}
private String ftpCmd(AlgorithmOneCmdParams algorithmOneCmdParams) {
Date date = new Date();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss-");
String outputFileName = df.format(date) + algorithmOneCmdParams.getProtopcol() + "-output";
String before = AlgorithmOneCmd.ALFNET_PATH +" -m none "+ AlgorithmOneCmd.ALFNET_INPUT_PATH + "/SMGfuzz/tutorials/lightftp/in-ftp "
+AlgorithmOneCmd.ALFNET_OUTPUT_PATH+"/LightFTP/Source/Release/output_lightftp_RLGfuzz"+" -z "+algorithmOneCmdParams.getTrainedModelInputPath()
+AlgorithmOneCmd.ALFNET_OUTPUT_PATH+"/LightFTP/Source/Release/"+outputFileName+" -z "+algorithmOneCmdParams.getTrainedModelInputPath()
+" -x /home/lddc/SHENYANLONG/SMGfuzz/tutorials/lightftp/ftp.dict"
+" -N "+algorithmOneCmdParams.getNetinfo()+" -P "+algorithmOneCmdParams.getProtopcol()+" -D "
+algorithmOneCmdParams.getWaiting()+" -d "+" -q "+algorithmOneCmdParams.getStateSelectionAlgo()+" -s "+algorithmOneCmdParams.getSeedSelectionAlgo();
......@@ -152,8 +161,11 @@ public class TestServiceImpl implements TestService {
}
private String rtspCmd(AlgorithmOneCmdParams algorithmOneCmdParams) {
Date date = new Date();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss-");
String outputFileName = df.format(date) + algorithmOneCmdParams.getProtopcol() + "-output";
String before = AlgorithmOneCmd.ALFNET_PATH + AlgorithmOneCmd.ALFNET_INPUT_PATH + "/SMGfuzz/tutorials/live555/in-rtsp "
+AlgorithmOneCmd.ALFNET_OUTPUT_PATH+"/live555/testProgs/output_live555_RLGfuzz"+" -z "+algorithmOneCmdParams.getTrainedModelInputPath()
+AlgorithmOneCmd.ALFNET_OUTPUT_PATH+"/live555/testProgs/"+outputFileName+" -z "+algorithmOneCmdParams.getTrainedModelInputPath()
+" -N "+algorithmOneCmdParams.getNetinfo()+" -x /home/lddc/SHENYANLONG/SMGfuzz/tutorials/live555/rtsp.dict "+" -P "+algorithmOneCmdParams.getProtopcol()+" -m none "+" -D "
+algorithmOneCmdParams.getWaiting()+" -d -r 400";
String after = " -q "+algorithmOneCmdParams.getStateSelectionAlgo()+" -s "+algorithmOneCmdParams.getSeedSelectionAlgo()
......
......@@ -52,7 +52,7 @@ public class CmdTools {
LinuxCommandUtil linuxCommandUtil = new LinuxCommandUtil();
linuxCommandUtil.connect(host, port, user, password);
linuxCommandUtil.execCmd(aflnetCmd);
linuxCommandUtil.execCmdWithoutResults(pythonCmd);
// linuxCommandUtil.execCmdWithoutResults(pythonCmd);
}
......
......@@ -106,18 +106,18 @@ public class LinuxCommandUtil {
public void execCmdWithoutResults(String command) throws JSchException, IOException {
InputStream in = channelExec.getInputStream();
InputStream error = channelExec.getErrStream();
new Thread(new Runnable() {
@Override
public void run() {
trainOutPutStream(in);
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
errorStream(error);
}
}).start();
// new Thread(new Runnable() {
// @Override
// public void run() {
//// trainOutPutStream(in);
// }
// }).start();
// new Thread(new Runnable() {
// @Override
// public void run() {
// errorStream(error);
// }
// }).start();
channelExec.setCommand(command);
channelExec.connect();
}
......@@ -126,7 +126,8 @@ public class LinuxCommandUtil {
Reader reader = new InputStreamReader(in);
BufferedReader bf = new BufferedReader(reader);
String line = null;
List<String> list = null;
List<String> list = new ArrayList<>();
;
try {
while ((line = bf.readLine()) != null && TestControlTools.getIsRunning()) {
System.out.println(line);
......@@ -135,8 +136,9 @@ public class LinuxCommandUtil {
}
if (list != null)
list.add(line + "\n");
if (line.contains("cpu"))
if (line.contains("cpu") || line.contains("%]") ) {
GlobalParameters.webSocket.appointSending("fuzzMaster", "web", list.toString());
}
}
//结束就关闭
if (!TestControlTools.getIsRunning()) {
......@@ -147,23 +149,23 @@ public class LinuxCommandUtil {
}
}
public void trainOutPutStream(InputStream in) {
Reader reader = new InputStreamReader(in);
BufferedReader bf = new BufferedReader(reader);
String line = null;
try {
while ((line = bf.readLine()) != null && TestControlTools.getIsRunning()) {
System.out.println(line);
GlobalParameters.webSocket.appointSending("fuzzMaster", "webTrainResult", line);
}
//结束就关闭
if (!TestControlTools.getIsRunning()) {
close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
// public void trainOutPutStream(InputStream in) {
// Reader reader = new InputStreamReader(in);
// BufferedReader bf = new BufferedReader(reader);
// String line = null;
// try {
// while ((line = bf.readLine()) != null && TestControlTools.getIsRunning()) {
// System.out.println(line);
//// GlobalParameters.webSocket.appointSending("fuzzMaster", "webTrainResult", line);
// }
// //结束就关闭
// if (!TestControlTools.getIsRunning()) {
// close();
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
public void errorStream(InputStream error) {
Reader reader = new InputStreamReader(error);
......
......@@ -21,16 +21,16 @@ aflnet:
web:
ip: 192.168.9.177
#aflnetssh:
# host: 192.168.31.53
# port: 22
# user: lddc
# password: sysulddc
aflnetssh:
host: 172.17.4.151
host: 192.168.31.53
port: 22
user: root
password: 123456
user: lddc
password: sysulddc
#aflnetssh:
# host: 172.17.4.151
# port: 22
# user: root
# password: 123456
#aflnetssh:
# host: 192.168.31.133
# port: 22
......
......@@ -8,7 +8,7 @@
var ws1 = null;
var ws2 = null;
function myFunction() {
ws1 = new WebSocket("ws://192.168.31.133:8100/websocket/testResult/web");
ws1 = new WebSocket("ws://192.168.31.134:8100/websocket/testResult/web");
ws1.onmessage = function (evt) {
console.log(evt);
console.log(evt.data)
......
......@@ -8,7 +8,7 @@
var ws1 = null;
var ws2 = null;
function myFunction() {
ws1 = new WebSocket("ws://192.168.31.133:8100/websocket/testResult/webTrainResult");
ws1 = new WebSocket("ws://192.168.31.134:8100/websocket/testResult/web");
ws1.onmessage = function (evt) {
console.log(evt);
console.log(evt.data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment