Skip to content

Commit

Permalink
Minor: Improved trends of various checks
Browse files Browse the repository at this point in the history
To show reliable trends, it is required to have analyzed the URL at least five times
  • Loading branch information
rfc-st committed Jan 10, 2025
1 parent 8408d15 commit cb6ca60
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a target="_blank" href="https://www.python.org/downloads/" title="Minimum Python version required to run this tool"><img src="https://img.shields.io/badge/Python-%3E%3D3.8-blue?labelColor=343b41"></a>
<a target="_blank" href="LICENSE" title="License of this tool"><img src="https://img.shields.io/badge/License-MIT-blue.svg?labelColor=343b41"></a>
<a target="_blank" href="https://github.com/rfc-st/humble/releases" title="Latest release of this tool"><img src="https://img.shields.io/github/v/release/rfc-st/humble?display_name=release&label=Latest%20Release&labelColor=343b41"></a>
<a target="_blank" href="https://github.com/rfc-st/humble/commits/master" title="Latest commit of this tool"><img src="https://img.shields.io/badge/Latest_Commit-2025--01--04-blue.svg?labelColor=343b41"></a>
<a target="_blank" href="https://github.com/rfc-st/humble/commits/master" title="Latest commit of this tool"><img src="https://img.shields.io/badge/Latest_Commit-2025--01--10-blue.svg?labelColor=343b41"></a>
<a target="_blank" href="https://pkg.kali.org/pkg/humble" title="Official tool in Kali Linux"><img src="https://img.shields.io/badge/Kali%20Linux-Tool-blue?labelColor=343b41"></a>
<br />
<a target="_blank" href="#" title="Featured on:"><img src="https://img.shields.io/badge/Featured%20on:-343b41"></a>
Expand Down
15 changes: 11 additions & 4 deletions humble.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
XML_STRING = ('Ref: ', 'Value: ', 'Valor: ')

current_time = datetime.now().strftime("%Y/%m/%d - %H:%M:%S")
local_version = datetime.strptime('2025-01-04', '%Y-%m-%d').date()
local_version = datetime.strptime('2025-01-10', '%Y-%m-%d').date()


class SSLContextAdapter(requests.adapters.HTTPAdapter):
Expand Down Expand Up @@ -546,8 +546,12 @@ def calculate_trends(values):
# Calculates the trend of various checks (Missing, Fingerprint,
# Deprecated/Insecure, Empty headers & Total warnings) of a given URL.
#
# It is recommended to have analyzed the URL over several time periods to
# obtain a reliable result.
# It is required to have analyzed the URL at least 5 times to show
# reliable trends.

if len(values) < 5:
return print_detail_l('[t_insufficient]', analytics=True)

imp_trend = sum(values[i] > values[i - 1] for i in range(1, len(values)))
wrs_trend = len(values) - 1 - imp_trend

Expand Down Expand Up @@ -607,6 +611,9 @@ def get_highlights_metrics(fourth_m):


def get_trend_metrics(fifth_m):
if '5' in fifth_m[0]:
trends_s = get_detail('[t_insufficient]')
return {'[trends]': "\n" + trends_s}
return {'[trends]': "\n" + "\n".join(fifth_m) + "\n"}


Expand Down Expand Up @@ -1810,7 +1817,7 @@ def custom_help_formatter(prog):
if (args.testssl_path is None or URL is None):
print_error_detail('[args_notestssl]')

if args.lang and not (URL or args.URL_A) and not args.guides:
if args.lang and not URL and not args.URL_A and not args.guides:
print_error_detail('[args_lang]')

if args.output_file and args.output and URL:
Expand Down
3 changes: 3 additions & 0 deletions l10n/details.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,9 @@ Trends
[t_fluctuating]
Fluctuating

[t_insufficient]
Analyze the URL at least 5 times to show reliable trends

[month_01]
January

Expand Down
3 changes: 3 additions & 0 deletions l10n/details_es.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,9 @@ Tendencias
[t_fluctuating]
Fluctuando

[t_insufficient]
Analice la URL al menos 5 veces para mostrar tendencias fiables

[month_01]
Enero

Expand Down

0 comments on commit cb6ca60

Please sign in to comment.