FIX: Extra # in channel names when kickbanning, FEAT: Hardcoded blacklist now implemented, for known malicous hosts

This commit is contained in:
Firepup Sixfifty 2024-11-20 12:50:05 -06:00
parent 40ff789fe1
commit 6aef607dc3
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48

View file

@ -31,6 +31,8 @@ providers = BL.BASE_PROVIDERS + [droneBL("dnsbl.dronebl.org")]
ipbl = DNSBLIpChecker(providers=providers) ipbl = DNSBLIpChecker(providers=providers)
hsbl = DNSBLDomainChecker(providers=providers) hsbl = DNSBLDomainChecker(providers=providers)
hardbl = ["146.70.59.36"]
load_dotenv() load_dotenv()
__version__ = "v3.0.22" __version__ = "v3.0.22"
npbase: str = ( npbase: str = (
@ -180,6 +182,8 @@ def dnsbl(hostname: str) -> tuple[str, dict[str, list[str]]]:
hstDT = hsbl.check(hostname).detected_by hstDT = hsbl.check(hostname).detected_by
except ValueError: # It's also not a hostname except ValueError: # It's also not a hostname
hstDT = {} hstDT = {}
if hostname in hardbl:
hstDT["hardcoded"] = ["Known bad host"]
for host in hstDT: for host in hstDT:
if hstDT[host] != ["unknown"]: if hstDT[host] != ["unknown"]:
hosts.append(host) hosts.append(host)
@ -209,9 +213,9 @@ def dnsblHandler(
match bot.dnsblMode: match bot.dnsblMode:
case "kickban": case "kickban":
bot.sendraw( bot.sendraw(
f"KICK #{chan} {nick} :Sorry, but you're on the {dnsblStatus} blacklist(s)." f"KICK {chan} {nick} :Sorry, but you're on the {dnsblStatus} blacklist(s)."
) )
bot.sendraw(f"MODE #{chan} +b *!*@{hostname}") bot.sendraw(f"MODE {chan} +b *!*@{hostname}")
case "akill": case "akill":
bot.sendraw( bot.sendraw(
f"OS AKILL ADD *@{hostname} !P Sorry, but you're on the {dnsblStatus} blacklist(s)." f"OS AKILL ADD *@{hostname} !P Sorry, but you're on the {dnsblStatus} blacklist(s)."