1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Approved CountryBlackList 3.1.0

Blacklist any countries you do not want on your server

  1. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    Jakkee submitted a new resource:

    CountryBlackList - Blacklist any countries you do not want on your server

    Read more about this resource...
     
    #1
  2. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    #2
  3. PearlJ
    Offline

    PearlJ Contributor Contributor

    Joined:
    Aug 14, 2014
    Messages:
    98
    Likes Received:
    7
    I put my Country (Italy) in blacklist but I can, however, join in the server without problems.
    When I connect says "from unknow". This also happens to others who I did try.
     
    #3
  4. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    Thanks, Most likely the website I'm using is down or its a local hosted server and they are connecting from inside your network.
     
    #4
  5. PearlJ
    Offline

    PearlJ Contributor Contributor

    Joined:
    Aug 14, 2014
    Messages:
    98
    Likes Received:
    7
    No it is not local server, my server is hosted on VPS.
    Me and others two user (also they are italian) can join in the server without problems because the plugin (or website) does not indentify the Country.

    I think that config file is correct:
    Code (Text):
    [Settings]
    ShowAcceptedMessage=false
    ShowDeniedMessage=true
    LogTimedOutConnection=true

    [BlackList]
    BlackListedCountries=RU, KR, TR, AZ, IL, CN, JP, IT

    [Messages]
    JoinMessage=[color cyan]%player%[/color] has connected from: [color cyan]%country%[/color]
    DisconnectMessage=Your country is on the servers blacklist
    OtherDisconnectMessage=[color cyan]%player%[/color] is trying to connect from: [color cyan]%country%[/color] but is black listed
     
    #5
  6. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    I'll take a look, See what I find
     
    #6
  7. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    #7
  8. DreTaX
    Offline

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,927
    Likes Received:
    705
    #8
  9. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    #9
  10. DreTaX
    Offline

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,927
    Likes Received:
    705
    update nab
     
    #10
  11. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    #11
  12. DreTaX
    Offline

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,927
    Likes Received:
    705
    @PearlJ

    Jakkee Line 44 is wrong.

    Here is the correct version:
    Code (Python):
    __title__ = 'CountryBlackList'
    __author__ = 'Jakkee'
    __version__ = '1.1.1'

    try:
        import clr
        clr.AddReferenceByPartialName("Fougerite", "GeoIP")
        import Fougerite
        import GeoIP
        from GeoIP import GeoIP as RealGeoIP
    except:
        raise ImportError("Failed to reference the GeoIP.dll, Download from: http://fougerite.com/resources/geoip.135/")

    geo = RealGeoIP.Instance

    class CountryBlackList:
        def On_PluginInit(self):
            Util.ConsoleLog(__title__ + " by " + __author__ + " Version: " + __version__ + " loaded.", False)
            if not Plugin.IniExists("Settings"):
                Plugin.CreateIni("Settings")
                ini = Plugin.GetIni("Settings")
                ini.AddSetting("Settings", "ShowAcceptedMessage", "true")
                ini.AddSetting("Settings", "ShowDeniedMessage", "true")
                ini.AddSetting("Settings", "LogTimedOutConnection", "true")
                ini.AddSetting("BlackList", "BlackListedCountries", "TK, JO")
                ini.AddSetting("Messages", "JoinMessage", "%PLAYER% has connected from: %COUNTRY%")
                ini.AddSetting("Messages", "PlayerDisconnectMessage", "Your country is on the servers blacklist")
                ini.AddSetting("Messages", "ServerDisconnectMessage", "%PLAYER% is trying to connect from: %COUNTRY% but is black listed")
                ini.AddSetting("Messages", "UnknownLocation", "A hidden location")
                ini.Save()
            ini = Plugin.GetIni("Settings")
            DataStore.Add("CountryBlackList", "SAM", ini.GetSetting("Settings", "ShowAcceptedMessage"))
            DataStore.Add("CountryBlackList", "SDM", ini.GetSetting("Settings", "ShowDeniedMessage"))
            DataStore.Add("CountryBlackList", "BL", ini.GetSetting("BlackList", "BlackListedCountries"))
            DataStore.Add("CountryBlackList", "JM", ini.GetSetting("Messages", "JoinMessage"))
            DataStore.Add("CountryBlackList", "PDM", ini.GetSetting("Messages", "PlayerDisconnectMessage"))
            DataStore.Add("CountryBlackList", "DM", ini.GetSetting("Messages", "ServerDisconnectMessage"))
            DataStore.Add("CountryBlackList", "UL", ini.GetSetting("Messages", "UnknownLocation"))

        def find(self, blacklist, CountryCode):
            try:
                blacklist = blacklist.Replace(" ", "")
                blacklist = blacklist.split(',')
                for configlist in blacklist:
                    if CountryCode == configlist:
                        return True
                    else:
                        continue
                return False
            except:
                return False

        def On_PlayerConnected(self, Player):
            IPData = geo.GetDataOfIP(Player.IP)
            if IPData is None:
                if DataStore.Get("CountryBlackList", "SAM") == "true":
                    msg = DataStore.Get("CountryBlackList", "JM")
                    msg = msg.Replace("%PLAYER%", Player.Name)
                    msg = msg.Replace("%COUNTRY%", DataStore.Get("CountryBlackList", "UL"))
                    Server.Broadcast(msg)
                return
            countrycode = IPData.CountryShort
            blacklist = DataStore.Get("CountryBlackList", "BL")
            if self.find(blacklist, countrycode):
                playerdisconnectMSG = DataStore.Get("CountryBlackList", "PDM")
                if DataStore.Get("CountryBlackList", "SDM") == "true":
                    msg = DataStore.Get("CountryBlackList", "DM")
                    msg = msg.Replace("%PLAYER%", Player.Name)
                    msg = msg.Replace("%COUNTRY%", IPData.Country)
                    Server.Broadcast(msg)
                Player.Message(playerdisconnectMSG + " [" + countrycode + "]")
                Player.Disconnect()
            else:
                if DataStore.Get("CountryBlackList", "SAM") == "true":
                    msg = DataStore.Get("CountryBlackList", "JM")
                    msg = msg.Replace("%PLAYER%", Player.Name)
                    msg = msg.Replace("%COUNTRY%", IPData.Country)
                    Server.Broadcast(msg)
     
     
    #12
  13. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    #13
  14. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    #14
  15. tarynkelley
    Offline

    tarynkelley Moderator Moderator

    Joined:
    Nov 14, 2015
    Messages:
    559
    Likes Received:
    36
    Do you got any recommendations which countries should be blacklisted (e.g. cause of hacking )?
     
    #15
  16. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    Russia seems to be the hot spot for hackers, But its kind of rare to have a Russian hacker.
     
    #16
  17. tarynkelley
    Offline

    tarynkelley Moderator Moderator

    Joined:
    Nov 14, 2015
    Messages:
    559
    Likes Received:
    36
    Is it possible to maybe implement a Steam ID based Whitelist?

    I don't want to completly lock out a whole country, but allow players from the blocked country who seem to be fine and not hacking.
     
    #17
    • Informative Informative x 2
  18. Virobeast
    Offline

    Virobeast Member Member

    Joined:
    Sep 9, 2014
    Messages:
    31
    Likes Received:
    2
    Also it may be better to just have a country whitelist only feature, such was i wish to only allow people from Australia and New Zealand on my server, so all i have to do is add, AU, NZ.

    Not every other code possible to block ;)
     
    #18
    • Informative Informative x 1
  19. Virobeast
    Offline

    Virobeast Member Member

    Joined:
    Sep 9, 2014
    Messages:
    31
    Likes Received:
    2
    Cheat list for anyone looking to whitelist

    BlackListedCountries=TK, JO, AF, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BA, BW, BR, IO, VG, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL, CN, CX, CC, CO, KM, CK, CR, HR, CU, CY, CZ, CD, DK, DJ, DM, DO, TL, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI, FR, PF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GU, GT, GW, GN, GY, HT, HN, HK, HU, IS, IN, ID, IR, IQ, IE, IM, IL, IT, CI, JM, JP, JE, JO, KZ, KE, KI, KW, YT, KG, LA, LV, LB, LS, LR, LY, LI, MU, LT, LU, MO, MK, MG, MW, MY, MV, ML, MH, MR, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, NL, AN, NC, NI, NE, NG, NU, KP, MP, NO, OM, PK, PW, PA, PG, PL, PT, PR, QA, PY, PE, CG, RO , PN, PH, RU, MT, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SK, SI, SB, SO, ZA, GS, ES, LK, SD, SR, SJ, SZ, SE, SY, TW, TJ, TZ, TH, TG, TK, TO, TT, TN, TR, TM, TC, TV, VI, UG, AE, GB, US, UY, UA, UZ, VU, CH, VA, VE, VN, WF, EH, ZW, YE, ZM, KR
     
    #19
  20. Jakkee
    Offline

    Jakkee Plugin Developer Plugin Developer Contributor

    Joined:
    Jul 28, 2014
    Messages:
    1,480
    Likes Received:
    155
    #20
    • Like Like x 1

Share This Page