Microsoft MVP성태의 닷넷 이야기
글쓴 사람
jhp (hopa0228 at naver.com)
홈페이지
첨부 파일
 

DWORD _Base = (DWORD)GetModuleHandle("game.exe");

DWORD tmBase = _Base + 0x7FCE40;
DWORD _angle = _Base + 0x7F1484;
DWORD _CamPos = _Base + 0x7F148C;
DWORD cBone = _Base + 0x1720A0;
DWORD GAbase = _Base + 0x7C969C;

class _Angle
{
public:
    char _0x1[0x2CC];
    float ySub;
    float Yaxis;
    char _0x001[0xB4];
    float Xaxis;
};
class cSkeleton
{
public:
    char _0x0000[0x80];
    D3DXVECTOR3 BoneCords; // 0x80
};
class CgameBase
{
public:
    char _0x0004[0xB57C];
    int Index; // 0xB57C
    int GameType; // 0xB580
    int _0x0045;// 0xB584
    int Rounds; // 0xB588
};
class PlayerLoop
{
public:
    char _0x01[0x1C48F0];
    int lctnView;
    int none1;
    int none2;
    int isAlive;
};
class __PLR
{
public:

    _Angle* AAAngle()
    {
        return *(_Angle**)(_angle);
    }



    D3DXVECTOR3 MyCamPos = *(D3DXVECTOR3*)_CamPos;
    DWORD PlayerIndex(int i)
    {
        DWORD result = *(PDWORD)tmBase;
        if (!result)
            return 0;

        result = *(PDWORD)(result + 0xC);
        if (!result)
            return 0;

        result = *(PDWORD)(result + 0x4);
        if (!result)
            return 0;

        result = *(PDWORD)(result + (i * 4) + 4);
        if (!result)
            return 0;

        result = *(PDWORD)(result + 0x80C);
        if (!result)
            return 0;

        result = *(PDWORD)(result + 0x170);
        if (!result)
            return 0;

        return *(PDWORD)(result + 0x4);
    }

    CgameBase* GetGameBase()
    {
        return *(CgameBase**)GAbase;
    }

    DWORD GetTeamBase()
    {
        DWORD Ptr1 = *(PDWORD)tmBase;
        if (Ptr1 == 0)
            return 0;
        return Ptr1 = *(PDWORD)(Ptr1 + 0x10);
    }
    int GetMyIndex()
    {
        CgameBase* pPlayerBase = GetGameBase();
        if (!pPlayerBase)
            return 0;

        return pPlayerBase->Index;
    }
    bool isTeammate(int i)
    {
        int MyPlayer = *(PDWORD)(GetTeamBase() + 4 * GetMyIndex() + 0x548);
        int Entity = *(PDWORD)(GetTeamBase() + 4 * i + 0x548);

        if (MyPlayer == Entity)
            return true;

        return false;
    }
    DWORD PlayerLoopBase()
    {
        DWORD result = *(PDWORD)tmBase;
        if (!result)
            return 0;

        result = *(PDWORD)(result + 0xC);
        if (!result)
            return 0;

        return *(PDWORD)(result + 0x4);
    }
    PlayerLoop* GetPlrByLoop(int i)
    {
        DWORD BasePtr = PlayerLoopBase();

        if (BasePtr == 0)
            return 0;

        return *(PlayerLoop**)(BasePtr + (i * 4) + 4);
    }

};
extern __PLR plr;
__PLR plr;
D3DXVECTOR3 _GetBone(int i, LPSTR szBoneName)
{

    typedef cSkeleton* (__thiscall* tGetBonePtr)(DWORD, LPSTR);
    tGetBonePtr GetBonePtr = (tGetBonePtr)cBone;
    cSkeleton *pGetBone = GetBonePtr(plr.PlayerIndex(i), szBoneName);

    return pGetBone->BoneCords;
}

void AimToTarget(D3DXVECTOR3 MyPlayer, D3DXVECTOR3 Entity, D3DXVECTOR3 &Aim) // math for who asking for it !
{
    double Target[3] = { (MyPlayer.x - Entity.x), (MyPlayer.y - Entity.y), (MyPlayer.z - Entity.z) }; // for x y z
    double hyp = sqrt(Target[0] * Target[0] + Target[2] * Target[2]);

    Aim.x = (float)(atanf(Target[2] / Target[0]) * -1.0f); // this is for Y_Sub, important !
    Aim.y = (float)(asinf(Target[1] / hyp) * 57.29573671972f);
    Aim.z = 0.0f; // keep it 0

    // Math for map_world.. to fix it here we go..
    if (Target[0] >= 0.0) { Aim.x -= 180.0f / 57.29573671972f; }

}

void Aimbot()
{

    D3DXVECTOR3 MY_CAM = plr.MyCamPos;
    D3DXVECTOR3 i_Aim;

    _Angle* MY_Angle = plr.AAAngle();
    float xAxis = MY_Angle->Xaxis;
    float yAxis = MY_Angle->Yaxis;
    float ySub = MY_Angle->ySub;

    for (int i = 0; i < 16; i++)
    {
        PlayerLoop* Players = plr.GetPlrByLoop(i);
        if (Players)
        {
            if (plr.isTeammate(i)) continue; // ignore teammate
            if (!Players->isAlive) continue; // ignore deadbody.
            if (i == plr.GetMyIndex()) continue; // ignore myplayer.

            D3DXVECTOR3 Entity_Head = _GetBone(i, "Bip01 Neck");
            if (GetAsyncKeyState(VK_RBUTTON) & 0x8000) // Hotkey for aimbot..
            {
                AimToTarget(MY_CAM, Entity_Head, i_Aim);

                MY_Angle->Xaxis = i_Aim.x;
                MY_Angle->Yaxis = i_Aim.y;
                MY_Angle->ySub = i_Aim.y * -1; // important !
            }
        }
    }


}



이런 저런 글들을 읽어봐도 너무 어렵네요 ㅜㅜ








[최초 등록일: ]
[최종 수정일: 10/30/2018]


비밀번호

댓글 작성자
 



2018-10-30 10시30분
글쎄요, 저도 저것만 봐서는 뭐라고 조언해 드릴 것이 없군요. 아래의 글을 참고하시고,

MIT 라이선스로 무료 공개된 Detours API 후킹 라이브러리
; http://www.sysnet.pe.kr/2/0/11764

예제 프로젝트에 있는 sleep5 프로젝트를 잘 분석하셔서 원하는 목적에 맞게 접목하시면 될 것입니다.
정성태
2018-11-03 04시08분
[ jhp] 답변감사드립니다. 아직 내공이 부족해서 그런지 계속 해봐도 모르겠네요 ㅠㅠ
혹시 윈도우모드로 프로그램을 실행시키게 만드는 소스가 있나요?
[guest]
2018-11-03 06시53분
Detours의 samples 폴더에 보면 traceapi라는 예제가 있습니다. 그 예제가 윈도우가 있는 예제일 것입니다.
정성태
2018-11-04 02시57분
덧글 질문을 다시 읽어 보니, 아마도 Full Screen으로 뜨는 게임 프로그램을 "Windowed" 모드로 뜨도록 만드는 소스가 있는지를 물어보는 것 같은데요, 그런 용도로 나온 예제 코드는 없습니다. 아마도 웹을 검색해 보면 나올 수도 있겠지만 후킹과 관련된 것이라 찾기가 쉽지는 않을 것입니다.

참고로, Detours로 한다면 COM 후킹 예제 소스를 보고 구현해야 할 것입니다. 또한 대상 게임 프로그램이 사용하는 DirectX 버전에 따라 사용하는 COM 인터페이스가 다르기 때문에 그런 부분도 조정해야 할 것입니다. 혹시나 성공하시거든 관련해서 블로그 글 하나 써서 공유해 주시면 다른 분들에게도 멋진 참고 자료가 될 것입니다. ^^
정성태

... 16  17  18  19  20  21  [22]  23  24  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
5376영귤9/1/20206951nullable 타입간의 비교연산은 그냥 가능한 건가요? [1]
5375영귤8/30/20208446이벤트와 델리게이트의 차이가 궁금합니다. [2]
5374guest8/27/20209529시작하세요! C# 8.0 프로그래밍 책에 오타가 있습니다. [1]
5373agj8/26/20207735System.Single::ToString()함수의 IL코드를 보았는데 ldnull, throw가 전부입니다. 왜 이렇게 짧죠? [2]
5372민성8/24/20207728안녕하세요 WPF 웹브라우저 컨트롤에서 웹브라우저 자체를 엣지로 할 수가 있나요? [2]
5371서현준8/11/20206802Hyper-V 내부 네트워크 환경 중, VM 에서 인터넷 접속 [1]
5370독자8/11/20205830.net createobject 관련 질문입니다.. [4]
5369독자8/10/20206178c# 8.0 프로그래밍 책에 대한 질문 드립니다 [1]
5368guest8/10/20207465시작하세요! C# 8.0 프로그래밍 책에 오타가 있습니다. [1]
5367박순기8/8/20206364디버깅 시 반전되는 부분 글 색상이나 배경색을 변경하는 방법 [3]파일 다운로드1
5366간절함8/7/20207053하나의 솔루션에서, 32비트 프로젝트에서 다른 64비트 프로젝트 참조하는 방법 궁금합니다. [4]
5365영귤8/6/20206312TimeSpan 구할 때 시간대를 바꿔도 같은 값이 나오는 것 같습니다. [1]
5364박순기8/5/20206366visual studio의 menu bar font size 변경방법 문의 [2]파일 다운로드1
5363클락8/1/20206966c# 9.0 출간 준비 중이신가요? [2]
5361하태7/29/20206593안녕하세요! 바이너리데이터 파싱 질문 드리겠습니다!. [2]
5360진우7/28/20207501엑셀에서 발생하는 모든 이벤트를 감지 할수 있는지 궁금합니다. [6]파일 다운로드1
5358홍길동7/22/20206250개체에서 open 속성이나 매서드가 지원 되지 않읍니다.라고 오류창이 뜨는데. [1]
5357손동섭7/22/20206326책 예제코드... [3]
5355neska7/21/20206700안녕하세요 문의 드립니다 [1]
5354민성7/15/20208171안녕하세요 db연결 문자 보안 [2]
5353형성재7/14/20207229Visual Studio Setup Project에서 VC++2010재배포패키지설치 [4]
5352윤식7/10/20207194닷넷코어 빌드 시 runtimeconfig 파일을 없앨 수 있는지.. [4]
5351runr...7/2/20207072C# 에서 C++ dll 병렬 사용 [1]
5350홍성호6/29/20208680C++에서 정의된 구조체(공유메모리)를 C#으로 공유메모리에서 구조체 변환시 에러가 발생 합니다. [1]파일 다운로드1
5349jero...6/24/20206201logon credential provider 관련 문의드립니다. [1]
5348776/19/20205962시작하세요 C# 8.0프로그래밍 책에 대한 질문입니다. [8]
... 16  17  18  19  20  21  [22]  23  24  25  26  27  28  29  30  ...