A3Armory / A3A_A3Wasteland.Altis

A3Wasteland is a survival sandbox mission for Arma 3 where two teams and independent players fight for survival. Built in collaboration between GoT, TPG, KoS, 404Games, and others.
http://a3wasteland.com
GNU Affero General Public License v3.0
9 stars 6 forks source link

Help with teleport logger #17

Closed Gigatek1 closed 7 years ago

Gigatek1 commented 7 years ago

With help from Dscha on the BIS discord I was able to get a teleport logger working.

> {
>   while{true}do
>   {
>       player setVariable ["Pos",(getPosWorld player)];
>       uiSleep 2;
>       if( (getPosWorld player) distance (player getVariable "Pos") > 200) exitWith {player setVariable ["tp_log", true, true];};
>   };
> } forEach allPlayers - entities "HeadlessClient_F";

I'm looking for the best place to put it with out false positives. playerSpawn.sqf only works for fresh spawns. I have been putting it here. Where's the best place I can put this with out triggering it with legit spawns? I'm really getting sick of dealing with teleporting script kiddies.

ghost commented 7 years ago

What about taking it back a step to the client init??

if(hasInterface) then{ xxxxx };

Gigatek1 commented 7 years ago

It will trigger when the player gets moved from spawn island. Need to figure out some timeout for it.

Gigatek1 commented 7 years ago

It works for fresh spawns at the end of playerSpawn.sqf

ghost commented 7 years ago

Even fresh spawns start on the debug island so not sure at the mo but will have a think

Dscha commented 7 years ago

The Code above won't rly work.

Try something like that (written in 2min, its untested, can't test since no Arma installed :D)

//into an init.sqf, on the Server:

[] spawn
{
    uisleep 30; //delayed start on the Server
    while{true}do
    {
        uiSleep 2;  //no need to execute that every Frame. waiting longer could be better.
        {
            _OldPos = (_x getVariable "Pos");
            _Dist = (getPosWorld _x) distance _OldPos;
            if( _Dist > 200) then
            {
                _x setVariable ["tp_log", true, true];  
                diag_log format["::: DISTANCE LOG: Player: %1 | Distance: %2", name _x, _Dist ];    //Log it to the .rpt File
                _x setPosWorld _OldPos; //Teleports that sneaky MoFo back to its old Pos (check if he was Respawning needed, but thats what you guys have to do ;) )
            };
            _x setVariable ["Pos",(getPosWorld _x)];
        }forEach allPlayers - entities "HeadlessClient_F";
    };
};```
Gigatek1 commented 7 years ago

Nice, I'll test this soon.

Gigatek1 commented 7 years ago

I couldn't get the supplied code to work so I kind of reverted back to the old way. Kept getting undefined variable for OldPos and _x.

I still can't get it to not flag a respawn. I cant figure out how to make it work only when alive and not spawning. https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/baa0030962b8a2e979b8aaf4d9ca08f9f052e5b2 @AgentRev Can you please look at this and tell me what you would do and where you would place it? Please when you have a moment.

AgentRev commented 7 years ago

I wouldn't place it anywhere because a while true WILL return false positives.

Gigatek1 commented 7 years ago

How would you do it? False positives aren't that bad if you know what your looking at. I did go through a mountain of remote exec logs to find that head shot script kiddie. I just want a idea of who's moving around the server a lot.

AgentRev commented 7 years ago

Put a getVariable "playerSpawning" check and chuck it wherever you want

Gigatek1 commented 7 years ago

I'll give it a go. I was hoping to using something else or move "playerSpawning" to a server set variable atleast, then kick in the filters for "playerSpawning". I'll take a break now and set aside a few hours tomorrow for working on this.

AgentRev commented 7 years ago

move "playerSpawning" to a server set variable

You could with EntityRespawned, but I did not test that event yet

Gigatek1 commented 7 years ago

Oh yeah good idea. I'll let you know how it works.

Gigatek1 commented 7 years ago

Here's my shitty attempt at it. It doesn't work. Please let me know if I missed anything if you have the time. https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/8ad6d8d263aa9087cca836cdfff39a4ad086c9fb

AgentRev commented 7 years ago

lol you don't put the tracker code in the event, you put the setVariable playerSpawn... You do need an external while true for tracking

Gigatek1 commented 7 years ago

I see lol. I'll try again in a bit. After looking into this again and just looking at the news I need a drink and a bong rip.

AgentRev commented 7 years ago

http://i.sli.mg/2ueIUi.gif

AgentRev commented 7 years ago

MAGA

Gigatek1 commented 7 years ago

I think the US just trolls the whole world and this is it's swan song.

AgentRev commented 7 years ago

from /r/EnoughTrumpSpam :

Trump is the baby boomers last "fuck you" to society on their way out

Gigatek1 commented 7 years ago

lol

Gigatek1 commented 7 years ago

Couldn't sleep, tried one more time. Still not working but I will try and make it work tomorrow.

https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/4d9ce24ac30320127a7a2c3b6e3b648208613c71

Gigatek1 commented 7 years ago

Mission event handlers "EntityKilled" and "EntityRespawned" do not seem to work. I tried this but got nothing.

if (isServer) then { addMissionEventHandler ["EntityKilled", { diag_log format ["test123 Killed %1", _this] }]; addMissionEventHandler ["EntityRespawned", { diag_log format ["test123 Respawned %1", _this] }]; };

Do I need to add this stuff like you talked about in this topic AgentRev? https://forums.bistudio.com/topic/190773-mission-event-handlers-playerconnected-and-playerdisconnected-do-not-work/ Like done here. https://github.com/A3Armory/A3A_A3Wasteland.Altis/blob/dev/server/init.sqf#L185-L188

AgentRev commented 7 years ago
2016/11/12, 14:37:27 "test123 Respawned [B Bravo 1-1:1 (AgentRev) REMOTE,13bf8080# 1813635: b_soldier_01.p3d REMOTE]"

works for me

Gigatek1 commented 7 years ago

Cool. Where did you put it and can you copy paste the code if you wrote it and didn't copy paste it. I couldn't get it to work. Do you see anything wrong in the code I wrote?

AgentRev commented 7 years ago

next to handledisconnect

Gigatek1 commented 7 years ago

Thanks for the help man. I'll try to get this to work later today. I have been kind of over it because it was frustrating me and I have been busy. I have spent no joke probably 4 solid hours trying to get this whole thing to work. I want to share it with other owners sick of script kiddies fucking with their community's too.

Gigatek1 commented 7 years ago

Can't figure out how to get this not to trigger on respawn. If anyone can please help this not trigger some how please help. I have spent way too much time on this. https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/c9e551a030cac52a6521c64ae84a2a5039a409c0

Gigatek1 commented 7 years ago

I give up. I tried but I'm not a coder and never will be. I'm going to take a break from all this. I swear if I get one more report about floating base parts or teleporting players I'm going to go fucking nuts.

Here's my last attempt. I have know idea how to set the variable after the setpos. What a waist of time. Won't do this again. https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/2aedabe29a8ab340aac4262c833a58502c0b93ee

AgentRev commented 7 years ago

smh...

if (isServer) then
{
    addMissionEventHandler ["EntityRespawned",
    {
        params ["_unit"];
        _unit setVariable ["playerSpawning", true];
        _unit setVariable ["fm_pos", nil];
    }];

    0 spawn
    {
        while {true} do
        {
            {
                if !(_x getVariable ["playerSpawning", true]) then
                {
                    _oldPos = _x getVariable "fm_pos";
                    _newPos = getPosWorld _x;

                    if (!isNil "_oldPos" && {_newPos vectorDistance _oldPos > 1000}) then
                    {
                        _x setVariable ["fm_log", true, true];
                    };

                    _x setVariable ["fm_pos", _newPos];
                };
            } forEach allPlayers;

            uiSleep 1;
        };
    };
};

Put this at the bottom of server\init.sqf, remove all your previous stuff.

You won't learn if you don't keep trying...

Gigatek1 commented 7 years ago

Thanks man, I know and I feel the same. I have just spent to much time on this. I was at this at 5am pst until now plus the other few hours. There's only so much I can take :smiley: . It might not look like it but I really don't know how a lot of this stuff works. There's only so much code I can copy. Most the time it's stuff from A3W and BIS examples. A3W is a really good source for code and even for learning different coding styles.

Gigatek1 commented 7 years ago

It's not working for some reason Agent. I hope I didn't overlook anything like the event handler last time. I think fm_log has to be set client side too. I'll try some more tomorrow.

AgentRev commented 7 years ago

I don't know what you're doing with fm_log but it definitely works for me.

Gigatek1 commented 7 years ago

This is what I did. https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/92c648f1ad4e71534c1161ee91605eb6528a75c4 Here's my setVariable log for 2 respawns and a few teleports. I will filter out the other variables later. The only one showing is playerspawning but that's set elsewhere as well.

13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_isunconscious" = 0 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_isstabilized" = 0 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_iconblink" = any 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_draggedby" = any 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_isdragging" = any 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_treatedby" = any 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_cancelautoeject" = any 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_handlestabilize" = any 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "cmoney" = 0 2:791 B_medic_F
13.11.2016 13:51:53: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "mf_inventory_list" = [["cannedfood",1,"Land_BakedBeans_F"],["water",1,"Land_BottlePlastic_V2_F"],["energydrink",0,"Land_Can_V3_F"],["repairkit",1,"Land_SuitCase_F"],["jerrycanempty",0,"Land_CanisterFuel_F"],["jerrycanfull",0,"Land_CanisterFuel_F"],["syphonhose",0,"Land_CanisterOil_F"],["spawnbeacon",0,"Land_Sleeping_bag_folded_F"],["camonet",0,"Land_Ground_sheet_folded_OPFOR_F"],["warchest",0,"Land_SuitCase_F"],["lsd",0,"Land_WaterPurificationTablets_F"],["marijuana",0,"Land_VitaminBottle_F"],["cocaine",0,"Land_PowderedMilk_F"],["heroin",0,"Land_PainKillers_F"]] 2:791 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_killerprimesuspectdata" = any 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_isunconscious" = 0 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_isstabilized" = 0 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_iconblink" = any 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_draggedby" = any 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_isdragging" = any 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_treatedby" = any 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_cancelautoeject" = any 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "far_handlestabilize" = any 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "r3f_log_disabled" = false 2:791 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "newrespawnedunit" = B Alpha 4-2:1 (Towley) REMOTE 2:791 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "playerspawning" = true 3:13 B_medic_F
13.11.2016 13:52:08: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "a3w_corpseejected" = any 3:13 B_medic_F
13.11.2016 13:52:11: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "cmoney" = 2500 3:13 B_medic_F
13.11.2016 13:52:11: Towley (192.168.1.240:2304) f4799cde6772e4df0cf119b971ccfcf6 - #14 "playerspawning" = false 3:13 B_medic_F
Gigatek1 commented 7 years ago

The filter I'm using.

// A3Wasteland - setVariable.txt BattlEye filters by AgentRev

5 "^A3W_((antiExplodeLocal|dammaged|engine|handleDamage|respawn)EH|atmEditorPlaced|missionMarkerName|(object|vehicle)(ID|Saved))"
5 "^A3W_(purchasedStoreObject|storeSellBox)"
5="BIS_fnc_MP_queue"
//5="bounty(Kills)?"
5="BuildingLoot"
5="captureTriggerMarker"
5 "^fpsFix_(eventHandlers|simulationCooloff)"
5="Lootready"
5="objSaving_lastSave"
5="parked_vehicles"
5="private_storage"
5="spawnBeacon_lastUse"
5 "^storeNPC_(face|nearestBuilding|setupComplete)"
5 "^Town_\d+_lastSpawn"
5 "^vehSaving_(hours(Alive|Unused)|last(Save|Use)|spawningTime)"
1 ""
AgentRev commented 7 years ago

The setVariable is done on the server. It will not show up in the BE logs. I assumed you had another script to read fm_log and chuck entries in the DB or something.

Gigatek1 commented 7 years ago

No fm_log needs to be set client side so I can log, kick, or ban if I want. Chucking entries in the DB is a bit much for me. setvariableval.txt could even be useful in this situation too.

Gigatek1 commented 7 years ago

Trying to get any of these 3 logs working. Got the notify admin one kind of working but need to set it up right. Any help if you have the time and feel like it, would be appreciated.

// Fast movement log
if (isServer) then
{
    addMissionEventHandler ["EntityRespawned",
    {
        params ["_unit"];
        _unit setVariable ["playerSpawning", true];
        _unit setVariable ["fm_pos", nil];
    }];

    0 spawn
    {
        while {true} do
        {
            {
                if !(_x getVariable ["playerSpawning", true]) then
                {
                    _oldPos = _x getVariable "fm_pos";
                    _newPos = getPosWorld _x;

                    if (!isNil "_oldPos" && {_newPos vectorDistance _oldPos > 735}) then
                    {
                        _x setVariable ["fm_log", true, true];
                        [name _x, getPlayerUID _x, "fast movement"] call A3W_fnc_flagHandler;
                        [[name _x, getPlayerUID _x, "fast movement2"], "A3W_fnc_clientFlagHandler", _x, false] call A3W_fnc_MP;
                        [name _x, getPlayerUID _x, "fast movement3"] call notifyAdminMenu;
                    };

                    _x setVariable ["fm_pos", _newPos];
                };
            } forEach allPlayers;

            uiSleep 2;
        };
    };
};
Gigatek1 commented 7 years ago

https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/42ea969f91367c9873f738aa633c7dcda43f629b Got it done and moved it over to the dev repo. If any one can help me define KickOnJoin to 0 in the antihacklog sql table please do. Right now I have to set the KickOnJoin to default to 0 to avoid false positive flags and admin panel use flags that will result in in game bans. https://github.com/A3Armory/A3A_A3Wasteland.Altis/blob/dev/server/init.sqf#L592-L593

AgentRev commented 7 years ago

you would need to edit the addAntihackLog extDB function and edit the logAntihack function

Gigatek1 commented 7 years ago

I'll try that this weekend, thanks man. I'm only running this on one of the low population servers but I'm getting some false positives with higher latency players. I set newPos to the hack value for logging and they are all on spawn island. I was thinking a better approach might be setting the spawn location as a server setVariable, filter that in the battleye filters to kick if set client side then use a check for that setVariable (spawn) within 50 meters, then run the position change check.

Dose this make sense to anybody? I will probably need some help with the implementing this.

AgentRev commented 7 years ago

Your values are too relaxed. Do 1000m/1sec

Gigatek1 commented 7 years ago

Will do. I was hoping for less loops maybe. Thanks man

Gigatek1 commented 7 years ago

This is what i was talking about earlier. This way its not dependent on a client set variable playerSpawning. I don't know why but when I changed playerSpawning to something else in the 2 spots it's at in this code the check didn't work. I will also try to add something like this to the persistence player load to prevent loads around spawns. I know micovery did something like this in sock so I will check there. https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/c527a894afa1cebefe61ecffaf5f736a357433f3 I still need to see if this works with some testing though.

Gigatek1 commented 7 years ago

Gave up on the location check because I couldn't get it to work and I think I have a better way. I want to set a variable value to kick so players can't set playSpawning to true to bypass the check for spawn.

This works fine. https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/42965ee62008b1401dbe977fb50225c9e2bcaa3f

How do I get this to work? For some reason I cant set anything other than true. https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/80e46e23e2e0c944da825ec21d5c775eb470df64 It seems so simple and I have tried many things over the past couple hours. Please help with this when convenient.

pAxton- commented 7 years ago

why not start the loop after respawn/spawn and stop on death... Don't mean to be a C in a AB conversation and by the way... The Wall just got 10 feet higher!

On Wed, Nov 16, 2016 at 4:43 PM, Gigatek notifications@github.com wrote:

Gave up on the location check because I couldn't get it to work and I think I have a better way. I want to set a variable value to kick so players can't set playSpawning to true to bypass the check for spawn.

This works fine. 42965ee https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/42965ee62008b1401dbe977fb50225c9e2bcaa3f

How do I get this to work? For some reason I cant set anything other than true. 80e46e2 https://github.com/A3Armory/A3A_A3Wasteland.Altis/commit/80e46e23e2e0c944da825ec21d5c775eb470df64 It seems so simple and I have tried many things over the past couple hours. Please help with this when convenient.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/A3Armory/A3A_A3Wasteland.Altis/issues/17#issuecomment-261081800, or mute the thread https://github.com/notifications/unsubscribe-auth/AGFZ5V27MUlhqpbg1rGE06295EB-ROHZks5q-3kWgaJpZM4Kr0Iv .

Gigatek1 commented 7 years ago

It already does that I think. The loop starts a spawn. Just need a way to make sure the movement from spawn island to your saved position isn't flagged.

pAxton- commented 7 years ago

start the loop after the setPos is called

On Thu, Nov 17, 2016 at 6:09 PM, Gigatek notifications@github.com wrote:

It already does that I think. The loop starts a spawn. Just need a way to make sure the movement from spawn island to your saved position isn't flagged.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/A3Armory/A3A_A3Wasteland.Altis/issues/17#issuecomment-261399373, or mute the thread https://github.com/notifications/unsubscribe-auth/AGFZ5aIqwETbZjGFH-ZvuAmKGErWLgEmks5q_N7CgaJpZM4Kr0Iv .

Gigatek1 commented 7 years ago

Yeah I'm just not sure how I would do that.

Gigatek1 commented 7 years ago

It's called through client scripts which isn't good and there's like 4. Random, town, beacon etc