////////////// // // Proxy Blocker v1.3 by Pri (9th of October 2011) // This script requires Metis v2.82 & RoboMX v2.08 // Please use Metis v2.82 for the smoothest experience: http://bit.ly/ldk6C3 // Website: http://www.renmx.com // Forum: http://www.mxpulse.com/board // /////// COMMANDS // // !Download - Forcibly check for recent Proxy Servers to Ban that were used in other rooms // !Proxy [IP Address] - Check if an IP Address is a known Proxy Server or not // /////// SERVER SUPPORT // // WCS, RCS, ZCS, RSWCS, and FXServer are all supported out of the box // ZCS support is limited, WCS, RSWCS or FXServe are recommended. // ////////////// // Clear some variables for a clean run // Break if the IP is private (127.0.0.1, 192.168.x.x, 10.0.x.x and so on) :%IP% 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 // Check that the user has the correct version of Metis to run this script by quering server and checking for a file, if this file doesn't display right tell the user to update // The reason this variable is called Pulse is because it shares this variable among all my scripts to make sure the right Metis is being used, saves queries // If the server is down (And this is running Metis 2.8b1 modified by Pri) then detect that the server went down and break here /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#You appear to be running an outdated version of Metis. /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#You can download the latest one here#c63#: #c62#http://bit.ly/ldk6C3 /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#To install this file replace your old Metis.r2x file located in your script plugins folder // The proxy blocker now requires version 2.82 of Metis, if the user is not using this version tell the admins and break /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#This script requires Metis v2.82, please upgrade from v%VERSION%#c63#: #c62#http://bit.ly/ldk6C3 // Check that the scripts folder and settings file has been setup. If it hasn't do it. cmd.exe /c MD C:\Pri.Script.Dependencies\Proxy.Blocker\Cache 2\nv1.3 // Create a Whitelist File if one doesn't exsist and tell the admins how to use it /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#A Whitelist file has been created here#c63#: #c62#C:\Pri.Script.Dependencies\Proxy.Blocker\.Whitelist.ini /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#You may fill this file with Proxy IP's or Usernames of the people you trust to use Proxy Servers You can place Proxy Server IP's OR Usernames in this file, one entry per line, unlimited size, Please do not delete this line explaining how to use the file!\n // Create an 'Exile to x Room' file if one doesn't exsist and tell the admins how to use it /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#An Exile File has been created here#c63#: #c62#C:\Pri.Script.Dependencies\Proxy.Blocker\.exile.room.ini /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#You can put your main room name here for the Proxy Blocker to exile users to it #c63#(#c62#Once Verified#c63#) /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#If you do not need this feature simply leave the file as-is and users will not be exiled anywhere Enter the name of your room on the line directly below this one, Make sure it's the correct address. DO NOT DELETE THIS LINE OR BAD THINGS WILL HAPPEN!\n // Download some special characters required for this to function (Metis by itself doesn't allow these characters inside the code so they have to be loaded as varibles) // If the IP supplied to the bot is blank then load in the Access Level reminder counter (should be blank at first, then goes up to 3+) $ReminderCount$ // Break if the IP is blank then tell the Admins that they need to give their Bot high enough access to see IP Addresses /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#Your bot doesn't have a high enough access level to see the IP's of people who enter your room, Try logging it in as Admin or Host to correct this, or make your bot its own password with the necessary access level /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#Reminder #c62#%USERVAR[ReminderCount]%#c9# of 3 // Sometimes the creation of the Folder for the Setup Check is too slow causing the install check file to not save, so let's just re-attempt that if this is a first time install 2\nv1.3 // Reference the Whitelist file incase this user has been given permission to use a Proxy Server in this room // The whitelist checks for both a designated Proxy Server IP Address and the users Username from this file 0 0 1 1 // Check the Cache for this IP, if the IP is found don't query the IP with the API and just push it to the API Result variable // Check the Cache output for a proxy or not and push those variables so that duplicate queries are not made within the past day for this IP Proxy Detected in the Cache 0 // Query the Proxy API to see if this IP Address is a proxy or not // If the winmxunlimited API is down use the MXPulse version of the API instead, if MXPulse API is also down break 1 0 0 0 1 0 0 0 // Format the API output to make it a little nicer %USERVAR[Proxy_Server_API_Result]% Random Public Proxy Tor Proxy 0 // If the user had permission to use a proxy do not kick them but tell the admins they are using a proxy if they are /opmsg #c10#%NAME% #c9#is using a Proxy but has permission and won't be kicked. #c63#(#c62#%USERVAR[Proxy_UI_Result]%#c63#) // If a match was found, Kick/Ban and alert admins to this users Proxy use unless they had permission in which case skip this part /banip %IP% 1440 /kick %RAWNAME% /opmsg #c10#%NAME% #c9#is using a Proxy and has had their IP banned for 24 Hours. #c63#(#c62#%USERVAR[Proxy_UI_Result]%#c63#) // If the user has setup the exile in the exile.room.ini file then exile this user to that room if they are not a Proxy Server, Just exile if the user is Whitelisted however /exile %RAWNAME% %USERVAR[Exileroom_Result]% // Replace some symbols from the name that just don't work in a httpget request to the web server, and other characters we just don't want saved %RAWNAME% // Replace some symbols from the Roomname that don't work in httpget requests - Send the roomname to the Analytics API only if a Proxy was kicked from this room %ROOMNAME% // If this user was detected as using a proxy, send the IP, Username and Room Name to MXPulse (Analytical data for Pri) // Create a cache for this IP so that we don't query it again atleast within 24 hours %DAY%\n1\n%USERVAR[Proxy_UI_Result]%\nBanned from inside your room\n%DAY% %DAY%\n0\nNot detected as a Proxy\nUsername: %RAWNAME% // Check for recent bans on the API and cache those !botpreempban // Break here if this is a proxy, only check for updates when the user has not been detected as a proxy // Check for an updated version of this script v1.3 /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#%USERVAR[Version_Release_Message]% %DATE%\n%USERVAR[Version_Info]% !proxy %PARAM% // Check that the command was used at the beginning of a sentence %TRIGGER% // Break if the IP is private (127.0.0.1, 192.168.x.x, 10.0.x.x and so on) :%PARAM% 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 // Break if input doesn't contain a dot (just a really basic check to see if this is actually an IP Address, it isn't full proof but lots more code would be needed to properly verify input with Metis) #c62#Your parameter #c63#"#c4#%PARAM%#c63#" #c62#is not a valid IP Address. Valid Example#c63#: #c4#!proxy 137.56.163.46 // Push the PARAM to a variable so that it works inside the readweb operator %PARAM% // Check that the user has the correct version of Metis to run this script by quering server and checking for a file, if this file doesn't display right tell the user to update // The reason this variable is called Pulse is because it shares this variable among all my scripts to make sure the right Metis is being used, saves queries // If the server is down (And this is running Metis 2.81+ modified by Pri) then detect that the server went down and break here /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#You appear to be running an outdated version of Metis. /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#You can download the latest one here#c63#: #c62#http://bit.ly/ldk6C3 /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#To install this file replace your old Metis.r2x file located in your script plugins folder // Query the Proxy API to see if this IP Address is a proxy or not // If the winmxunlimited API is down use the MXPulse version of the API instead, if MXPulse API is also down break 1 0 0 0 1 0 0 0 // Format the API output to make it a little nicer %USERVAR[Proxy_Server_API_Result]% Random Public Proxy Tor Proxy 0 // Tell the user if the IP they have queries is a proxy server or not #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c62#%PARAM%#c63#: #c4#This IP is believed not to be a Proxy Server. #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c62#%PARAM%#c63#: #c8#Known Proxy Server #c63#(#c62#%USERVAR[Proxy_UI_Result]%#c63#) // This part of the script will check if there is any new IP's to be banned anytime someone in your room changes their username. // I've used this method because I do not want to use an OnTimer event as Metis only allows 1 to be used per Bot and I wouldn't want to 'steal' your only OnTimer and possibly break other scripts you are using. // Check for recent bans on the API and cache those !botpreempban !botpreempban !download // Check if a pre-emptive ban check has already been done in the past minute, if it has break %MINUTE% // Generate a random number to be used in the query to the API to make sure the results are not from the readweb cache %RANDOMNUM[1337]% // Pick the appropriate command to be used for different servers. Use /banip as the default however. /banip /hidecmd /banip /hidecmd /banip // Read in recent ban (start line 20 then go down) - Due to the way this is coded it actually starts with line 21 but its then reduced to line 20 before it begins reading the actual webpage 21 // Set the Ban Message to off for a clean run 0 // Set the banned IP Count to 0 for a clean run 0 // Reduce the line we are reading by 1, the reason we read the highest line first is so that Metis can cache all the lines and then reference that, basically for performance // Read in the webpage on the Line we have selected // If the divider [:@:] isn't found in the server output then consider the server bugged out or missing data and skip this line // Replace the data seperator with something more Metis friendly // Find the new seperator and push the variables on both sides (Left = IP, Right = Proxy Type) // Check that this Proxy wasn't already banned in the past 24 hours, if it was then just skip forward to the next IP // Save this Proxy to the local cache so that the system doesn't try and ban it again for 24 hours %DAY%\n1\n%USERVAR[Cache_Line02]%\nPre-emptive Ban from the API\n%DAY% // Ban the IP in the rooms server %USERVAR[Server_Appropriate_CMD]% %USERVAR[Cache_Line01]% 1440 1 // +1 the amount of IP's banned if some IP's were banned // Process this code a few more times or until we reach line 1 in which case finish // Proxy Servers were banned message creation %USERVAR[Amount_of_Proxies_Banned]% Proxy Servers have been banned in your room for 24 Hours #c63#(#c62#Pre-Emptive Bans#c63#) %USERVAR[Amount_of_Proxies_Banned]% Proxy Server has been banned in your room for 24 Hours #c63#(#c62#Pre-Emptive Bans#c63#) // Output to the admins that some IP's were banned if they were banned /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#%USERVAR[Proxy_Opmsg_Output]% /opmsg #c4#Proxy Blocker #c63#(#c62#v1.3#c63#): #c9#No Proxy Servers were found to ban at this time #c63#(#c62#Pre-Emptive Bans#c63#)