A Simple Hook Console App
Locked
FLHook Development
-
HookConsole 127.0.0.1 2000 yourpassword
thats the command line
just put in your ip and port and passwordmain.cpp
#include "global.h" int main(int argc, char* argv[]) { WSADATA wsaData; int iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != NO_ERROR) printf("Client: Error at WSAStartup().\n"); SOCKET m_socket; m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (m_socket == INVALID_SOCKET) { printf("Client: socket() - Error at socket(): %ld\n", WSAGetLastError()); WSACleanup(); return 0; } sockaddr_in clientService; clientService.sin_family = AF_INET; clientService.sin_addr.s_addr = inet_addr(argv[1]); clientService.sin_port = htons(ToInt(argv[2])); if (connect(m_socket, (SOCKADDR*)&clientService, sizeof(clientService)) == SOCKET_ERROR) { printf("Client: connect() - Failed to connect.\n"); WSACleanup(); return 0; } char recvbuf[1024] = ""; recv(m_socket, recvbuf, sizeof(recvbuf), 0); printf("%s\n",recvbuf); char szBuf[64]; sprintf(szBuf, "pass%s\n", argv[3]); send(m_socket, szBuf, (int)strlen(szBuf), 0); recv(m_socket, recvbuf, sizeof(recvbuf), 0); send(m_socket, "eventmode\n", strlen("eventmode\n"), 0); while(SOCKET_ERROR == SOCKET_ERROR) { ulong lSize; ioctlsocket(m_socket, FIONREAD, &lSize); char *szData = new char[lSize + 1]; memset(szData, 0, lSize + 1); recv(m_socket, szData, lSize, 0); printf("%s",szData); delete[] szData; } WSACleanup(); return 0; }
global.h
#ifndef _GLOBAL_ #define _GLOBAL_ #include <string> #include <stdio.h> #include <winsock2.h> using namespace std; typedef unsigned long ulong; int ToInt(string scStr); #endif</winsock2.h></stdio.h></string>
tools.cpp
#include "global.h" int ToInt(string scStr) { return atoi(scStr.c_str()); }
-
here a more advanced version a complete romote console
when it ask for verification rember to use passyourpassword
the command line is
hookconsole 127.0.0.1 2000
basicly add your servers ipmain.cpp
#include "global.h" WComm w; int main(int argc, char* argv[]) { WComm(); char *ip=argv[1]; int port=ToInt(argv[2]); w.connectServer(ip, port); CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Listen,0,0,NULL); while(1) { string command; cin>>command; w.SendString(command); } }
global.h
#ifndef _GLOBAL_ #define _GLOBAL_ #include <iostream> #include <string> #include <stdio.h> #include <winsock2.h> using namespace std; class WComm { public: WComm(); void connectServer(char*,int); void SendString(string); void closeConnection(); }; typedef unsigned long ulong; int ToInt(string scStr); DWORD WINAPI Listen(); #endif</winsock2.h></stdio.h></string></iostream>
tools.cpp
#include "global.h" SOCKET m_socket; WSADATA wsaData; sockaddr_in con; WComm::WComm() { int iResult = WSAStartup( MAKEWORD(2,2), &wsaData ); if ( iResult != NO_ERROR ) { return; } m_socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); if ( m_socket == INVALID_SOCKET ) { WSACleanup(); return; } } void WComm::connectServer(char *ip,int port) { con.sin_family = AF_INET; con.sin_addr.s_addr = inet_addr( ip ); con.sin_port = htons( port ); if ( connect( m_socket, (SOCKADDR*) &con, sizeof(con) ) == SOCKET_ERROR) { closesocket(m_socket); WSACleanup(); } } void WComm::SendString(string command) { char szBuf[64]; sprintf(szBuf, "%s\n", command.c_str()); send(m_socket, szBuf, (int)strlen(szBuf), 0); } void WComm::closeConnection() { closesocket(m_socket); } int ToInt(string scStr) { return atoi(scStr.c_str()); } DWORD WINAPI Listen() { while(SOCKET_ERROR == SOCKET_ERROR) { ulong lSize; ioctlsocket(m_socket, FIONREAD, &lSize); char *szData = new char[lSize + 1]; memset(szData, 0, lSize + 1); recv(m_socket, szData, lSize, 0); printf("%s",szData); FILE *f = fopen("HookConsole.log", "at"); if(!f) return false; fprintf(f, "%s",szData); fclose(f); delete[] szData; } WSACleanup(); return 0; }
it logs to file as well just incase you miss some thing
-
HookConsole
just edit HookConsole.bat put your server ip in
and port run it when it asks to authenticate
put in your server password like so passyourpassword
you have to use pass in front of it to tell hook your entering your password rember no spaces