How to deal with Flee Tools/Pos Hacks

Post Reply
bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

How to deal with Flee Tools/Pos Hacks

Post by bluesolarflare » Tue Dec 20, 2016 6:03 pm

Is there any way to help prevent the usage of Flee Tools and POS hacks on a server other than catching players and jailing them? And are there any flags that can be enabled or created in the core to help find players who are participating in the use of these tools?

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: How to deal with Flee Tools/Pos Hacks

Post by whasf » Tue Dec 20, 2016 8:47 pm

no, nothing yet :(
-- Whasf

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: How to deal with Flee Tools/Pos Hacks

Post by bluesolarflare » Wed Dec 21, 2016 2:21 pm

Thanks, I guess the only thing is just to watch the Zone messages and then if they are going from Zone A to B to C too quickly, just to write it down and then send a /tell via GM to let them know not to do it again. :(

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: How to deal with Flee Tools/Pos Hacks

Post by bluesolarflare » Tue May 02, 2017 2:48 pm

As more people start moving away from Windower and onto Ashita, I see this as becoming more prevalent on private servers. I tried a few things but it looks like certain tools like Flee Tools modify the position packet and not the actual speed variable for the character as speed is reported normally by the server. I can't see any way to far to detect other than having a GM be on the lookout visually for people doing it.

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: How to deal with Flee Tools/Pos Hacks

Post by TeoTwawki » Thu May 04, 2017 5:25 pm

As more people start moving away from Windower and onto Ashita
Has nothing to do with which windowing app you use, most tools I've seen are not dependent on either, the few that are could easily be ported between them, ppl who wan to do these things will find a way.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

nasomi
Posts: 141
Joined: Wed Feb 13, 2013 8:51 am

Re: How to deal with Flee Tools/Pos Hacks

Post by nasomi » Fri May 05, 2017 10:15 am

This won't fix the problem, but it's 100% detectable with this. There are some exceptions I haven't taken into account such as portals that will throw false positives, but after looking at the data for a bit you'll see it's fairly good at getting most people. I can't guarantee it'll work out of the box with the most recent dsp build, but it should get you most of the way there.

Image

Open mmo.h and find position_t and make it look like this:

Code: Select all

struct position_t 
{
	uint8 rotation;			// угол поворота сущности относительно своей позиции (используется 255 система, место 360°)
	float x;			
	float y;				// высота расположения сущности относительно "уровня моря"
	float z;
	float px;
	float py;
	float pz;
	int16 zone;

	uint16 moving;			// что-то вроде расстояния перемещения, необходимое для правильной отрисовки в клиенте количества шагов сущности 
};
Open time_server.cpp and right after this line:

Code: Select all

    uint8 WeekDay = (uint8)CVanaTime::getInstance()->getWeekday();
Add this block:

Code: Select all

	zoneutils::ForEachZone([](CZone* PZone)
	{
		luautils::OnGameTick(PZone);
		const int8* fmtQuery = "update server_status set tick = unix_timestamp(now()) where zoneid = %i";
		Sql_Query(SqlHandle, fmtQuery, map_port-56000);
		
		PZone->ForEachChar([](CCharEntity* PChar)
		{
			float x = PChar->loc.p.x;
			float y = PChar->loc.p.y;
			float z = PChar->loc.p.z;
			float px = PChar->loc.p.px;
			float py = PChar->loc.p.py;
			float pz = PChar->loc.p.pz;
			float d = sqrt(pow((x - px), 2) + pow((z - pz), 2));
			if (PChar->loc.p.zone != 1 && d /2.4*10 > 60 && PChar->animation != ANIMATION_CHOCOBO && !PChar->StatusEffectContainer->HasStatusEffect(EFFECT_FLEE))
			{
				const int8* fmtQuery = "INSERT INTO speed values (%u, '%s',%u,'%.3f',concat('%.3f',' ','%.3f',' ','%.3f','|','%.3f',' ','%.3f',' ','%.3f'),now());";
				Sql_Query(SqlHandle, fmtQuery, PChar->id,PChar->GetName(),map_port-56000,d/2.4*10,x,y,z,px,py,pz);
				ShowDebug(CL_YELLOW"%s's speed to high: %.3f\n" CL_RESET,PChar->GetName(), d / 2.4 * 10);
			}
			if (PChar->loc.p.zone != 1 && d / 2.4 * 10 > 100 && PChar->animation == ANIMATION_CHOCOBO)
			{
				const int8* fmtQuery = "INSERT INTO speed values (%u, '%s',%u,'%.3f',concat('%.3f',' ','%.3f',' ','%.3f','|','%.3f',' ','%.3f',' ','%.3f'),now());";
				Sql_Query(SqlHandle, fmtQuery, PChar->id, PChar->GetName(), map_port - 56000, d / 2.4 * 10, x, y, z, px, py, pz);
				ShowDebug(CL_YELLOW"%s's Chocobo is on fire! %.3f\n" CL_RESET, PChar->GetName(), d / 2.4 * 10);
			}
			if (PChar->loc.p.zone == 1)
			{
				ShowDebug(CL_YELLOW"%s zoned, ignoring speed, unzoning.\n" CL_RESET, PChar->GetName());
			}
			PChar->loc.p.px = PChar->loc.p.x;
			PChar->loc.p.py = PChar->loc.p.y;
			PChar->loc.p.pz = PChar->loc.p.z;
			PChar->loc.p.zone = 0;
		});
	});
In lua_baseentity.cpp find setPos( and after

Code: Select all

    if (m_PBaseEntity->objtype == TYPE_PC)
    {
add

Code: Select all

		m_PBaseEntity->loc.p.zone = 1;
In lua_baseentity.cpp add this block which you can put in lua scripts to prevent false positives when a script warps them such as portals:

Code: Select all

inline int32 CLuaBaseEntity::setZoneFlag(lua_State *L)
{
	m_PBaseEntity->loc.p.zone = 1;
}
Under charutils.cpp for loadchar add this:

Code: Select all

		PChar->loc.p.zone = 1;
Open your db and create a table:

Code: Select all

create table speed2 (charid int(10),charname varchar(30),zone smallint(6),speed varchar(10), pos varchar(300),time datetime);

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: How to deal with Flee Tools/Pos Hacks

Post by whasf » Fri May 05, 2017 4:47 pm

you're storing the values in the db? Why? You only need them while they're in that zone. Why can't you add it to the player controller and check every tick or something?
-- Whasf

nasomi
Posts: 141
Joined: Wed Feb 13, 2013 8:51 am

Re: How to deal with Flee Tools/Pos Hacks

Post by nasomi » Fri May 05, 2017 8:57 pm

I am storing it in the player controller, and check every tick. It's only stored in the database if they break the speed.

Code: Select all

         float x = PChar->loc.p.x;
         float y = PChar->loc.p.y;
         float z = PChar->loc.p.z;
         float px = PChar->loc.p.px;
         float py = PChar->loc.p.py;
         float pz = PChar->loc.p.pz;
         float d = sqrt(pow((x - px), 2) + pow((z - pz), 2));
loc px, pz, x, z stored. Previous x, previous z, current x, current z. Then calculates the distancance between the two points.

That's why they need the updated position_t to store the additional positions. You'll see at the end px, py, pz are updated to store current x, y, z.

Since this is recorded every 2.5 seconds:
if (PChar->loc.p.zone != 1 && d /2.4*10 > 60 && PChar->animation != ANIMATION_CHOCOBO && !PChar->StatusEffectContainer->HasStatusEffect(EFFECT_FLEE))

value d for distance /2.4*10 gives you speed ~40 with normal run. The threshold is 60 to allow for some wiggle room like lag/latency, and makes sure they're not on chocobo or fleeing. It also now has pchar->loc.p.zone so every time you zone it doesn't trigger what looks like a pos hax.

Post Reply