fail2ban / fail2ban

Compare 319cfef ... +1 ... ef5c826

Coverage Reach
fail2ban/tests/filtertestcase.py fail2ban/tests/servertestcase.py fail2ban/tests/fail2banclienttestcase.py fail2ban/tests/clientreadertestcase.py fail2ban/tests/utils.py fail2ban/tests/databasetestcase.py fail2ban/tests/actiontestcase.py fail2ban/tests/misctestcase.py fail2ban/tests/datedetectortestcase.py fail2ban/tests/actionstestcase.py fail2ban/tests/fail2banregextestcase.py fail2ban/tests/samplestestcase.py fail2ban/tests/clientbeautifiertestcase.py fail2ban/tests/failmanagertestcase.py fail2ban/tests/sockettestcase.py fail2ban/tests/tickettestcase.py fail2ban/tests/banmanagertestcase.py fail2ban/tests/action_d/test_smtp.py fail2ban/tests/action_d/__init__.py fail2ban/tests/files/action.d/action.py fail2ban/tests/files/action.d/action_errors.py fail2ban/tests/files/action.d/action_modifyainfo.py fail2ban/tests/files/action.d/action_checkainfo.py fail2ban/tests/files/action.d/action_nomethod.py fail2ban/tests/files/action.d/action_noAction.py fail2ban/tests/dummyjail.py fail2ban/tests/__init__.py fail2ban/server/filter.py fail2ban/server/action.py fail2ban/server/server.py fail2ban/server/transmitter.py fail2ban/server/database.py fail2ban/server/ipdns.py fail2ban/server/actions.py fail2ban/server/utils.py fail2ban/server/datedetector.py fail2ban/server/failregex.py fail2ban/server/ticket.py fail2ban/server/asyncserver.py fail2ban/server/filterpyinotify.py fail2ban/server/strptime.py fail2ban/server/datetemplate.py fail2ban/server/banmanager.py fail2ban/server/jail.py fail2ban/server/failmanager.py fail2ban/server/filterpoll.py fail2ban/server/filtergamin.py fail2ban/server/mytime.py fail2ban/server/jails.py fail2ban/server/jailthread.py fail2ban/server/filtersystemd.py fail2ban/server/__init__.py fail2ban/client/fail2banregex.py fail2ban/client/fail2banclient.py fail2ban/client/configreader.py fail2ban/client/configparserinc.py fail2ban/client/fail2bancmdline.py fail2ban/client/jailreader.py fail2ban/client/beautifier.py fail2ban/client/fail2banserver.py fail2ban/client/csocket.py fail2ban/client/actionreader.py fail2ban/client/filterreader.py fail2ban/client/configurator.py fail2ban/client/jailsreader.py fail2ban/client/fail2banreader.py fail2ban/client/__init__.py fail2ban/helpers.py fail2ban/protocol.py fail2ban/__init__.py fail2ban/exceptions.py fail2ban/version.py config/action.d/smtp.py config/filter.d/ignorecommands/apache-fakegooglebot setup.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -384,7 +384,17 @@
Loading
384 384
			"Found a match but no valid date/time found",
385 385
			"Match without a timestamp:", all=True)
386 386
387 -
		self.pruneLog()
387 +
	def testIncompleteDateTime(self):
388 +
		# datepattern in followed lines doesn't match previously known pattern + line is too short
389 +
		# (logging break-off, no flush, etc):
390 +
		self.assertTrue(_test_exec(
391 +
			'-o', 'Found-ADDR:<ip>',
392 +
			'192.0.2.1 - - [02/May/2021:18:40:55 +0100] "GET / HTTP/1.1" 302 328 "-" "Mozilla/5.0" "-"\n'
393 +
			'192.0.2.2 - - [02/May/2021:18:40:55 +0100\n'
394 +
			'192.0.2.3 - - [02/May/2021:18:40:55',
395 +
			'^<ADDR>'))
396 +
		self.assertLogged(
397 +
			"Found-ADDR:192.0.2.1", "Found-ADDR:192.0.2.2", "Found-ADDR:192.0.2.3", all=True)	
388 398
389 399
	def testFrmtOutputWrapML(self):
390 400
		unittest.F2B.SkipIfCfgMissing(stock=True)

@@ -104,14 +104,14 @@
Loading
104 104
105 105
	# more precise year patterns, within same century of last year and
106 106
	# the next 3 years (for possible long uptime of fail2ban); thereby
107 -
	# respect possible run in the test-cases (alternate date used there):
108 -
	if MyTime.alternateNowTime != 0:
109 -
		timeRE['ExY'] = r"(?P<Y>%s\d)" % _getYearCentRE(cent=(0,3), distance=3)
110 -
		timeRE['Exy'] = r"(?P<y>%s\d)" % _getYearCentRE(cent=(2,3), distance=3)
111 -
	else: # accept years: 19xx|2xxx up to current century
112 -
		timeRE['ExY'] = r"(?P<Y>(?:19\d{2}|%s\d))" % _getYearCentRE(cent=(0,3), distance=3, 
113 -
			now=(MyTime.now(), datetime.datetime.fromtimestamp(978393600)))
114 -
		timeRE['Exy'] = r"(?P<y>\d{2})"
107 +
	# consider possible run in the test-cases (alternate date used there),
108 +
	# so accept years: 20xx (from test-date or 2001 up to current century)
109 +
	timeRE['ExY'] = r"(?P<Y>%s\d)" % _getYearCentRE(cent=(0,3), distance=3, 
110 +
		now=(datetime.datetime.now(), datetime.datetime.fromtimestamp(
111 +
					min(MyTime.alternateNowTime or 978393600, 978393600))
112 +
				)
113 +
		)
114 +
	timeRE['Exy'] = r"(?P<y>\d{2})"
115 115
116 116
_updateTimeRE()
117 117

@@ -365,10 +365,10 @@
Loading
365 365
				# with space or some special char), otherwise possible collision/pattern switch:
366 366
				if ((
367 367
					line[distance-1:distance] == self.__lastPos[1] or
368 -
						(line[distance] == self.__lastPos[2] and not self.__lastPos[2].isalnum())
368 +
						(line[distance:distance+1] == self.__lastPos[2] and not self.__lastPos[2].isalnum())
369 369
					) and (
370 370
					line[endpos:endpos+1] == self.__lastEndPos[2] or
371 -
						(line[endpos-1] == self.__lastEndPos[1] and not self.__lastEndPos[1].isalnum())
371 +
						(line[endpos-1:endpos] == self.__lastEndPos[1] and not self.__lastEndPos[1].isalnum())
372 372
				)):
373 373
					# search in line part only:
374 374
					log(logLevel-1, "  boundaries are correct, search in part %r", line[distance:endpos])

Learn more Showing 2 files with coverage changes found.

Changes in fail2ban/server/strptime.py
-1
+1
Loading file...
Changes in fail2ban/server/utils.py
-1
+1
Loading file...
Files Coverage
config 97.37%
fail2ban -0.01% 95.49%
setup.py 68.75%
Project Totals (75 files) 95.47%
Loading