-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewritten, more OOP-ish approach using C++17 features here and there
- Loading branch information
ang1337
committed
Feb 3, 2021
1 parent
9ce3448
commit 95e0ce0
Showing
31 changed files
with
1,278 additions
and
822 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
#include <string> | ||
#include <cstdint> | ||
|
||
namespace remramd { | ||
class Client { | ||
private: | ||
void run_netcat_tcp_listener(const std::uint16_t reverse_shell_port); | ||
public: | ||
void connect(const std::string &server_ip, const std::uint16_t server_port); | ||
Client(const Client&) = delete; | ||
Client& operator = (const Client&) = delete; | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "../inc/Client.hpp" | ||
#include "../../shared/inc/Protocol.hpp" | ||
#include "../../shared/inc/remramd_exception.hpp" | ||
#include <unistd.h> | ||
#include <iostream> | ||
|
||
namespace remramd { | ||
void Client::connect(const std::string &server_ip, const std::uint16_t server_port) { | ||
std::cout << "Server => IP: " << server_ip << " | Port: " << server_port << std::endl; | ||
const auto reverse_shell_port { internal::Protocol::request_connection(server_ip, server_port) }; | ||
run_netcat_tcp_listener(reverse_shell_port); | ||
} | ||
|
||
void Client::run_netcat_tcp_listener(const std::uint16_t reverse_shell_port) { | ||
const std::string nc_path { "/bin/nc" }, | ||
nc_flags { "-nvlp" }; | ||
const char* const args[] { nc_path.c_str(), nc_flags.c_str(), std::to_string(reverse_shell_port).c_str(), nullptr }; | ||
execve(nc_path.c_str(), (char* const*)args, nullptr); | ||
std::cerr << "FAIL\n"; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "../inc/Client.hpp" | ||
#include "../../shared/inc/Connection.hpp" | ||
#include "../../shared/inc/remramd_exception.hpp" | ||
#include <iostream> | ||
|
||
int main(int argc, char **argv) { | ||
if (argc != 3) { | ||
std::cerr << "Usage: " << argv[0] << " <server IP> <server port>\n"; | ||
exit(1); | ||
} | ||
remramd::Client client_obj {}; | ||
try { | ||
client_obj.connect(argv[1], std::stoi(argv[2])); | ||
} catch (const remramd::exception &e) { | ||
std::cerr << e.what() << std::endl; | ||
} | ||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
g++ client/src/*.cpp shared/src/*.cpp server/src/PipeWrapper.cpp -lpthread -std=c++17 -O3 -o client/remramd_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if [[ $EUID -ne 0 ]]; then | ||
echo "The server installer must be run as root" | ||
exit 1 | ||
fi | ||
|
||
g++ server/src/*.cpp shared/src/*.cpp -lpthread -std=c++17 -O3 -o server/remramd_server | ||
|
||
cd driver && make && insmod ramd.ko && cd .. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.