diff options
author | bai | 2020-03-27 22:21:25 -0300 |
---|---|---|
committer | bai | 2020-03-27 22:21:51 -0300 |
commit | 7903c754e17bfece3f30b3daebd09cdba7d58457 (patch) | |
tree | 4acdf39067faa9cff3e422a1a5a7ac4a9c21e888 | |
parent | 5de8cff2d7a81274fb9540e14da1fbc1ac330c79 (diff) | |
download | weabot-7903c754e17bfece3f30b3daebd09cdba7d58457.tar.gz weabot-7903c754e17bfece3f30b3daebd09cdba7d58457.tar.xz weabot-7903c754e17bfece3f30b3daebd09cdba7d58457.zip |
Country
-rw-r--r-- | cgi/framework.py | 3 | ||||
-rwxr-xr-x | cgi/weabot.py | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/cgi/framework.py b/cgi/framework.py index 9c95cc1..f90ed92 100644 --- a/cgi/framework.py +++ b/cgi/framework.py @@ -89,6 +89,9 @@ def addressIsES(ip): 'GY', 'GT', 'HN', 'MX', 'NI', 'PA', 'PE', 'PY', 'PR', 'SR', 'UY', 'VE'] # 'BR', return getCountry(ip) in ES +def addressIsUS(ip): + return getCountry(ip) == 'US' + def getCountry(ip): import geoip return geoip.country(ip) diff --git a/cgi/weabot.py b/cgi/weabot.py index 29770f4..398ebfa 100755 --- a/cgi/weabot.py +++ b/cgi/weabot.py @@ -356,6 +356,9 @@ class weabot(object): def make_post(self, ip, boarddir, parent, trap1, trap2, name, email, subject, message, file, file_original, spoil, oek_file, password, noimage, mobile): _STARTTIME = time.clock() # Comment if not debug + if addressIsUS(ip): + raise UserError, "Host en lista negra." + # open database OpenDb() |