HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*************************** Ingame remote rcon control ************* ********
  2. Ingame remote rcon control ( yes it's an useless plugin )
  3.  
  4. This plugin is a short implemenation of the hlds rcon protocol
  5.  
  6. Idea : Alka ;) He wanted this plugin ... even if I tell him it's useless
  7.  
  8.  
  9. usage : amx_remote_rcon <ip> <port> <rcon> <command>
  10. ip & port = ip and port of the remote server
  11. rcon = rcon of the remote server
  12. command = command to execute, please use ""
  13.  
  14.  
  15.  
  16.  
  17. Note: The hlds rcon protocol is unsecure ... so I don't support this thing :)
  18.  
  19. Contact :
  20. mail: hackziner@gmail.com
  21. msn: hackziner@hotmail.com
  22. *******************************************************************************/
  23.  
  24.  
  25.  
  26. #include <amxmodx>
  27. #include <amxmisc>
  28. #include <sockets>
  29.  
  30. #define PLUGIN "Ingame remote server control"
  31. #define VERSION "0.1"
  32. #define AUTHOR "hackziner"
  33.  
  34. public plugin_init()
  35. {
  36. register_plugin(PLUGIN, VERSION, AUTHOR)
  37. register_concmd("amx_remote_rcon","Remote_RCON",ADMIN_BAN,"<ip> <port> <rcon jelszo> <parancs>")
  38. }
  39.  
  40.  
  41. public Remote_RCON(id,level,cid)
  42. {
  43. new sckRemoteServer
  44. if (!cmd_access(id,level,cid,2))
  45. return PLUGIN_HANDLED
  46.  
  47. new ip[32]
  48. new port[8]
  49. new rcon[32]
  50. new command[128]
  51. new cmd[255]
  52. new nothing[64]
  53. new rconid[32]
  54. new error
  55.  
  56. read_argv(1, ip, 31)
  57. read_argv(2, port, 7)
  58. read_argv(3, rcon, 31)
  59. read_argv(4, command, 128)
  60.  
  61.  
  62. sckRemoteServer = socket_open(ip,str_to_num(port), SOCKET_UDP,error) //csatlakozas a szerverhez
  63. format(cmd, 256, "%c%c%c%cchallenge rcon",255,255,255,255) //..
  64. socket_send2(sckRemoteServer, cmd,255) //parancs kuldese..
  65.  
  66.  
  67. if(socket_change(sckRemoteServer,500000 )) //Valaszra varas ( alapertelmezett beallitas 1masodperc )
  68. socket_recv(sckRemoteServer, cmd,255) //Csomag megszerzese
  69.  
  70. parse(cmd,nothing,63,nothing,63,rconid,31) // "\xff\xff\xff\xffchallenge" drop, "rcon drop", rconid catch
  71.  
  72. format(cmd, 256, "%c%c%c%crcon %d ^"%s^" %s ^n",255,255,255,255,str_to_num(rconid),rcon,command,255,255) //parancs formazasa..
  73. socket_send2(sckRemoteServer, cmd,255) //parancs kuldese...
  74.  
  75. socket_close(sckRemoteServer)
  76.  
  77. return PLUGIN_HANDLED
  78. }
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.