06/10/2022, 08:24 PM (Última modificación: 06/10/2022, 08:27 PM por Nacalau. Edited 1 time in total.)
(06/10/2022, 06:46 PM)MatiasGFaria escribió: hola ando buscando un complemente que bloquee las VPN/proxy. porque cansado de los chiteros que arruinan un juego de mas de 20 años y tienen vpn.
06/10/2022, 09:40 PM (Última modificación: 06/10/2022, 10:34 PM por Alejandro. Edited 2 times in total.)
Me intereso el codigo y lo pase a sockets para que no tengan que hacer uso de ninguna otra libreria o modulo.
De igual forma tambien optimice el codigo!
Código PHP:
#include <amxmodx> #include <sockets>
new g_Socket; new const g_host[]="blackbox.ipinfo.app";
public plugin_init() { register_plugin("[AMXX] Block VPN", "b2.1", "Alejandro-."); new iError; g_Socket = socket_open(g_host, 80, SOCKET_TCP, iError); if (iError) { log_amx("[AMXX] Sockets error: %i", iError); return; } } public client_authorized(index) { if (is_user_hltv(index) || is_user_bot(index)) return; new buffer[100], ip[MAX_IP_LENGTH]; get_user_ip(index, ip, charsmax(ip), 1); if(equal(ip, "loopback") || equal(ip, "127.0.0.1") || contain(ip, "192.168.") == 0 || contain(ip,"10.") == 0 || contain(ip,"172.") == 0) return; formatex(buffer, charsmax(buffer), "GET /lookup/%s/ HTTP/1.1^nHost:%s^r^n^r^n", ip, g_host); socket_send(g_Socket, buffer, charsmax(buffer)); set_task(1.0, "task_waitanswer", index + 1231, "", 0, "a", 15); } public task_waitanswer(taskid) { new index = (taskid - 1231) if (socket_is_readable(g_Socket)) { new data[1300]; socket_recv(g_Socket, data, charsmax(data)); if (!data[0]) { remove_task(taskid); return; } if (contain(data[strlen(data) - 2], "Y") != -1) { server_cmd("kick #%i ^"Proxy/VPN no permitido!^"", get_user_userid(index)); } remove_task(taskid); } } public plugin_end() socket_close(g_Socket);
(06/10/2022, 09:40 PM)Alejandro escribió: Me intereso el codigo y lo pase a sockets para que no tengan que hacer uso de ninguna otra libreria o modulo.
De igual forma tambien optimice el codigo!
Código PHP:
#include <amxmodx> #include <sockets>
new g_Socket; new const g_host[]="blackbox.ipinfo.app";
public plugin_init() { register_plugin("[AMXX] Block VPN", "b2.1", "Alejandro-."); new iError; g_Socket = socket_open(g_host, 80, SOCKET_TCP, iError); if (iError) { log_amx("[AMXX] Sockets error: %i", iError); return; } } public client_authorized(index) { if (is_user_hltv(index) || is_user_bot(index)) return; new buffer[100], ip[MAX_IP_LENGTH]; get_user_ip(index, ip, charsmax(ip), 1); if(equal(ip, "loopback") || equal(ip, "127.0.0.1") || contain(ip, "192.168.") == 0 || contain(ip,"10.") == 0 || contain(ip,"172.") == 0) return; formatex(buffer, charsmax(buffer), "GET /lookup/%s/ HTTP/1.1^nHost:%s^r^n^r^n", ip, g_host); socket_send(g_Socket, buffer, charsmax(buffer)); set_task(1.0, "task_waitanswer", index + 1231, "", 0, "a", 15); } public task_waitanswer(taskid) { new index = (taskid - 1231) if (socket_is_readable(g_Socket)) { new data[1300]; socket_recv(g_Socket, data, charsmax(data)); if (!data[0]) { remove_task(taskid); return; } if (contain(data[strlen(data) - 2], "Y") != -1) { server_cmd("kick #%i ^"Proxy/VPN no permitido!^"", get_user_userid(index)); } remove_task(taskid); } } public plugin_end() socket_close(g_Socket);
Cita:L 10/12/2022 - 03:43:04: [SOCKET] Invalid Socket: SocketID (184)
L 10/12/2022 - 03:43:04: [AMXX] Displaying debug trace (plugin "Block_VPN.amxx", version "b2.1")
L 10/12/2022 - 03:43:04: [AMXX] Run time error 10: native error (native "socket_send")
L 10/12/2022 - 03:43:04: [AMXX] [0] Block_VPN.sma::client_authorized (line 22)