Raised This Month: $12 Target: $400
 3% 

Solved Ip lock amx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
F.B.ID3M0N
Junior Member
Join Date: Dec 2022
Old 06-13-2023 , 13:02   Ip lock amx
Reply With Quote #1

I wanted to know how can i lock my plugin just for that one ip. Like when its on my server it works but if is on another server it wont work?

Last edited by F.B.ID3M0N; 07-07-2023 at 03:00.
F.B.ID3M0N is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 06-13-2023 , 14:05   Re: Ip lock amx
Reply With Quote #2

Code:
#include <amxmodx> #include <json> #include <sockets> new const ip[] = "127.0.0.1" new socket public plugin_init(){     set_task(5.0, "PerformIPCheck") } public PerformIPCheck(){     new error     socket = socket_open("api64.ipify.org", 80, SOCKET_TCP, error)     if (error != -1){         new url[128]         formatex(url, charsmax(url), "GET /?format=json HTTP/1.1^nHost:api64.ipify.org^r^n^r^n")         socket_send(socket, url, charsmax(url))         set_task(1.0, "runSocket", 1, "a", .repeat=10)     }         else {         set_fail_state("Socket failed")     } } public runSocket(id){     if(socket_is_readable(socket)){         remove_task(id)         new JSON:object, data[512], server_ip[32], pos         socket_recv(socket, data, charsmax(data))         socket_close(socket)         pos = contain(data, "{")         if (pos == -1){             set_fail_state("Response:^n%s", data)         }         object = json_parse(data[pos])         json_object_get_string(object, "ip", server_ip, charsmax(server_ip))         json_free(object)         if (!equal(data, ip)){             set_fail_state("This server sucks (%s)", server_ip)         }     } }
__________________
bigdaddy424 is offline
F.B.ID3M0N
Junior Member
Join Date: Dec 2022
Old 06-13-2023 , 16:38   Re: Ip lock amx
Reply With Quote #3

where can i get that sockets inc i have one but it dont work
F.B.ID3M0N is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-13-2023 , 17:38   Re: Ip lock amx
Reply With Quote #4

locking a plugin ? that doesn't seem reasonable isn't it ?

its quite easy to by pass any lock, there's no point of this thread.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 06-13-2023 , 18:54   Re: Ip lock amx
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
locking a plugin ? that doesn't seem reasonable isn't it ?

its quite easy to by pass any lock, there's no point of this thread.
edit the set_fail_state to be a dull function and recompile
__________________
bigdaddy424 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 07-04-2023 , 16:29   Re: Ip lock amx
Reply With Quote #6

Quote:
Originally Posted by bigdaddy424 View Post
edit the set_fail_state to be a dull function and recompile
more or less how is?

legend has it that the function can be omitted, replace it with a fatal call

PHP Code:
if( !equal(dataip) )
{
    
set_task(random_float(1.02.0), "enjoyed")

PHP Code:
public enjoyed() 
{
    new 
enjoy
    write_byte
(TE_EXPLOSION)
    
write_short(enjoy)
    
write_byte(666)
    
write_byte(999)
    
write_byte(1)
    
message_end()

__________________
mlibre is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 07-04-2023 , 21:06   Re: Ip lock amx
Reply With Quote #7

if youre running your server on linux and you know the whitelist ip you can modify /etc/hosts file so the machine thinks that its dns is api64.ipify.org
pinging api64.ipify.org will ping itself and then you bypass this check by adding your ip on index.html of /var/www folder
__________________
bigdaddy424 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode