iseekwonderful / csgoGlow

Simple macOS CSGO glow hack
111 stars 66 forks source link

I've implemented no-flash #155

Closed sacredgeo closed 8 years ago

sacredgeo commented 8 years ago

If this is inappropriate for github please remove it.

I've added a no-flash. Here's the code. You just need to find the flash offset. I did it with Bit Slicer in about 20 minutes.

int flashed;
Utils::ReadMemAndDeAllocate(csgo, current_task(), playerAddress + 0x????, &flashed);

if(flashed > 0.0f){
    WriteMem(csgo, playerAddress + 0x????, 0.0f);
}

This was much easier than I expected. I'm trying to play with the code so it doesn't completely remove the flash, but just reduces it. No luck so far.

Also, does anyone know if this method is VAC detectable? Thanks.

sacredgeo commented 8 years ago

@gazababon123

aKalisch has a bunnyhop source code here: https://github.com/aKalisch/source-bunnyhop

It took me a few hours to implement. I'm a terrible coder. Someone more experienced could probably do it in 10 minutes.

columbusblue34 commented 8 years ago

@sacredgeo why dont you just upload the code that is implemented that you coded to your own github

sacredgeo commented 8 years ago

@columbusblue34

I'm not going to do that. aKalisch has the source code for all to use. If he wanted people to just copy and paste it, he'd have uploaded it in the complete form.

gazababon123 commented 8 years ago

@sacredgeo i tried that, but do i paste that code into the main.cpp or i make another code and build it?

sacredgeo commented 8 years ago

@gazababon123

You can make a new .cpp file or take the functions out and stick them in your main.cpp like I did.

gazababon123 commented 8 years ago

@sacredgeo so i copy it, and paste it in the glowhack main.cpp? sorry i feel bad now :v

sacredgeo commented 8 years ago

@gazababon123

You can have it in bunnyhop.cpp or stick the functions in main.cpp. Either will work. Do you have any coding experience? I spent 4 years learning many different programming languages when I was a teenager. I've forgotten a lot of it, but I rely on that limited experience to help me with these CSGO cheats.

gazababon123 commented 8 years ago

@sacredgeo welp sorry to say. no :(

gazababon123 commented 8 years ago

screen shot 2016-10-29 at 10 19 03 am weird, it says cannt detect.

gazababon123 commented 8 years ago

you know why?

sacredgeo commented 8 years ago

@gazababon123

It's really going to be difficult for you then. I'm sorry.

Vector3 is a class aKalisch linked above. https://gist.github.com/aKalisch/d57734c10ed23d68ac82961c36f8ce6d

Where it says LocalPlayer it's referring to a location in memory. You'll need to read the memory to get that data. The offsets are m_fFlags and m_vecVelocity. There is code in the csgoGlow cheat you can use as an example for how to read the memory.

My advice is to study the csgoGlow code and try to understand how it works. Then you can adapt it to your own needs.

gazababon123 commented 8 years ago

@sacredgeo what memory?

sacredgeo commented 8 years ago

@gazababon123

https://en.wikipedia.org/wiki/Random-access_memory

http://www.webopedia.com/TERM/R/RAM.html

RAM (pronounced ramm) is an acronym for random access memory, 
a type of computer memory that can be accessed randomly; that is, 
any byte of memory can be accessed without touching the preceding 
bytes. RAM is the most common type of memory found in computers 
and other devices, such as printers.

It's where CS:GO stores information such as your health, your position, etc.

gazababon123 commented 8 years ago

@sacredgeo https://www.youtube.com/watch?v=Uv5tJXA04zU this is a tutorial for it? gabsens make it

sacredgeo commented 8 years ago

@gazababon123 That's a good tutorial. You need to download Bit Slicer first. The video will show you how to find the current LocalPlayer offset. From there you can find a lot of information about your player in CS:GO such as health and team number. LocalPlayer is needed for these cheats to work, including the bunnyhop. aKalisch updated the cheat recently to automatically find the offset, but it's still good to know how to find it.

gazababon123 commented 8 years ago

@sacredgeo hmm.... so do i need to find the health code? which part needs to be filled by me, by looking at the local player base?

sacredgeo commented 8 years ago

@gazababon123 Did you watch the video?

gazababon123 commented 8 years ago

@sacredgeo yes

sacredgeo commented 8 years ago

@gazababon123 I don't understand your question.

gazababon123 commented 8 years ago

@sacredgeo hmm so. you said the problem with localplayer not detected is that, its a memory that i need to look at but im not sure i know what is missing.

sacredgeo commented 8 years ago

@gazababon123

For example, in the code it says "localPlayer.iHealth" but that doesn't really refer to anything. You need to add the code to read that portion of memory. Same for localPlayer.iFlags, velo.x, and velo.y.

These offsets are called m_iHealth, m_fFlags, and m_vecVelocity.

If you study the csgoGlow code and also read the posts on this github you will have all the information you need.

It took me hours and hours to get it working. Even with 4 years coding experience. These are difficult topics. Study the code. Use google. Read the posts on this github.

gazababon123 commented 8 years ago

@sacredgeo 1 last question screen shot 2016-10-29 at 10 52 51 am is the localplayer.ihealth >= 1

is the "1" the value that i have to change?, just like the oterhs

gazababon123 commented 8 years ago

@sacredgeo can you explain me how to get the automated way, you say aKalisch update the cheat

sacredgeo commented 8 years ago

Download the cheat again. aKalisch updated it the code to automatically get the offsets. https://github.com/iseekwonderful/csgoGlow

gazababon123 commented 8 years ago

@sacredgeo i know how to use the glowhack, and how to update its offset, im just so damn confused about the bhop.

the glowhack is not hard to use, i use gabsen's pattern scanner

but idk how to find the offset of my m_fFlags

gazababon123 commented 8 years ago

i am talking about the bhop not the glowhack

sacredgeo commented 8 years ago

aKalisch already explained it above. Read his posts.

bertrand2012 commented 8 years ago

@sacredgeo Hey bro just one question. I'm looking to learn c++ but im worried that i might spend hours upon hours learning it about windows but i have a mac so could or might be usless. My question is, what are the differences between c++ on OS X and Windows?

ggothreau commented 8 years ago

There is (essentially) no difference in the language between platforms. The difference will be the operating system's API's you'd be using (for example loading dynamic libraries and reading / writing memory for a process). C++ itself is a language that is independent of any operating system.

bertrand2012 commented 8 years ago

@ggothreau So it'll be alright if i learn c++ on windows?

ggothreau commented 8 years ago

Yeah, you can learn the basics on Windows and then learn the API necessary for macOS when you're ready.

aKalisch commented 8 years ago

For all who want an aimbot: https://github.com/A5-/CSGO-External

This is the base I used for my Aimbot. With some effort and some time everybody can implement that.

sacredgeo commented 8 years ago

@aKalisch

Wow thanks. That's impressive. I'll try to implement it tomorrow. I've been working on my aimbot for about 6 hours... I've got it working somewhat, but it's total trash. I planned to add your vector3 class once I got it working better. Also, I think I've mixed up an x and y somewhere in there I need to fix.

void aim(){
    //read vecorigin
    float myAngle[2];
    for(int i = 0; i < 2; i++){
        myAngle[i] = mem->read<float>(playerAddress + 0x160 + 0x4 * i);
    }

    //read my position
    float myPos[3];
    for(int i = 0; i < 3; i++){
        myPos[i] = mem->read<float>(playerAddress + 0x16C + 0x4 * i);
    }

    //add distance from ground to eyes
    myPos[2] += mem->read<float>(playerAddress + 0x144);

    float angles[3];

    //calc distance to enemy
    double delta[3] = { (myPos[0]-ePos[0]), (myPos[1]-ePos[1]), (myPos[2]-ePos[2]) };
    double hyp = sqrt(delta[0]*delta[0] + delta[1]*delta[1]);

    // calc pitch and yaw to look at enemy
    angles[0] = (float) (asinf(delta[2]/hyp) * 57.295779513082f);
    angles[1] = (float) (atanf(delta[1]/delta[0]) * 57.295779513082f);
    angles[2] = 0.0f;

    if(delta[0] >= 0.0){
        angles[1] += 180.0f;
    }

    if(angles[1] > 180){
        angles[1] -= 360;
    }

    //get the current mouse position
    CGEventRef ourEvent = CGEventCreate(NULL);
    CGPoint point = CGEventGetLocation(ourEvent);
    float currentX = (float)point.x;
    float currentY = (float)point.y;
    CFRelease(ourEvent);

    //check if the enemy is witin 20 degrees of xhair
    //if within 1 degree stop aiming
    if(
       fabs(myAngle[0] - angles[0]) > 0.5 &&
       fabs(myAngle[1] - angles[1]) > 0.5 &&
       fabs(myAngle[0] - angles[0]) < 20 &&
       fabs(myAngle[1] - angles[1]) < 20
   ){             
        //move mouse y
        CGEventRef moveMouse;
        if(myAngle[1] > angles[1]){
            moveMouse = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, CGPointMake(currentX, currentY - 2), kCGMouseButtonLeft );
        }else if(myAngle[1] < angles[1]){
            moveMouse = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, CGPointMake(currentX, currentY + 2), kCGMouseButtonLeft );
        }
        CGEventPost(kCGHIDEventTap, moveMouse);

        //move mouse x
        if(myAngle[0] > angles[0]){
            moveMouse = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, CGPointMake(currentX + 2, currentY), kCGMouseButtonLeft );
        }else if(myAngle[0] < angles[0]){
            moveMouse = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, CGPointMake(currentX - 2, currentY), kCGMouseButtonLeft );   
        }
        CGEventPost(kCGHIDEventTap, moveMouse);
        CFRelease(moveMouse);
    }  
}
ggothreau commented 8 years ago

Did you get CGEventCreateMouseEvent to work? I've always found it difficult to work with.

sacredgeo commented 8 years ago

@ggothreau Yes I did and that part took me about an hour by itself. What a pain...

ggothreau commented 8 years ago

@sacredgeo Good progress. Keep up the good work!

sacredgeo commented 8 years ago

@ggothreau Thanks! If I get it working correctly I'll let you know. Then I'll probably delete it and add aKalish's. He's probably gonna laugh at my terrible code haha!

aKalisch commented 8 years ago

@sacredgeo are u planning to aim by mouseevent? Why don't write to viewangles in CS:GO? Then you don't need any WorldToScreen method.

Look my Wiki Entry at https://github.com/iseekwonderful/csgoGlow/wiki/Guides----Get-SetViewAngle-memory-address to obtain the writeable viewangles memory address.

sacredgeo commented 8 years ago

That seems like a better option. I'll play around with it and see how it works.

veb commented 8 years ago

When you find the XREF for say, m_iHealth, what's the next step? I can't seem to find 0x134 as per your example @aKalisch

image

sacredgeo commented 8 years ago

@veb did you click on the first set of numbers with a plus sign? Mine had 3. I'll see if I can help you later tonight.

I've been at work all day, but I've been handwriting code for a smooth aim based on the viewangles. The y axis was easy enough, but the X axis was tricky due to the range going from +/- 0-180. I'll get to test it later!

veb commented 8 years ago

I did this:

I'm not sure what to do next!

sacredgeo commented 8 years ago

@veb Here's my screen:

screen shot 2016-10-29 at 8 06 59 pm

screen shot 2016-10-29 at 8 07 35 pm

veb commented 8 years ago

@sacredgeo could you give me the complete steps as to what you do? :)

sacredgeo commented 8 years ago

@veb

Open Hopper. Go to File -> Read executable to disassemble. Open client.dylib. A window will pop up. I used the default settings which are shown here:

screen shot 2016-10-29 at 8 12 02 pm

Wait for it to process. You'll see little colored bars filling the top area of the screen. On the left select strings and type "m_iHealth". Click the result below that says "m_iHealth". It will locate the netvar. Click on the XREF section. You'll see something like " XREF=sub_363b50+197, sub_58b3d0+525, sub_5e4e20+900"

Click the +197 and it takes you to the next screen. You should see something like this:

screen shot 2016-10-29 at 8 07 35 pm

Hopefully you see a 0x134 somewhere in there.

veb commented 8 years ago

haha... that was easy @sacredgeo I went "shit, am I actually opening the RIGHT client.dylib?". I wasn't.

For anyone else, the path is /Users/<username>/Library/Application Support/Steam/steamapps/common/Counter-Strike Global Offensive/csgo/bin/osx64/client.dylib

veb commented 8 years ago

@sacredgeo did you end up finding the flag for the flash in Hopper as well? What did you look for?

sacredgeo commented 8 years ago

@veb Good! I'm glad you got it. I had a feeling you had that step wrong! I went and checked the other dylibs in the same folder (server.dylib, etc) for m_iHealth just in case there was a mix-up. Were you looking at client.dylib for another game like TF2?

Well... remember the netvar was called "m_flFlashMaxAlpha" so why don't you tell me ;-)

veb commented 8 years ago

👍 yeah, I totally forgot that.

I looked at m_fFlashDuration instead:

    if(flashed) {
        mem->write<float>(playerAddress + 0xABF8, 0);
    }

(ignore my float)

sacredgeo commented 8 years ago

So m_fFlashDuration refers to how long the flash lasts, and m_flFlashMaxAlpha refers to how transparent / opaque your screen gets when flashed. You can change either to zero to have no flash. My method was to turn m_flFlashMaxAlpha to a lower number (range = 0 - 255), so I still get flashed, but it's minimal and I can still see everything. You can react like you're flashed so overwatch / spectators won't notice.