Commit 4572162c by 钱炳权

测试通过

parent 41472db6
...@@ -43,7 +43,7 @@ public class TestServiceImpl implements TestService { ...@@ -43,7 +43,7 @@ public class TestServiceImpl implements TestService {
} }
log.info("The cmd is [{}]", aflnetCmd); log.info("The cmd is [{}]", aflnetCmd);
try { try {
cmdTools.runProgramCmd(aflnetCmd,pythonCmd); cmdTools.runProgramCmd(aflnetCmd,"");
} catch (JSchException e) { } catch (JSchException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (IOException e) { } catch (IOException e) {
...@@ -86,8 +86,11 @@ public class TestServiceImpl implements TestService { ...@@ -86,8 +86,11 @@ public class TestServiceImpl implements TestService {
} }
private String dnsCmd(AlgorithmOneCmdParams algorithmOneCmdParams) { 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 " 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())) { if (!"".equals(algorithmOneCmdParams.getTrainedModelInputPath())) {
before = before + " -z " + algorithmOneCmdParams.getTrainedModelInputPath(); before = before + " -z " + algorithmOneCmdParams.getTrainedModelInputPath();
} }
...@@ -110,8 +113,11 @@ public class TestServiceImpl implements TestService { ...@@ -110,8 +113,11 @@ public class TestServiceImpl implements TestService {
} }
private String sipCmd(AlgorithmOneCmdParams algorithmOneCmdParams) { 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 " 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())) if (!"".equals(algorithmOneCmdParams.getTrainedModelInputPath()))
before = before + " -z " + algorithmOneCmdParams.getTrainedModelInputPath(); before = before + " -z " + algorithmOneCmdParams.getTrainedModelInputPath();
before = before + " -N " + algorithmOneCmdParams.getNetinfo() + " -m none -t 3000+ " + " -P " + algorithmOneCmdParams.getProtopcol() + " -l 5061 " + " -D " before = before + " -N " + algorithmOneCmdParams.getNetinfo() + " -m none -t 3000+ " + " -P " + algorithmOneCmdParams.getProtopcol() + " -l 5061 " + " -D "
...@@ -132,8 +138,11 @@ public class TestServiceImpl implements TestService { ...@@ -132,8 +138,11 @@ public class TestServiceImpl implements TestService {
} }
private String ftpCmd(AlgorithmOneCmdParams algorithmOneCmdParams) { 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 " 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" +" -x /home/lddc/SHENYANLONG/SMGfuzz/tutorials/lightftp/ftp.dict"
+" -N "+algorithmOneCmdParams.getNetinfo()+" -P "+algorithmOneCmdParams.getProtopcol()+" -D " +" -N "+algorithmOneCmdParams.getNetinfo()+" -P "+algorithmOneCmdParams.getProtopcol()+" -D "
+algorithmOneCmdParams.getWaiting()+" -d "+" -q "+algorithmOneCmdParams.getStateSelectionAlgo()+" -s "+algorithmOneCmdParams.getSeedSelectionAlgo(); +algorithmOneCmdParams.getWaiting()+" -d "+" -q "+algorithmOneCmdParams.getStateSelectionAlgo()+" -s "+algorithmOneCmdParams.getSeedSelectionAlgo();
...@@ -152,8 +161,11 @@ public class TestServiceImpl implements TestService { ...@@ -152,8 +161,11 @@ public class TestServiceImpl implements TestService {
} }
private String rtspCmd(AlgorithmOneCmdParams algorithmOneCmdParams) { 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 " 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 " +" -N "+algorithmOneCmdParams.getNetinfo()+" -x /home/lddc/SHENYANLONG/SMGfuzz/tutorials/live555/rtsp.dict "+" -P "+algorithmOneCmdParams.getProtopcol()+" -m none "+" -D "
+algorithmOneCmdParams.getWaiting()+" -d -r 400"; +algorithmOneCmdParams.getWaiting()+" -d -r 400";
String after = " -q "+algorithmOneCmdParams.getStateSelectionAlgo()+" -s "+algorithmOneCmdParams.getSeedSelectionAlgo() String after = " -q "+algorithmOneCmdParams.getStateSelectionAlgo()+" -s "+algorithmOneCmdParams.getSeedSelectionAlgo()
......
...@@ -52,7 +52,7 @@ public class CmdTools { ...@@ -52,7 +52,7 @@ public class CmdTools {
LinuxCommandUtil linuxCommandUtil = new LinuxCommandUtil(); LinuxCommandUtil linuxCommandUtil = new LinuxCommandUtil();
linuxCommandUtil.connect(host, port, user, password); linuxCommandUtil.connect(host, port, user, password);
linuxCommandUtil.execCmd(aflnetCmd); linuxCommandUtil.execCmd(aflnetCmd);
linuxCommandUtil.execCmdWithoutResults(pythonCmd); // linuxCommandUtil.execCmdWithoutResults(pythonCmd);
} }
......
...@@ -106,18 +106,18 @@ public class LinuxCommandUtil { ...@@ -106,18 +106,18 @@ public class LinuxCommandUtil {
public void execCmdWithoutResults(String command) throws JSchException, IOException { public void execCmdWithoutResults(String command) throws JSchException, IOException {
InputStream in = channelExec.getInputStream(); InputStream in = channelExec.getInputStream();
InputStream error = channelExec.getErrStream(); InputStream error = channelExec.getErrStream();
new Thread(new Runnable() { // new Thread(new Runnable() {
@Override // @Override
public void run() { // public void run() {
trainOutPutStream(in); //// trainOutPutStream(in);
} // }
}).start(); // }).start();
new Thread(new Runnable() { // new Thread(new Runnable() {
@Override // @Override
public void run() { // public void run() {
errorStream(error); // errorStream(error);
} // }
}).start(); // }).start();
channelExec.setCommand(command); channelExec.setCommand(command);
channelExec.connect(); channelExec.connect();
} }
...@@ -126,7 +126,8 @@ public class LinuxCommandUtil { ...@@ -126,7 +126,8 @@ public class LinuxCommandUtil {
Reader reader = new InputStreamReader(in); Reader reader = new InputStreamReader(in);
BufferedReader bf = new BufferedReader(reader); BufferedReader bf = new BufferedReader(reader);
String line = null; String line = null;
List<String> list = null; List<String> list = new ArrayList<>();
;
try { try {
while ((line = bf.readLine()) != null && TestControlTools.getIsRunning()) { while ((line = bf.readLine()) != null && TestControlTools.getIsRunning()) {
System.out.println(line); System.out.println(line);
...@@ -135,8 +136,9 @@ public class LinuxCommandUtil { ...@@ -135,8 +136,9 @@ public class LinuxCommandUtil {
} }
if (list != null) if (list != null)
list.add(line + "\n"); list.add(line + "\n");
if (line.contains("cpu")) if (line.contains("cpu") || line.contains("%]") ) {
GlobalParameters.webSocket.appointSending("fuzzMaster", "web", list.toString()); GlobalParameters.webSocket.appointSending("fuzzMaster", "web", list.toString());
}
} }
//结束就关闭 //结束就关闭
if (!TestControlTools.getIsRunning()) { if (!TestControlTools.getIsRunning()) {
...@@ -147,23 +149,23 @@ public class LinuxCommandUtil { ...@@ -147,23 +149,23 @@ public class LinuxCommandUtil {
} }
} }
public void trainOutPutStream(InputStream in) { // public void trainOutPutStream(InputStream in) {
Reader reader = new InputStreamReader(in); // Reader reader = new InputStreamReader(in);
BufferedReader bf = new BufferedReader(reader); // BufferedReader bf = new BufferedReader(reader);
String line = null; // String line = null;
try { // try {
while ((line = bf.readLine()) != null && TestControlTools.getIsRunning()) { // while ((line = bf.readLine()) != null && TestControlTools.getIsRunning()) {
System.out.println(line); // System.out.println(line);
GlobalParameters.webSocket.appointSending("fuzzMaster", "webTrainResult", line); //// GlobalParameters.webSocket.appointSending("fuzzMaster", "webTrainResult", line);
} // }
//结束就关闭 // //结束就关闭
if (!TestControlTools.getIsRunning()) { // if (!TestControlTools.getIsRunning()) {
close(); // close();
} // }
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
public void errorStream(InputStream error) { public void errorStream(InputStream error) {
Reader reader = new InputStreamReader(error); Reader reader = new InputStreamReader(error);
......
...@@ -21,16 +21,16 @@ aflnet: ...@@ -21,16 +21,16 @@ aflnet:
web: web:
ip: 192.168.9.177 ip: 192.168.9.177
#aflnetssh:
# host: 192.168.31.53
# port: 22
# user: lddc
# password: sysulddc
aflnetssh: aflnetssh:
host: 172.17.4.151 host: 192.168.31.53
port: 22 port: 22
user: root user: lddc
password: 123456 password: sysulddc
#aflnetssh:
# host: 172.17.4.151
# port: 22
# user: root
# password: 123456
#aflnetssh: #aflnetssh:
# host: 192.168.31.133 # host: 192.168.31.133
# port: 22 # port: 22
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
var ws1 = null; var ws1 = null;
var ws2 = null; var ws2 = null;
function myFunction() { 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) { ws1.onmessage = function (evt) {
console.log(evt); console.log(evt);
console.log(evt.data) console.log(evt.data)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
var ws1 = null; var ws1 = null;
var ws2 = null; var ws2 = null;
function myFunction() { 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) { ws1.onmessage = function (evt) {
console.log(evt); console.log(evt);
console.log(evt.data) 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