PenUltima Online

It is currently Thu Aug 28, 2008 9:55 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Thu Mar 29, 2007 12:28 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
if you dont send the deny then how are you slowing the movement or are you just logging it? The scripts I put up are designed to stop the movement from going too fast period. If you don't send either the accept or deny packets, either you'll hang up the client making it think its lagging or the client and server go out of sync.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 12:11 am 
Offline

Joined: Sun Feb 05, 2006 2:00 am
Posts: 91
Location: Denmark
CWO wrote:
Are you sending the initialization at login/reconnect?

Yep.


Here is my modified packet, but it can only handle speekhack, not the the movement difference in the clients :cry:
Let me point out that I am not using this on a live shard, since I was not happy with the results.

uopacket.cfg
Code:
Packet 0x02
{
  Length 7
  ReceiveFunction antispeed:HandleSpeedHackers
}


pkg.cfg
Code:
Enabled      1
Name      antispeedhack
Maintainer   Repsak
Email      repsak@pangaea-world.dk
CoreRequired   96
Version      1.0
Author/Basis   CWO


logon.src
Code:
use uo;
use polsys;
use util;

program Login_AntiSpeedHack(who)
       
        SetObjProperty(who, "#moves", CInt(0));
        SetObjProperty(who, "#shackwarning", CInt(0));
        EraseObjProperty(who, "#movepid");
        var shackstack := array;
        shackstack[1] := RandomInt(0x4000000000000)+1;
        shackstack[2] := RandomInt(0x4000000000000)+1;
        shackstack[3] := RandomInt(0x4000000000000)+1;
        shackstack[4] := RandomInt(0x4000000000000)+1;
        shackstack[5] := RandomInt(0x4000000000000)+1;
        shackstack[6] := RandomInt(0x4000000000000)+1;
        var shstack := CreatePacket(0xBF, 29);
        shstack.SetInt16(1,0x001D);
        shstack.SetInt16(3,0x0001);
        shstack.SetInt32(5, shackstack[1]);
        shstack.SetInt32(9, shackstack[2]);
        shstack.SetInt32(13, shackstack[3]);
        shstack.SetInt32(17, shackstack[4]);
        shstack.SetInt32(21, shackstack[5]);
        shstack.SetInt32(25, shackstack[6]);
        shstack.SendPacket(who);
        SetObjProperty(who, "#shackstack", shackstack);

endprogram


reconnect.src
Code:
use uo;
use polsys;
use util;

program Reconnect_AntiSpeedHack(who)

        SetObjProperty(who, "#moves", CInt(0));
        SetObjProperty(who, "#shackwarning", CInt(0));
        EraseObjProperty(who, "#movepid");
        var shackstack := array;
        shackstack[1] := RandomInt(0x4000000000000)+1;
        shackstack[2] := RandomInt(0x4000000000000)+1;
        shackstack[3] := RandomInt(0x4000000000000)+1;
        shackstack[4] := RandomInt(0x4000000000000)+1;
        shackstack[5] := RandomInt(0x4000000000000)+1;
        shackstack[6] := RandomInt(0x4000000000000)+1;
        var shstack := CreatePacket(0xBF, 29);
        shstack.SetInt16(1,0x001D);
        shstack.SetInt16(3,0x0001);
        shstack.SetInt32(5, shackstack[1]);
        shstack.SetInt32(9, shackstack[2]);
        shstack.SetInt32(13, shackstack[3]);
        shstack.SetInt32(17, shackstack[4]);
        shstack.SetInt32(21, shackstack[5]);
        shstack.SetInt32(25, shackstack[6]);
        shstack.SendPacket(who);
        SetObjProperty(who, "#shackstack", shackstack);

endprogram


antispeedhelper.src
Code:
use uo;
use os;
use polsys;
use util;

program antispeed(who)

        SetObjProperty(who, "#movepid", GetPid());
        var packet, newkey, shackwarning;
        while(GetObjProperty(who, "#moves"))
             if (GetEquipmentByLayer(who, 25))
                  sleepms(80); // 80
             else
                  sleepms(160); // 160
             endif
             set_critical(1);
             newkey := RandomInt(0x4000000000000)+1;
             packet := CreatePacket(0xBF, 9);
             packet.SetInt16(1,0x0009);
             packet.SetInt16(3,0x0002);
             packet.SetInt32(5,newkey);
             packet.SendPacket(who);
             shackwarning := CInt(GetObjProperty(who, "#shackwarning"));
             SetObjProperty(who, "#moves", CInt(GetObjProperty(who, "#moves")-1));
             var shackstack := GetObjProperty(who, "#shackstack");
             shackstack.append(newkey);
             SetObjProperty(who, "#shackstack", shackstack);
             set_critical(0);
             if (shackwarning)
                  SetObjProperty(who, "#shackwarning", shackwarning-1);
                  if (shackwarning > 5)
                       Print(who.name + " is getting excessive speedhack warnings!");
                       SetObjProperty(who, "#shackwarning", CInt(0));
                  endif
             endif
        endwhile
        SetObjProperty(who, "#shackwarning", CInt(0));
        EraseObjProperty(who, "#movepid");
       
endprogram


antispeed.src
Code:
use uo;
use os;
use polsys;
use unicode;
use util;

program AntiSpeedHack()
        Print("PacketHooks - Anti SpeedHack" );
        return 1;
endprogram

exported function HandleSpeedHackers(character, byref packet)

        var direction := packet.GetInt8(1);
        var shackcheck := packet.GetInt32(3);
        if ((character.facing != direction) && (character.facing != (direction - 128) ))
             //Changed facing, send a new key since this isn't really a move
             //var newkey := RandomInt(0x4000000000000)+1;
             //var sstack := GetObjProperty(character, "#shackstack");
             //sstack[6] := newkey;
             //SetObjProperty(character, "#shackstack", sstack);
             var packet := CreatePacket(0xBF, 9);
             packet.SetInt16(1,0x0009);
             packet.SetInt16(3,0x0002);
             //packet.SetInt32(5,newkey);
             packet.SetInt32(5, shackcheck);
             packet.SendPacket(character);
             return 0;
        endif

        var sstack := GetObjProperty(character, "#shackstack");
        var moves := CInt(GetObjProperty(character, "#moves"));

        if(shackcheck and shackcheck in sstack and moves < 6)
             var newstack := array;
             foreach num in sstack
                  if (num != shackcheck)
                       newstack.append(num);
                  endif
             endforeach
             SetObjProperty(character, "#moves", moves+1);
             SetObjProperty(character, "#shackstack", newstack);
             if (!GetObjProperty(character, "#movepid"))
                  Start_Script("antispeedhelper", character);
             endif
        else
             SendSysMessage(character, "Too fast");
             SetObjProperty(character, "#shackwarning", GetObjProperty(character, "#shackwarning")+2);
             var reject := CreatePacket(0x21, 8);
             reject.SetInt8(1, packet.GetInt8(2));
             reject.SetInt16(2, character.x);
             reject.SetInt16(4, character.y);
             reject.SetInt8(6, direction);
             reject.SetInt8(7, character.z);
             reject.SendPacket(character);
             return 1;
        endif

        return 0;
       
endfunction


antispeed.src is the one I have worked the most with, trying the change the upper time (80 and 160) to see hot the client would react.
I should add that the original pkg did not work, so I had to make a few modification on the original design.

_________________
When was the last time, you did something for the first time?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 11:13 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
My originals didn't work? Maybe I changed something since working with it last... I know when I actually last used it on my shard it would be fine until a certain number of people would log on then the shard sysload would start going up and everyone would get bogged down by that hook.

My shard has been under a total rewrite and I actually don't use that system anymore. Now I just have a counter on the script and it logs how many moves you've done while another script loops through everyone every second and logs how many moves you did against how many possible moves. My staff can see the last 5 minutes of moves to track people. At least it doesn't lag my shard anymore.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 12:42 pm 
Offline

Joined: Tue Mar 27, 2007 6:30 am
Posts: 24
CWO wrote:
if you dont send the deny then how are you slowing the movement or are you just logging it? The scripts I put up are designed to stop the movement from going too fast period. If you don't send either the accept or deny packets, either you'll hang up the client making it think its lagging or the client and server go out of sync.

If the client works correctly (i.e. it's not modified in any way, like for example by enabling "smooth walk" in injection), it will not go more than 3 steps "in advance" from the server responses.
They will not go out of sync if you properly queue the too-early-incoming packets.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 5:47 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
Thats what I was saying, the deny packet is the only way to say to the client that you can not move so you wont advance faster than you should. By not sending either, you're imitating lag which smoothwalk will override. This will just start causing problems later because the client and server aren't at the same spot. With the deny packet, you focus the client back to that spot so even with smoothwalk, you'll be forced back to that spot. This prevents severe jumping from another client's point of view. Now if someone blocks deny packets, the client will be farther forward than the server wants which would likely cause a sync error and disconnection.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 9:35 pm 
Offline

Joined: Tue Mar 27, 2007 6:30 am
Posts: 24
If the client uses smoothwalk, he deserves to be disconnected, so I don't see that as a problem ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 10:09 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
People complained about how smoothwalk was screwed up (it was being stopped in some instances) by the way I was doing it and they weren't getting disconnected at all. You're gonna start seeing a lot of smoothwalkers coming out of the woodwork complaining of lag after a while.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 11:49 pm 
Offline

Joined: Tue Mar 27, 2007 6:30 am
Posts: 24
I don't understand your point of view... The Smoothwalk function of injection is a "experimental" helper for some people who have bad connection and/or some other problems with lag. What it does is give the client automatically a positive answer to walkrequest packets. So it's "out of sync" by definition, because it doesn't wait for the server answer at all. In other words it automatically counts with the server approving all the walkrequests, so it will be far more affected by the system that actually sends walkdeny packets in case of speeding, than with my system that simply slows down the movement of given client on the server (and for other clients).


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 31, 2007 8:51 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
But you send the deny and make it resync at that spot. The client should do it after you send the deny for moving too fast. But thats also why I give them 6 moves in my hook instead of 4 which is the max the client will buffer. This kinda lightens it on smoothwalk.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl