Update: Changed the script to instead notify users by PM a client that is using a proxy. Must be configured when loaded.
Currently attempting to use https://iphub.info/ 's API to detect and kick user's who use proxies. The script is currently minimal to test basic detection andclient kicking. None of the config options do anything, just there to keep track of what I want in.
The script will check the client's IP 2 seconds after they connect/move. The current issues is that when a client connects to the server the .getIP() returns blank. If a client switches channels, it will retrieve the IP just fine. I don't really understand why, considering another script I made that uses the clientMove event with a delay can retrieve a channel a client has moved to.
What works
Currently attempting to use https://iphub.info/ 's API to detect and kick user's who use proxies. The script is currently minimal to test basic detection and
The script will check the client's IP 2 seconds after they connect/move. The current issues is that when a client connects to the server the .getIP() returns blank. If a client switches channels, it will retrieve the IP just fine. I don't really understand why, considering another script I made that uses the clientMove event with a delay can retrieve a channel a client has moved to.
PHP:
registerPlugin({
name: 'Proxy Check',
version: '0.1',
engine: '>= 0.9.16.4',
description: 'Moves clients based off of channel triggers',
author: 'kanalumaddela <[email protected]>',
vars: [
{
name: 'client_uids',
title: 'List of client uids to PM (comma separated)',
type: 'string'
}
]
},
function(sinusbot, config) {
var engine = require('engine');
var backend = require('backend');
var event = require('event');
var clientpmarray = config.client_uids.split(",");
event.on('clientMove', function(ev) {
if (!ev.client.isSelf() && ev.toChannel) {
engine.log('[Proxy Check] ' + ev.client.name() + ' \s IP is: ' + ev.client.getIP());
setTimeout(function() {
var clientip = this.client.getIP();
engine.log('[Proxy Check] ' + this.client.name() + ' \s IP with the 2 sec delay check is: ' + clientip);
if (clientip) {
var apiurl = 'http://legacy.iphub.info/api.php?ip=' + clientip + '&showtype=4';
sinusbot.http({
"method": "GET",
"url": apiurl,
"timeout": 6000,
"maxSize": 1024*1024*5,
}, function(error, response) {
if(response.statusCode != 200) {
sinusbot.log(error);
return;
}
var apiresponse = JSON.parse(response.data);
engine.log(apiresponse.proxy);
if (apiresponse.proxy == 1) {
pmclients(ev.client.name() );
}
else {
engine.log('[Proxy Check] ' + ev.client.name() + ' is not using a proxy.');
}
});
}
}.bind(ev), 2000);
}
});
function pmclients(user) {
for (x = 0; x < clientpmarray.length; x++) {
if (backend.getClientByUID(clientpmarray[x])) {
var client = backend.getClientByUID(clientpmarray[x]);
client.chat('[Proxy Check] - ' + user + ' is using a proxy');
} else {
engine.log('[Proxy Check] - User does not exist/is not online');
}
}
}
engine.log('[Proxy Check] - Loading...');
});
What works
- detecting people using proxies and successfully kicks them when they switch channels
- Detecting people when they connect to the server (issue still persists 0.9.16.4-aa0f89d)
Last edited: