[Include] GUIS - Prevent people from hacking your server (Updated v1.2)
#1

GUIS - GUI Security PAWN Library v1.3

What is GUIS?
GUIS is a few-lines-of-code PAWN Library which fixed a SA-MP bug where players could change their dialogid. In SA-MP dialogid is not server-side nor checked by server-side later. To change your dialogid which is stored in your computer memory you can hack it with programs like Cheat Engine but thats not what this topic is about and I won't write more about it.

So how do I use it?
Well ofcourse firstly you need to download it. Download links are at the bottom of the post. After you get it, put it in pawno/include directory. In your gamemode & filterscripts you add:
pawn Код:
#include <GUIS>
Is it compatible with Gamer_Z's FDLG?
Ofcourse it is. Just put my include before his and you should be ok.


Functions!

pawn Код:
native ShowPlayerDialog_Old(playerid, dialogid, style, caption[], info[], button1[], button2[]);
If you're using this library I'm sure you would not use this function but it still exists. This is an old ShowPlayerDialog function.

pawn Код:
native ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
Same function and params as before, just runs some more of the code now.

pawn Код:
native GetPlayerDialogID(playerid);
Gets player's real dialogid, not the one which is his/her computer memory.

pawn Код:
native HidePlayerDialog(dialogid);
Hides current player dialog, just felt like it to add this.


Callbacks!

pawn Код:
forward OnPlayerChangeDialogID(playerid, dialogid, newdialogid);
Called when player presses one of the GUI buttons and his/her dialogid is different than the one in server memory. Can be also called when a filterscript is not using GUIS so be careful. When returned 0, OnDialogResponse will not be called and player's server-sided dialogid will not be updated as well (can be done manually).


Download!
v1.3
Direct Link (I514X.TK)
v1.2
Direct Link (I514X.TK)
Earlier versions are not to be used due to bugs/crashes and instability.

All credits are in the code!

regards, i514x.
Reply
#2

Interesting. Would it be compatible with https://sampforum.blast.hk/showthread.php?tid=260298 ?
Reply
#3

lol u made this by watching a tutorial! BTW nice atleast u tried!
Reply
#4

Quote:
Originally Posted by MisterTickle
Посмотреть сообщение
Interesting. Would it be compatible with https://sampforum.blast.hk/showthread.php?tid=260298 ?
creating the dialog is the same, and every dialog response needs to be detected from OnDialogResponse callback so if u put
pawn Код:
#include <GUIS>
before Gamer_Z's include you should be ok

@edit

Quote:
Originally Posted by TheRockstar 2
Посмотреть сообщение
lol u made this by watching a tutorial! BTW nice atleast u tried!
what tutorial lol?
Reply
#5

Quote:
Originally Posted by TheRockstar 2
Посмотреть сообщение
lol u made this by watching a tutorial! BTW nice atleast u tried!
link?

I can say he made it on his own + I checked and this bug works.
The offsets I use are:
"samp.dll"+001F76BC + 0x30 - DialogID
"samp.dll"+001F76BC + 0x28 - Dialog on/off
some offsets on the internet didn't work So I had to search for the pointer on my own.
Reply
#6

Does the SA-MP team know about this vulnerability? Well, thanks for letting me know about this, I will use this library!
Reply
#7

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
Does the SA-MP team know about this vulnerability? Well, thanks for letting me know about this, I will use this library!
In SA-MP most of the things can be edited in client memory so I think Kalcor knows. But thats not important no more as this fixes everything
Reply
#8

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    new server_dialogid = GetPVarInt(playerid, "GUIS_ID");
    if(server_dialogid != dialogid)
        dialogid = server_dialogid;
}
I am sure GUIS_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]); will not be called with this code.
Reply
#9

It should not be called with this code

This code allows the scripter to use OnDialogResponse callback and me to add something before it.
Reply
#10

There is no point in the include then, as it breaks the functionality of dialog callbacks.
If you put this include in a script, it will not work, because Filterscript's OnDialogResponse will not be called.

Solution:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    new server_dialogid = GetPVarInt(playerid, "GUIS_ID");
    if(server_dialogid != dialogid)
        dialogid = server_dialogid;
    if (funcidx("GUIS_OnDialogResponse") != -1) return CallLocalFunction("GUIS_OnDialogResponse", "dddds",
    playerid, dialogid, response, listitem, inputtext);
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)