Python web board system (textboard, CGI, flatfile) http://4x13.net/bbs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

19 lines
321 B

  1. #!/usr/bin/env python3
  2. with open("bans.txt", "r") as ban:
  3. ban = ban.read().splitlines()
  4. bans = {}
  5. for b in ban:
  6. b = b.split(" ")
  7. b[1] = " ".join(b[1:])
  8. bans[b[0]] = b[1]
  9. def is_banned(ip):
  10. ip = str(ip)
  11. for b in bans.keys():
  12. if ip.startswith(b):
  13. return bans[b]
  14. return 0