Age | Commit message (Collapse) | Author |
|
The server should close the handle to the logging file on server exit.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
The logging API should write to both the specified file handle and
stderr. This allows the init system (if there is one in use) to also
write messages to its internal buffer.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Remove a line in server.c that set the client socket descriptor as
non-blocking. Since the server is multithreaded we do not need
non-blocking I/O.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Update version information across all build files.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add an additional newline after the exec function has returned. This
should eliminate garbage output printed at the server during
exfiltration of data.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Implement a series of functions that facilitate remote control
connections, i.e. connections that control session information, allow
exfiltration of data, etc. from the command server.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Remove the functions doing I/O on socket operations. These functions are
designed for single-threaded applications or for non-blocking sockets;
neither of which mini-rat has.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Instead of printing to stdout, print to a file or socket descriptor.
This will allow remote control connections to be implemented relatively
easily.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a document that lists the prescribed coding style to the doc
directory.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Finish implementing the core commands required by the C&C server.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add error checking to execve and add cleanup calls so that no memory is
leaked.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Refactor several functions in the reference client such that they make
more sense when reading.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fix a bug in which str_split would segfault when the string is
misformatted.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fix a bug in which run_exec would print garbage values into the socket
and to stdout.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Create a directory for files that are shared between the reference
client and server. Refactor the build scripts to reflect this
restructuring.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fix a bug in the num_sessions function in which the current active
session would not be counted.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fix a bug in which print_hostinfo would check for a positive return
value from read_session instead of a negative value.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a proper timeout message to the print_hostinfo function.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fixed a bug inside the session control logic that disallowed a timeout
value.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Update the name of the reference client in .gitignore.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fix a bug in which calling the 'stop' command on a session already
closed would crash the C&C server.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a reference client that will act as an example of what the client
program should accomplish given a command from the C&C server.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add several new header checks to the configure.ac file. These headers
are required for smooth operation of the C&C server.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add several helper functions to the main file of the C&C server that
perform actions requested by the user.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fix a memory access violation in str_split() that would cause the C&C
server to crash unexpectedly.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Make the functions that relay data to and from session sockets be
uniform in function and arguments.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Mark the socket in the worker function as non-blocking and run poll().
This should be done in order to prevent a slow loris attack on the C&C
server.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add stdarg.h and time.h to the check headers function in the configure
script.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Create a new file for utility functions, including those that strip
whitespace from and break apart strings.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Clarify what both a client and server system must have in order to run
mini-RAT.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a function that returns the number of current sessions.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Return the number of bytes written to a session socket handle or -1 on
error.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
|
|
Simplify the function read_session and provide some error checking. This
function should now return -1 if a valid session with the given ID
cannot be found.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a check in init_session that returns -1 if malloc cannot create a
new session.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a flag to struct session that indicates whether or not the
underlying socket is still open.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a function that processes incoming user commands.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Print LOG_WARNING and LOG_SEVERE messages into stderr.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a basic container_of macro to list.h. This is primarily for systems
in which container_of has no definition.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a main header and source file so that every required header is
checked against the config.h generated by autoconf.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add functions to initialize and control individual sessions.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a file to the server-side for commonly used macros.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a linked list implementation for generic use.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add functions that initialize and control the server listening socket.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a close function to close the file handle pointing at the log file.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a logging framework so the server can output to a single point.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Signed-off-by: Danny Holman <dholman@gymli.org>
|