////////////// // // Proxy Blocker v1.5.1 by Pri (1st of September 2013) // This script requires Metis v2.82 or higher & RoboMX v2.08 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 // !ProxyPardon [IP Address] - Allows you to whitelist an IP to allow them to bypass the Proxy Blocker when they enter // !Proxy Status - Check the status of the Proxy Blocker and its API's // !ProxyLockdown On/Off - Allow the script to lock down your room when a large proxy spam attack is detected inside your room (Default is Off) // /////// 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 // Break here if a Private IP Was detected // 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 // Check if the user is using a compatible version of Metis or not and also check if the server is online or not /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#You appear to be running an outdated version of Metis. /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#You can download the latest one here#c63#: #c62#http://bit.ly/ldk6C3 /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#To install this file replace your old Metis.r2x file located in your script plugins folder // Perform an online check to see if this version of Metis is supported by this script or not // The proxy blocker now requires version 2.82 of Metis or higher, if the user is not using this version or better tell the admins and break /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#This script requires Metis v2.82 minimum, 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.5.1 // Create a Whitelist File if one doesn't exsist and tell the admins how to use it /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#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.5.1#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.5.1#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.5.1#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.5.1#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 // Create a 'Force Login Password' file if one doesn't exsist and tell the admins how to use it /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#A Force Login Password File has been created here#c63#: #c62#C:\Pri.Script.Dependencies\Proxy.Blocker\.forcelogin.password.ini /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#You can put a password here for the Proxy Blocker to log users in with #c63#(#c62#Once Verified#c63#) /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#If you do not need this feature simply leave the file as-is and users will not be logged in. The command that the bot uses for this is /forcelogin so make sure your server supports this command. FXServe, WCS and RSWCS support it. Enter your password on the line directly below this one to have them logged in with it after they enter your room. DO NOT DELETE THIS LINE OR BAD THINGS WILL HAPPEN!\n // Create the Spam Lockdown settings file if one doesn't exsist and tell the admins how to use it /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#This version of Proxy Blocker supports a new "Lockdown" feature - It is OFF by default but you can activate it by typing #c4#!ProxyLockdown On /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#When this feature is active the Proxy Blocker is able to stop any and all users from entering your room for up to a maximum of 1 hour when a large proxy attack against your room is detected 0\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) // Check the status of the Proxy Blocker API's - Only under the condition that this is the first run of the Proxy Blocker since the bot started up // 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.5.1#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.5.1#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.5.1 // 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 // If the API is requesting the local Cache to be turned off then ignore the cache output and make a web query to the API instead Ignore-Cache // 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 API is reporting the WinMX Unlimited Proxy Check API is offline then change the output from the site to Offline Offline // 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 // If the API is reporting the WinMX Unlimited Proxy Check API is offline then change the output from the site to Offline Offline 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 #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #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 #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #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]% // If the user has setup the forcelogin voice feature then log this user in if they are not a proxy /forcelogin %RAWNAME% %USERVAR[ForceLoginPass_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 - Don't save this if the API doesn't want a cache created %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 // If there is 3 positive detections in the last 60 seconds then send /limit 5 to the server to stop any other connections 0 %MINUTE% /limit 5 /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c8#A proxy based spam attack has been detected in your room. The room has entered into lock down mode. No one will be able to enter your room for %USERVAR[MINUTEUNTILNEXTHOUR]% minutes 1\n%HOUR%-%DATE% If 5 attacks are detected within the past minute tell the admins they can turn the Lockdown feature on (Only give this notice once per day) /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#A large Proxy Spam attack has been detected against your room, you can block this and future large attacks by typing #c4#!ProxyLockdown On 1-%DATE% // 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 (Now with Auto Update if wget is found!) v1.5.1 // Check if the Version_Server_Health is okay, if it isn't skip this update entirely // Auto Update Code http://proxy.blocker.mxpulse.com/Version.ini Plugins\wget\wget.exe -q -O Plugins\%USERVAR[Update_Filename]% %USERVAR[Update_URL]% /opmsg #c4#Proxy Blocker #c63#(#c62#%USERVAR[Version_Info]%#c63#): #c1#Your Proxy Blocker plugin has just downloaded and installed an update. /mxc load // Normal Update Code /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c1#A new version (%USERVAR[Version_Info]%) of Proxy Blocker is available. /opmsg #c4# · Update Notes#c63#: #c62#%USERVAR[Version_Release_Message]% %DATE% !proxy %PARAM% // Check that the command was used at the beginning of a sentence %TRIGGER% // Check the status of the Proxy Blocker API's // Output the status if the user used status as their parameter #c4#Proxy Blocker API Status#c63#: %USERVAR[Proxy_Blocker_Status_LSC]% %USERVAR[Proxy_Blocker_Status_WUPEB]% %USERVAR[Proxy_Blocker_Status_MPC]% %USERVAR[Proxy_Blocker_Status_WUPC]% %USERVAR[Proxy_Blocker_Status_AAPI]% // 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 #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#You cannot check an internal IP with the Proxy Blocker // 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 // Check if the user is using a compatible version of Metis or not and also check if the server is online or not /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#You appear to be running an outdated version of Metis. /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#You can download the latest one here#c63#: #c62#http://bit.ly/ldk6C3 /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#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 API is reporting the WinMX Unlimited Proxy Check API is offline then change the output from the site to Offline Offline // 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 // If the API is reporting the WinMX Unlimited Proxy Check API is offline then change the output from the site to Offline Offline 1 0 0 0 // If both API's failed to give any valid responses then tell the admins both API's are offline and to try again later #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c5#The Proxy Server API Service is currently offline, please try your query again later. // Format the API output to make it a little nicer %USERVAR[Proxy_Server_API_Result]% Random Public Proxy 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.5.1#c63#): #c62#%PARAM%#c63#: #c4#This IP is believed not to be a Proxy Server. #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c62#%PARAM%#c63#: #c8#Known Proxy Server #c63#(#c62#%USERVAR[Proxy_UI_Result]%#c63#) !ProxyLockdown on !ProxyLockdown off // Check if the command was typed at the start of a sentence, if not break %TRIGGER% // Check if the Metis version is below v2.83 so we know that %USERMODE% works 1 0 0 0 // If the user doesn't have an @ in the User List, tell them they need to login to use this command and break #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#Login and show an #c62#@ #c9#in the userlist to use this command. // Process which command the user typed 1 0 // Output message to Opmsg explaining which setting was chosen and what it does /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#The #c63#"#c1#Proxy Blocker Lockdown#c63#"#c9# feature has been turned #c8#OFF /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c62#When this setting is off the Bot will not attempt to lockdown your room even when it detects a large proxy based spam attack /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#The #c63#"#c1#Proxy Blocker Lockdown#c63#"#c9# feature has been turned #c4#ON /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c62#When this Setting is On the Bot will be able to block ALL users from being able to enter your room for a maximum of 60 minutes whenever a large proxy spam attack has been detected inside your room /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c62#This feature only supports WCS, RCS, RSWCS, FXServe and ZCS - Other servers may not support it // End any lockdown currently in progress if the user turned this feature off /limit 150 /reload /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c62#The server has exited Lock Down mode, users are again able to connect to the room, if you want to re-enable this feature for future attacks type #c4#!ProxyLockdown On 0\n%HOUR%-%DATE% // If there is 3 positive detections in the last 60 seconds then send /limit 5 to the server to stop any other connections 3 %MINUTE% /limit 5 /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c8#A proxy based spam attack has been detected in your room. The room has entered into lock down mode. No one will be able to enter your room for %USERVAR[MINUTEUNTILNEXTHOUR]% minutes 1\n%HOUR%-%DATE% // 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 // If the channel limit is set to 5 but the hour is up, re-set it back to 150 /limit 150 /reload /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c62#The server has exited Lock Down mode, users are again able to connect to the room 0\n%HOUR%-%DATE% // Check if the API is requesting any of the functions of this script to be turned off temporarily // Push the current minute to a variable so another check in the script can make sure this doesn't run more often than once a minute %MINUTE% // Break here if the Pre-Emptive system has been set to off by the Proxy API /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c5#The Pre-Emptive Ban feature has been temporarily disabled, please try again later. // 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.5.1#c63#): #c9#%USERVAR[Proxy_Opmsg_Output]% /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#No Proxy Servers were found to ban at this time #c63#(#c62#Pre-Emptive Bans#c63#) !ProxyPardon %PARAM% // Check if the command was typed at the start of a sentence, if not break %TRIGGER% // Check if the Metis version is below v2.83 so we know that %USERMODE% works 1 0 0 0 // If the user doesn't have an @ in the User List, tell them they need to login to use this command and break #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#Login and show an #c62#@ #c9#in the userlist to use this command. // Do a really basic IP Check by checking if the paramter contains a . /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#Your parameter #c63#"#c4#%PARAM%#c63#" #c62#is not a valid IP Address. Valid Example#c63#: #c4#!ProxyPardon 137.56.163.46 // Create a Whitelist File if one doesn't exsist and tell the admins how to use it /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#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.5.1#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 // Push the user parameter to a variable %PARAM% // Process which command the user typed 1\n0\nIP Pardoned by %NAME%\nNo username, only IP Address supplied as this was a pardon placed by an Administrator. %USERVAR[Pardon_User_IP]%\n // Output message to Opmsg explaining this users IP has been pardoned /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#The IP #c63#"#c1#%USERVAR[Pardon_User_IP]%#c63#"#c9# has been added to your local Proxy IP Whitelist /opmsg #c4#Proxy Blocker #c63#(#c62#v1.5.1#c63#): #c9#To edit the file manually#c63#: #c62#C:\Pri.Script.Dependencies\Proxy.Blocker\.Whitelist.ini