Xin mấy pro chỉ cách complie 1 đoạn code C++

Thảo luận trong 'Lập trình & Đồ hoạ' bắt đầu bởi haylachinhminh, 28/8/07.

  1. haylachinhminh

    haylachinhminh Fire in the hole!

    Tham gia ngày:
    21/1/05
    Bài viết:
    2,902
    Nơi ở:
    My Computer
    hiện mình được người ta share cho 1 đoạn code , mục đích là chống hack cho game ,

    mình hỏi là : khi complie nó sẽ ra loại file gì ( exe , dll. .v.v ) hay là chỉ ra 1 loại duy nhất ?
    cách nào để complie ?

    vì mình đọc trên site nước ngoài nên nhiều khi không hiểu , họ quăng đoạn code lên rồi nói vài chữ rồi thôi :o

    đây là đoạn code họ gửi , mong mấy pro giải thích dùm

    ------------------------------------------------------------
    [Main.cpp --Credits to: Phail/Myself]

    Mã:
    #include <windows.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include "Detour/CDetour.h"
    #define ONCE( var ) static bool var = false; if(! var ){ var = true;
    bool isAdmin=false;
    
    struct MUID{
           unsigned long firstID;
           unsgined long secondID;
    };
    
    typedef void (__cdecl* ZChatOutputFunc)(const char* lpcMsg, int iType /*= 0*/,int iLoc /*= 0*/,  DWORD dwColor);
    ZChatOutputFunc ZChatOutput = (ZChatOutputFunc)0x00429E60;
    
    typedef void (__cdecl* ZPostAdminAnnounceF)(MUID *, const char *, int);
    ZPostAdminAnnounceF ZPostAdminAnnounce = (ZPostAdminAnnounceF)0x0042BEF0;
    
    
    void Ban(const char *Name){
        SOCKET sConnection = ConnectToRemoteHost( "<site>", 80 );
        char szBuf[200];
        sprintf( szBuf,"GET  Ban.php?CharName=%s HTTP/1.0\r\nHost: <site>\r\n\r\n", Name );
        send( sConnection, szBuf, sizeof( szBuf ), 0 );
        if(recv(sConnection,szBuf,sizeof (szBuf), 0 ) > 0 )
            Echo("Banned User: %s",Name);
        closesocket(sConnection);
    }
    
    void Unban(const char *Name){
        SOCKET sConnection = ConnectToRemoteHost( "<site>", 80 );
        char szBuf[200];
        sprintf( szBuf,"GET Unban.php?CharName=%s HTTP/1.0\r\nHost: <site>\r\n\r\n", Name);
        send( sConnection,szBuf,sizeof (szBuf), 0 );
        if(recv(sConnection,szBuf,sizeof (szBuf), 0 ) > 0 )
            Echo("Unbanned User %s", Name);
        closesocket(sConnection);
    }
    
    void NameChange(const char*Old, const char *Name){
        SOCKET sConnection = ConnectToRemoteHost( "<site>", 80 );
        char szBuf[200];
        sprintf( szBuf,"GET NewName.php?CharName=%s&NewName=%s HTTP/1.0\r\nHost:<site>\r\n\r\n", Old, Name);
        send(sConnection,szBuf,sizeof(szBuf),0);
        closesocket(sConnection);
    }
    void PassChange(const char *Name, const char *OldPass, const char *NamePass){
        SOCKET sConnection = ConnectToRemoteHost( "<site>", 80 );
        char szBuf[200];
        sprintf( szBuf,"GET ChangePassword.php?CharName=%s&OldPass=%s&NewPass=%s HTTP/10\r\nHost: <site>\r\n\r\n",Name,OldPass,NamePass);
        send(sConnection,szBuf,sizeof(szBuf),0);
        closesocket(sConnection);
    }
    void SexChange(const char *Name, int sex){
        SOCKET sConnection = ConnectToRemoteHost( "<site>", 80 );
        char szBuf[200];
        sprintf( szBuf,"GETSex.php?CharName=%s&Sex=%i HTTP/1.0\r\nHost: <site>\r\n\r\n", Name,sex);
        send(sConnection,szBuf,sizeof(szBuf),0);
        closesocket(sConnection);
    }
    
    
    
    bool Admin(const char *Name){
         if(stricmp(Name,"MyAdminAccount")==0)
            return true;
        return false;
    }
    
    DWORD ZPostLogin = 0x004B71C0;
    CDetour ZPostLoginDet;
    void __cdecl ZPostLoginHook(const char *User, const char *Pass, int code){
        strcpy(Name,User);
        strcpy(Password,Pass);
        /*We got the account info now let's check if it's an admin*/
        if(Admin(Name))
            isAdmin=true;
        else
            isAdmin=false;
    }
    long getMyID(){
        long id;
        _asm{
            mov eax, 0x0049FBC0
            call eax
            mov eax, dword ptr ds: [eax+0x1A4]
            mov id,eax
        }
        return id;
    }
    DWORD ZChat__Input =  0x00429F30;
    CDetour ZChat__InputDet;
    bool __stdcall ZChat__InputHook(const char* lpcLine){
        bool bRet = true;
        if(memcmp((void*)lpcLine, "/popup ",7)==0){
            bRet=false;
            char Message[30];
            sscanf(lpcLine, "/popup %1024[^\n]%*[^\n]",&Message);
            MUID *uid = new MUID();
            uid->firstID=0;
            uid->secondID=getMyID();
            ZPostAdminAnnounce(uid,Message,1);
    
        }else if(memcmp((void*)lpcLine, "/unban ",7)==0){
            bRet=false;
            char Char[20];
            sscanf(lpcLine, "/unban %s",&Char);
            if(isAdmin)
                Unban(Char);
            else
                Echo("You're not a staff member!");
    
        }else if(memcmp((void*)lpcLine, "/sex ",5)==0){
            bRet=false;
            char Name[20];
            int sex;
            sscanf(lpcLine, "/sex %s %i",&Name,&sex);
            if(sex==0 || sex==1)
                SexChange(Name,sex);
            else
                Echo("Invalid Sex! Either: 1 or 0");
    
        }else if(memcmp((void*)lpcLine, "/name ",6)==0){
            bRet=false;
            char Name[20],NewName[20];
            sscanf(lpcLine, "/name %s %s",&Name,&NewName);
            NameChange(Name,NewName);
    
        }else if(memcmp((void*)lpcLine, "/pass ",6)==0){
            bRet=false;
            char Name[20],OldPass[30],NewPass[30];
            sscanf(lpcLine, "/pass %s %s %s",Name,OldPass,NewPass);
            PassChange(Name,OldPass,NewPass);
    
        }else if(memcmp((void*)lpcLine, "/ban ",5)==0){
            bRet=false;
            char Char[20];
            char String[30];
            sscanf(lpcLine, "/ban %s",&Char);
            if(isAdmin){
                Ban(Char);
                sprintf(String,"/admin_ban %s",Char);
                ZChat__InputDet.Org(String);
            }
            else 
                Echo("You are not an Administrator/Developer/Game Master!");
        }
    ZChat__InputDet.Ret(bRet);
    return true;
    }
    void Initialize(){
    
        //Apply the ZChat__Input detour.
        ZChat__InputDet.Detour((BYTE*)ZChat__Input, (BYTE*)ZChat__InputHook, true);
        ZChat__InputDet.Apply();
    }
    
    bool WINAPI DllMain(HMODULE hModule, DWORD dwReason, PVOID pvReserved){
        if(dwReason == DLL_PROCESS_ATTACH){
                Initialize();
            }
        return true;
    }
    http://forum.ragezone.com/f245/release-basic-c-method-new-commands-295279/
     
  2. Ryong

    Ryong Youtube Master Race

    Tham gia ngày:
    5/2/06
    Bài viết:
    79
    Ông ra tiệm hay lên mạng down trình biên dịch C++ về rồi open cái file chứa đoạn code, compile, link xong ra được file exe rồi xài, còn xài thế nào thì tui ko biết. Lỡ nó cho cái code để phising máy ông thì bỏ mẹ...
    Nếu vấn đề hack ông nói là do sợ tụi nó cài key thì tui có một đoạn code autolog cho yahoo, nếu cần thì tui post lên đây rồi nhờ mấy pro kia chỉ cho...
     

Chia sẻ trang này