I am refactoring the code to add object orientation and just checking the code.
pattern = r"((([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])[ (\[]?(\.|dot)[ )\]]?){3}([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))" class Lineobject(object): def __init__(self, pattern, line): self.ip = self.getip(self, pattern, line) def getip (self, pattern, line): for match in re.findall(pattern, line): results = '' ips = match[0] usergeneratedblacklist.write(ips) usergeneratedblacklist.write('\n') return ips
When creating an instance of the class below, I get an odd error. That getip () takes exactly 3 arguments (4 data), which I donβt know how to solve.
for theline in f: if "Failed password" in theline: lineclass = Lineobject(pattern, theline) else: pass
source share