WKnak / fail2ban-block-ip-range

A python script to block attacks from a network range address, from CIDR /23 up to /31
24 stars 15 forks source link

SyntaxError: EOL while scanning string literal #12

Closed jaccol closed 4 months ago

jaccol commented 4 months ago

Hi,

Thanks for coding this idea. I found a couple of issues and will open them separately. This one is "for the record", i.e. I think it is already covered by an MR that is now being reviewed.

The current code base gives an error:

  File "/usr/local/bin/fail2ban-block-ip-range.py", line 33
    script = 'tail -n 10000 /var/log/fail2ban.log | grep -E "fail2ban.filter.*\[[0-9]+\]:.*\[[^]]+\] Found ([0-9]{1,3}\.){3}[0-9]{1,3}" -o | sed -re "s/fail2ban.filter\s+\[[0-9]+\]:\sINFO\s+\[//; s/\]//; s/Found //;" | sort | uniq -c>
                                                                                                                                                                                                                                          ^
SyntaxError: EOL while scanning string literal

The last characters of line 33 should be uniq -c > ' + tmpf[1] in stead of uniq -c>

This was introduced in https://github.com/WKnak/fail2ban-block-ip-range/pull/7

I would have made an MR for this small fix, but I guess that this is already covered by https://github.com/WKnak/fail2ban-block-ip-range/pull/11

Jacco

pbiering commented 4 months ago

yes, this is covered by https://github.com/WKnak/fail2ban-block-ip-range/pull/11 and was also one of the reason for total rewrite that part.

WKnak commented 4 months ago

It is fixed by the latest PR #11 from @pbiering. Thanks!