Jump to content

Bind resource to an IP


Decro

Recommended Posts

Hello there.

I've seen that some people selling their resource with closed code and IP-binding. So you can run this resource only on the server which is running on defined IP address. And well, those resources is not requiring an ACL right's to check the server current IP, so they're somehow getting it without any callRemote() functions. And my question is: how do i get the server current IP address without calling any remote requests? Or maybe, is there any other way to prevent resource from starting on differ PC's?

Link to comment
  • MTA Team

You can make your own script, which is loaded before the encrypted script. You can overwrite functions in your own script to output the URL in debug and then spoof the result whenever the encrypted script does a callRemote.

-- Store the original function
local _callRemote = callRemote

-- Overwrite the global function for our purpose
function callRemote(url, a, b, c, d, ...)
    outputDebugString(("callRemote(%q, ...)"):format(url))
    
    -- Should we spoof the result?
    if url ~= "<url which returns ip>" then
        return _callRemote(url, a, b, c, d, ...)
    end

    -- callRemote(url, callback)
    if type(a) == "function" then
        return callback("<fake data from url>", 200, b, c, d, ...)
    end
    
    -- callRemote(url, attempts, callback)
    if type(b) == "function" then
        return callback("<fake data from url>", 200, c, d, ...)
    end

    -- callRemote(url, attempts, timeout, callback)
    if type(c) == "function" then
        return callback("<fake data from url>", 200, d, ...)
    end

    -- callRemote(url, queueName, attempts, timeout, callback)
    if type(d) == "function" then
        return callback("<fake data from url>", 200, ...)
    end
end

 

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...