Thread: Packet 3 (Focus Change)

Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1 Packet 3 (Focus Change) 
    Banned

    Join Date
    Oct 2008
    Posts
    842
    Thanks given
    81
    Thanks received
    53
    Rep Power
    0
    Packet 3 (Focus Change)

    Well many of you might have no idea what this packet is used for. Well I will inform you what it is and show you some possible ways of using it.

    The main thing it is used for is checking the focus of the user. For example if the player clicks away from the client it sends a focus change stream to the server and when the player clicks back on the client it sends another focus change stream.

    This is great way to detect cheating or other possible client hacks.

    For example lets say someone connects to your server. By default you would have set the server to have the setting of true for focus when upon joining the server.

    So this would be in your client.java;

    Code:
    private boolean focus = true;
    It would be set to true because the character would not be able to send a focus packet when logged out.

    After that you would want to make it change whenever a user clicks off the client and back onto it.

    So you would change packet 3 (Focus change packet) to;

    Code:
    focus = !focus;
    //System.out.println("Focus changed");
    Now all what you would have to do is create a method to check if the focus is true whenever someone try's to send a packet.

    For example you might make this method;

    Code:
            public boolean checkActivity() {
                    return active;
            }
    And then you would add into your other packets which can ONLY be sent when your client focus is set to true.

    For example you would put at the top of packet 103;

    Code:
    if(!checkActivity())
            return;
    That would check if the player has a valid focus to send the packet. If the player doesn't meet the requirements it just returns and stops the packet from being executed.

    The above information can really help you and your server out against so-called cheat client's and other hacks (I know ViperSniper's cheatclient could send Object Clicks' over and over with the window minimized).

    Well I hoped this information helped someone.
    Reply With Quote  
     


  2. #2  
    ̿ ̿̿ ̿̿ ̿̿̿'̿'\̵͇̿̿\=(•̪

    Dragonking's Avatar
    Join Date
    May 2008
    Posts
    2,011
    Thanks given
    16
    Thanks received
    31
    Rep Power
    567
    Nice good find what would you do to detect like a auto clicker and stuff like that?
    Reply With Quote  
     

  3. #3  
    Since '06

    Ayton's Avatar
    Join Date
    Dec 2006
    Age
    28
    Posts
    1,420
    Thanks given
    66
    Thanks received
    37
    Rep Power
    327
    I believe PJA uses this already, anyways good find.
    Reply With Quote  
     

  4. #4  
    Renown Programmer

    Join Date
    Dec 2008
    Posts
    363
    Thanks given
    1
    Thanks received
    28
    Rep Power
    99
    Quote Originally Posted by tucybro View Post
    Code:
            public boolean checkActivity() {
                    if(!active)
                            return false;
                    return true
            }
    Please:
    Code:
            public boolean checkActivity() {
                    return active;
            }
    Also, if I recall correctly, the client send a byte representing the client's current focus state with packet 3. Use that rather than toggling `active`, or the server could get out-of-sync with the client.
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Oct 2008
    Posts
    842
    Thanks given
    81
    Thanks received
    53
    Rep Power
    0
    Quote Originally Posted by Parabolika View Post
    Please:
    Code:
            public boolean checkActivity() {
                    return active;
            }
    Also, if I recall correctly, the client send a byte representing the client's current focus state with packet 3. Use that rather than toggling `active`, or the server could get out-of-sync with the client.
    Yeh lol, I changed it to your code. (I don't know why I made it like that)
    Reply With Quote  
     

  6. #6  
    Member

    Join Date
    May 2008
    Posts
    1,288
    Thanks given
    50
    Thanks received
    92
    Rep Power
    0
    Posted lots of places.
    e.g.
    http://www.rune-server.org/runescape...mentation.html
    http://www.rune-server.org/runescape...e-packets.html
    (one from 2007 ->) http://www.rune-server.org/runescape...detection.html
    Quote Originally Posted by silabsoft
    Packet Structure:
    Code:
    PacketID(3)
    SignedByte: 1 for in focus 0 for not in focus
    i know in winterlove bases handle packets in some huge switch statement so you could do something like

    Code:
    case 3:
    	int i = readSignedByte();
    	if(i == 1)
    		System.out.println(playerName+" Client is in focus");
    	else
    		System.out.println(playerName+" Client is not focus");
    break;


    here is example pictures

    offtopic: hax i got 666 rep.. and when I viewed rep there was no new rep received (same reps as when it was 665)
    someone purposely giving me 666 rep
    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Oct 2008
    Posts
    842
    Thanks given
    81
    Thanks received
    53
    Rep Power
    0
    Quote Originally Posted by Clifton View Post
    Posted lots of places.
    e.g.
    http://www.rune-server.org/runescape...mentation.html
    http://www.rune-server.org/runescape...e-packets.html
    (one from 2007 ->) http://www.rune-server.org/runescape...detection.html

    offtopic: hax i got 666 rep.. and when I viewed rep there was no new rep received (same reps as when it was 665)
    someone purposely giving me 666 rep
    This would have been brilliant if we were in 2007. But obviously were not we're in 2010. l2update :trollface:
    Reply With Quote  
     

  8. #8  
    Banned

    Join Date
    Dec 2008
    Posts
    2,097
    Thanks given
    1,419
    Thanks received
    732
    Rep Power
    0
    What if the user has a program to the side with an option check always on top so the player could have another program on top but still be playing the game.. gotta think about things like that but good job anyways.
    Reply With Quote  
     

  9. #9  
    Banned

    Join Date
    Oct 2008
    Posts
    842
    Thanks given
    81
    Thanks received
    53
    Rep Power
    0
    Quote Originally Posted by Aristos View Post
    What if the user has a program to the side with an option check always on top so the player could have another program on top but still be playing the game.. gotta think about things like that but good job anyways.
    It would only check the focus when the player clicks. After that the player can click off the client and do something else while its woodcutting or something. It just needs to check if the client is valid when clicking.
    Reply With Quote  
     

  10. #10  
    Banned

    Join Date
    Dec 2008
    Posts
    2,097
    Thanks given
    1,419
    Thanks received
    732
    Rep Power
    0
    Quote Originally Posted by tucybro View Post
    It would only check the focus when the player clicks. After that the player can click off the client and do something else while its woodcutting or something. It just needs to check if the client is valid when clicking.
    you dont get what I'm saying there are some programs that you can set an option to always on top so if you click a different window it wont overlap the window set to always on top so if you do this with lets say a video and set it to always on top then start thieving your client will say its not focused and you will be clicking so your bot detection or w/e you'd like to call it will think its botting and flag the account/ban w/e the consequences are
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

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