summaryrefslogtreecommitdiff
path: root/server/src
AgeCommit message (Collapse)Author
2023-09-29server: implement remote control connectionsDanny Holman
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>
2023-09-29server: remove input/output pump functionsDanny Holman
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>
2023-09-29server: write output to a file/socket descriptorDanny Holman
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>
2023-07-26server: fix run_exec printing garbage dataDanny Holman
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>
2023-07-26common: create the common directoryDanny Holman
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>
2023-07-25server: session: fix a session counting bugDanny Holman
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>
2023-07-25server: fix incorrect inequality in print_hostinfoDanny Holman
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>
2023-07-24server: add a proper timeout message to hostinfoDanny Holman
Add a proper timeout message to the print_hostinfo function. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-07-24server: fixed a timeout bug in session controlDanny Holman
Fixed a bug inside the session control logic that disallowed a timeout value. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-06-16server: session: fix memory violationDanny Holman
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>
2023-06-13server: add helper functions to the main fileDanny Holman
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>
2023-06-13server: util: fix a memory leak in str_splitDanny Holman
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>
2023-06-13server: session: make read and write functions uniformDanny Holman
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>
2023-06-13server: mark the worker socket as non-blockingDanny Holman
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>
2023-05-17server: create utility functionsDanny Holman
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>
2023-05-14server: session: add function returning sessionsDanny Holman
Add a function that returns the number of current sessions. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-05-14server: session: return number of bytes writtenDanny Holman
Return the number of bytes written to a session socket handle or -1 on error. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-02-15fixup! main: add a command line processorDanny Holman
2023-02-15session: simplify read_sessionDanny Holman
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>
2023-02-15session: add error checking to session creationDanny Holman
Add a check in init_session that returns -1 if malloc cannot create a new session. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-02-15main: add a command line processorDanny Holman
Add a function that processes incoming user commands. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-02-15server: display errors and warnings in shellDanny Holman
Print LOG_WARNING and LOG_SEVERE messages into stderr. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-01-04server: add a main header and source fileDanny Holman
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>
2023-01-04server: add functions for session managementDanny Holman
Add functions to initialize and control individual sessions. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-01-04server: add server control functionsDanny Holman
Add functions that initialize and control the server listening socket. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-01-04logging: add a close functionDanny Holman
Add a close function to close the file handle pointing at the log file. Signed-off-by: Danny Holman <dholman@gymli.org>
2022-11-18server: add a logging frameworkDanny Holman
Add a logging framework so the server can output to a single point. Signed-off-by: Danny Holman <dholman@gymli.org>