in plugins/lists.py [0:0]
def remove(self, entry: typing.Union[str, IPEntry]):
"""Removes an IP/CIDR from the list"""
if isinstance(entry, str): # We want an IPEntry object. If given just an IP, find the object
for x_entry in self.list:
if x_entry["ip"] == entry:
entry = x_entry
break
# Only try to remove if we have an entry in our list
if entry and isinstance(entry, IPEntry) and entry in self.list:
self.state.sqlite.delete("lists", type=self.type, ip=entry['ip'])
self.list.remove(entry)
# Add to audit log
self.state.sqlite.insert(
"auditlog",
{
"ip": entry["ip"],
"timestamp": int(time.time()),
"event": f"IP {entry['ip']} removed from the {self.type} list.",
},
)