From 7932ccbe23f77639a0355317af67a74b066fb055 Mon Sep 17 00:00:00 2001 From: Private Creator <10456533-private-creator@users.noreply.gitlab.com> Date: Sat, 18 Dec 2021 06:58:40 +0000 Subject: [PATCH] fix: support python2 fail2ban Python2 pickles use different class names for some types. Specifically, builtins.str is __builtin__.str. --- src/socket/protocol.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/socket/protocol.go b/src/socket/protocol.go index 54d3b6e..e350e7b 100644 --- a/src/socket/protocol.go +++ b/src/socket/protocol.go @@ -59,7 +59,7 @@ func (s *Fail2BanSocket) read() (interface{}, error) { unpickler := pickle.NewUnpickler(bufReader) unpickler.FindClass = func(module, name string) (interface{}, error) { - if module == "builtins" && name == "str" { + if (module == "builtins" || module == "__builtin__") && name == "str" { return &Py_builtins_str{}, nil } return nil, fmt.Errorf("class not found: " + module + " : " + name)