• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tool] denNorske's SA-MP Query Cache Proxy
#1
SA-MP Query Cache Proxy
(Made in python3.7)

Hosted tab servers are facing a massive spam of spoofed UDP packets. The servers simply have no chance to respond to all the fake query requests, and becomes overworked. This ends up with servers not appearing online in the samp client, and if they appear, lots of information don't appear.?
UPDATE: Attack has calmed down (14th of april 2019)

This package will take all the "shit" from the fake packages and respond with a cached response from the samp server. The proxy sends a request to the samp server every few second to cache latest info, which it so sends further to the client that requests it. This shields the samp server and makes it appear normally in everyone's clients. It has been tested on my community and some other servers, and the effect is very noticeable.?

Why python??
Well, python was the only other language besides PAWN and C# that I knew in 2019, and it was the only contribution I could make together with my friend Nick. Now that I also know a bit of C, Javascript and such, but considering it works so well, it's fair enough to say that it may remain using python.

This project is written by frxstrem, nick and me, and everyone's welcome to contribute with better solutions by creating pull requests from separate branches. It has been tested under load of a UDP spam on approximately 3500 pps. It takes up one entire thread of a CPU on a I7-8700k.

Unfortunately, this method will only work on VPS's/VDS's where you have full access to the host system. Python code requires iptables rules to be applied.



How to run the python script in background;?
1:
Code:
python3 pack-scan.py &
2:Then use:
Code:
detach
to avoid it closing with the terminal, when you leave the SSH session, or close the terminal.



Disclaimer: I am in no way responsible for misconfigurations or changes done by you. You should understand what iptables do and what my code do before you use it.

Query Mechanism information: Click here

READ ME: https://github.com/dennorske/samp-packet.../README.md

Known issues:?
  • Under load, script tends to stop working after approximately a week. You can set up a simple bash script to restart it automatically (Fixed March 19th 2021)
  • game-state and SACNR monitor queries are not responded correctly, causing graphs to not show or show incorrectly.

Visual of the Query mechanism with the script running (Assuming iptables works correctly) :
[Image: 68747470733a2f2f706963732e6475636b792e72...322e706e67]


LINK TO REPOSITORY/Download https://github.com/dennorske/samp-packet-proxy


Disabling the cache/removing IPtable rules:
In order to remove the rules you've added from IPtables, please replace "-A" or "-I", with "-D" in the commands.
You need to make sure you write the exact same commands, else it will fail. (if you changed ports, use those ports, and replace -A with -D for example)
  Reply
#2
I'm going to try this right now, wonderful.
[Image: oN9R4KR.gif]

Away
  Reply
#3
did u do that yourself? that nice drawing?

i'm just wanna inform u that ur handwriting is ugly af..

anyways nice project, rep.
Support open.mp to make Big Smoke back to life.



My works:-

[Map]?Area 51 |?Desert Airport.?
  Reply
#4
Heart 
(2019-04-15, 12:02 PM)iChiwi_. Wrote: did u do that yourself? that nice drawing?

i'm just wanna inform u that ur handwriting is ugly af..

anyways nice project, rep.

Aw you suck too ;)?Thanks for the nice words <3

My ugly handwriting is at least scaring away all them ugly packets!
  Reply
#5
Thank you!!!
1v1?BewZ?Deathmatch

IP:?server.bewz.net:7777

https://www.bewz.net/

  Reply
#6
A truly fantastic application, saved our ass and those of many others.
  Reply
#7
(2019-04-17, 05:23 PM)Markski Wrote: A truly fantastic application, saved our ass and those of many others.



Thanks, I am glad it did help you!
  Reply
#8
wonderful, I'll use it, thanks!
  Reply
#9
Hi all!

There's a new update to fix a few pretty fundamental issue.

When your server reached a certain playercount, the script would freeze.
This is now sorted. If you had issues with the script and that it stopped working after a while, this update should take care of that for you. No need to restart the script every few days anymore.

I've also added some even spacing between the querythread packets (between the server and the script), as sending all 4 simultaneously would just result in socket timeouts.

Let me know if you find any other issues.
I might release a new update soon to help you automate the iptables setup and removal upon start and stop, using systemd.
  Reply
#10
Updated the repo with a better readme, new diagram (as the old one disappeared), and refactored the code to prevent some bugs concatinating strings and bytes together, throwing errors.

Read the new readme on the repo; https://github.com/dennorske/samp-packet...ree/master
  Reply


Forum Jump: