mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-18 15:14:10 +01:00
Land #30, ShellTest.java race condition fix
This commit is contained in:
commit
dfeb0d3fef
@ -15,6 +15,11 @@ public class ShellTest extends TestCase {
|
|||||||
DataInputStream in = new DataInputStream(new ByteArrayInputStream(commands.getBytes("ISO-8859-1")));
|
DataInputStream in = new DataInputStream(new ByteArrayInputStream(commands.getBytes("ISO-8859-1")));
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
shell.start(in, out, new String[] {"Payload", "--", "Shell"});
|
shell.start(in, out, new String[] {"Payload", "--", "Shell"});
|
||||||
|
int timeout = 5000;
|
||||||
|
while (out.size() == 0 && timeout > 0) {
|
||||||
|
Thread.sleep(100);
|
||||||
|
timeout -= 100;
|
||||||
|
}
|
||||||
String shellOutput = new String(out.toByteArray(), "ISO-8859-1");
|
String shellOutput = new String(out.toByteArray(), "ISO-8859-1");
|
||||||
Assert.assertTrue("MagicToken missing in shell output: "+shellOutput, shellOutput.contains("MagicToken"));
|
Assert.assertTrue("MagicToken missing in shell output: "+shellOutput, shellOutput.contains("MagicToken"));
|
||||||
Assert.assertEquals(-1, in.read());
|
Assert.assertEquals(-1, in.read());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user