summaryrefslogtreecommitdiffstats
path: root/tools/sploit (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-09-01Correct read() Semanticsdusoleil1-1/+1
The BufferedReader's .read() doesn't behave as expected. It reads EXACTLY size bytes and will block until there are enough available to read. os.read() does what we expect. It will read UP TO size bytes and only block if there is nothing available to read. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-09-01Throw a BrokenPipeError on Broken Readdusoleil1-0/+4
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-09-01Formattingdusoleil2-16/+16
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-09-01Handle Exceptions in Daemon Modedusoleil1-1/+12
If the user presses Ctrl+C while waiting on a connection, we want to gracefully exit. If the user presses Ctrl+C during the script, we want to stop executing the script and restart the loop. If any other exception happens during the script, we want to print out the stacktrace as normal, but continue the loop. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-09-01Allow Exit with Ctrl+C without a Stacktracedusoleil1-8/+11
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-09-01Move "Read Rest of Output" Out of Destructordusoleil2-4/+2
With the "read rest of output" code in the Comm destructor, it would continue to read output even in situations where some error happened and we expect sploit to die or when the user presses Ctrl+C to end sploit. By moving it to the end of the script running code in main, it behaves more intuitively. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-09-01Better Shutdown Process for Pipesdusoleil1-4/+7
Handle all of the edge cases when shutting down in Pipes mode. e.g. If the pipes are broken (tried to write after the program died) If the fifos don't exist anymore (sometimes tempfile cleans them up before the destructor finishes when certain errors happen) If the object attributes for the streams and fifo paths aren't set (this can happen if the constructor didn't finish. e.g. the user cancels while waiting on a connection) Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-09-01Better Shutdown Process for Target Programdusoleil1-1/+8
If we need to wait on the target program to die, we don't want to just wait forever with no indication to the user. Instead, only call wait if the program is still alive, inform the user that we are doing this, and give them the ability to forcefully kill the target program with Ctrl+C. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-09-01Better Info Messagesdusoleil2-2/+3
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-08-31Use Entire Path When Given The Pipe Directorydusoleil2-3/+4
Previously, you could specify a directory which must exist under /tmp. Now, you can give the full path to a directory to be used by Pipes. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-08-31Add Interactive Mode to Commsdusoleil1-1/+49
comm.interact() will drop the user into an "interactive" mode where they can directly control what is sent. A SIGINT (Ctrl+C) will drop the script out of interactive mode and continue executing the rest of the script. If the output of the program (input into our script) goes into a broken state (such as when the target program exits), interactive mode will automatically exit. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-08-31Add readuntil() and readlineuntil() to Commsdusoleil1-0/+14
Both new functions check the input for a predicate and keep reading until the predicate is true. readuntil() will consume input byte by byte and use the entire string read to check the predicate. It will then return that entire string. readlineuntil() consumes input line by line and only uses the last line to check the predicate. The line that satisfies the predicate is all that is returned. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-08-31Use With Statement for Temporary Directorydusoleil1-4/+4
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-08-30Sploit Rework MVP Structure, Packaging, and Commsdusoleil15-329/+133
First part of the MVP for the larger Sploit rework effort. Add project structure, python packaging, basic comms, and "log" hook. From in or out of the sploit directory, you can run the "sploit.py" script, run python -m sploit, or import the sploit modules from the python3 shell. You can also pip install Sploit and from anywhere you can run the sploit command, run python -m sploit, or import the sploit modules from the python3 shell. Running as a standalone application, Sploit can run in a "target" mode, a "pipe" mode, and a "pipe daemon" mode. In "target" mode, Sploit will launch a target program as a subprocess and run an exploit script against its I/O. In "pipe" mode, Sploit will create named fifos and wait for a program to connect to them to run an exploit script against them. In "pipe daemon" mode, Sploit will run similar to the "pipe" mode, but automatically recreate the fifos with the same name after each execution. Basic comm operations of read, readline, write, and writeline are available to the exploit script. A "log" hook is executed whenever data is read in from the target program. This will just print the data out, but it can be configured to decode it with a specific encoding or you could replace the function for different behavior. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
2021-08-03Adding Initial Commit of the Sploit Tooldusoleil8-0/+330
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>