Adjust test to moved and expanded stubs

This commit is contained in:
Chris Smowton
2022-08-15 11:06:06 +01:00
parent ca4ef6578d
commit 38c0557d90
3 changed files with 31 additions and 27 deletions

View File

@@ -17,17 +17,19 @@ public class JSchOSInjectionTest extends HttpServlet {
config.put("StrictHostKeyChecking", "no");
JSch jsch = new JSch();
Session session = jsch.getSession(user, host, 22);
session.setPassword(password);
session.setConfig(config);
session.connect();
try {
Session session = jsch.getSession(user, host, 22);
session.setPassword(password);
session.setConfig(config);
session.connect();
Channel channel = session.openChannel("exec");
((ChannelExec) channel).setCommand("ping " + command);
channel.setInputStream(null);
((ChannelExec) channel).setErrStream(System.err);
Channel channel = session.openChannel("exec");
((ChannelExec) channel).setCommand("ping " + command);
channel.setInputStream(null);
((ChannelExec) channel).setErrStream(System.err);
channel.connect();
channel.connect();
} catch (JSchException e) { }
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
@@ -41,16 +43,18 @@ public class JSchOSInjectionTest extends HttpServlet {
config.put("StrictHostKeyChecking", "no");
JSch jsch = new JSch();
Session session = jsch.getSession(user, host, 22);
session.setPassword(password);
session.setConfig(config);
session.connect();
try {
Session session = jsch.getSession(user, host, 22);
session.setPassword(password);
session.setConfig(config);
session.connect();
ChannelExec channel = (ChannelExec)session.openChannel("exec");
channel.setCommand("ping " + command);
channel.setInputStream(null);
channel.setErrStream(System.err);
ChannelExec channel = (ChannelExec)session.openChannel("exec");
channel.setCommand("ping " + command);
channel.setInputStream(null);
channel.setErrStream(System.err);
channel.connect();
channel.connect();
} catch (JSchException e) { }
}
}
}