Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.112
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib /
python3 /
dist-packages /
fail2ban /
tests /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2022-11-21 13:39
action_d
[ DIR ]
drwxr-xr-x
2022-11-21 13:39
config
[ DIR ]
drwxr-xr-x
2022-11-21 13:38
files
[ DIR ]
drwxr-xr-x
2022-11-21 13:39
__init__.py
974
B
-rw-r--r--
2016-12-09 15:48
actionstestcase.py
5.48
KB
-rw-r--r--
2016-12-09 15:48
actiontestcase.py
12.43
KB
-rw-r--r--
2016-12-09 15:48
banmanagertestcase.py
3.79
KB
-rw-r--r--
2016-12-09 15:48
clientreadertestcase.py
30.14
KB
-rw-r--r--
2017-04-17 16:27
databasetestcase.py
12.14
KB
-rw-r--r--
2017-04-17 16:27
datedetectortestcase.py
7.36
KB
-rw-r--r--
2017-04-17 16:27
dummyjail.py
1.7
KB
-rw-r--r--
2016-12-09 15:48
fail2banregextestcase.py
6.54
KB
-rw-r--r--
2017-04-17 16:27
failmanagertestcase.py
4.09
KB
-rw-r--r--
2017-04-17 16:27
filtertestcase.py
40.89
KB
-rw-r--r--
2017-04-17 16:27
misctestcase.py
14.35
KB
-rw-r--r--
2017-04-17 16:27
samplestestcase.py
5.25
KB
-rw-r--r--
2017-04-17 16:27
servertestcase.py
28.03
KB
-rw-r--r--
2017-04-17 16:27
sockettestcase.py
2.86
KB
-rw-r--r--
2016-12-09 15:48
utils.py
12.93
KB
-rw-r--r--
2017-04-17 16:27
Save
Rename
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*- # vi: set ft=python sts=4 ts=4 sw=4 noet : # This file is part of Fail2Ban. # # Fail2Ban is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Fail2Ban is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Fail2Ban; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Author: Steven Hiscocks # __author__ = "Steven Hiscocks" __copyright__ = "Copyright (c) 2013 Steven Hiscocks" __license__ = "GPL" import os import sys import tempfile import threading import time import unittest from .. import protocol from ..server.asyncserver import AsyncServer, AsyncServerException from ..client.csocket import CSocket class Socket(unittest.TestCase): def setUp(self): """Call before every test case.""" self.server = AsyncServer(self) sock_fd, sock_name = tempfile.mkstemp('fail2ban.sock', 'socket') os.close(sock_fd) os.remove(sock_name) self.sock_name = sock_name def tearDown(self): """Call after every test case.""" @staticmethod def proceed(message): """Test transmitter proceed method which just returns first arg""" return message def testSocket(self): serverThread = threading.Thread( target=self.server.start, args=(self.sock_name, False)) serverThread.daemon = True serverThread.start() time.sleep(1) client = CSocket(self.sock_name) testMessage = ["A", "test", "message"] self.assertEqual(client.send(testMessage), testMessage) # test close message client.close() # 2nd close does nothing client.close() self.server.stop() serverThread.join(1) self.assertFalse(os.path.exists(self.sock_name)) def testSocketForce(self): open(self.sock_name, 'w').close() # Create sock file # Try to start without force self.assertRaises( AsyncServerException, self.server.start, self.sock_name, False) # Try again with force set serverThread = threading.Thread( target=self.server.start, args=(self.sock_name, True)) serverThread.daemon = True serverThread.start() time.sleep(1) self.server.stop() serverThread.join(1) self.assertFalse(os.path.exists(self.sock_name)) class ClientMisc(unittest.TestCase): def testPrintFormattedAndWiki(self): # redirect stdout to devnull saved_stdout = sys.stdout sys.stdout = open(os.devnull, 'w') try: protocol.printFormatted() protocol.printWiki() finally: # restore stdout sys.stdout = saved_stdout