References
A humble, and fast, security-oriented HTTP headers analyzer.
ExportStates
Bases: NamedTuple
Formatting states for HTML/PDF exports, related to -o all option.
Source code in humble.py
2224 2225 2226 2227 2228 2229 | |
SSLContextAdapter
Bases: HTTPAdapter
Custom SSL adapter.
Disables SSL validation for unrestricted URL analysis.
Note
The following checks are disabled to allow the analysis of URLs in environments with self-signed certificates, outdated software, or development configurations:
- Certificate Verification
- Hostname Verification
- Certificate Requirement
Source code in humble.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
init_poolmanager(*args, **kwargs)
Initialize the pool manager.
With an unverified SSL context and restricted ciphers.
Source code in humble.py
254 255 256 257 258 259 260 261 262 263 264 265 266 | |
add_xml_item(line, section)
Add a new item to the section.
Related to -o xml option.
Source code in humble.py
3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 | |
adjust_old_analysis(url_ln)
Adjust analysis entries in analysis history file, analysis_h.txt.
Note
Applied to those made before 2024-11-28 when the enabled security headers total was not yet recorded; ensures that old entries in that file remain compatible with the current analysis format.
Source code in humble.py
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | |
analyze_input_file(input_file)
Analyze HTTP response headers from a raw text dump or a HAR file.
See curl's --dump-header and
the HAR specification
or its historical draft.
Related to -if option.
Source code in humble.py
4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 | |
apply_pdf_color(colon_idx, hcolor, line, vcolor)
Add the specific HTML tag to indicate the corresponding color.
Sanitizes header values using HTML escaping to ensure that special
characters (e.g., < or > in headers) are rendered correctly and do not
interfere with the PDF structure.
Related to -o pdf option.
Source code in humble.py
3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 | |
build_cicd_info(info_lines)
Build the CI/CD info dict from analysis metadata lines.
Related to -cicd option.
Source code in humble.py
2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 | |
build_cicd_totals(tmp_filename, info_lines, totals, labels, threshold=None)
Build the CI/CD totals from analysis metadata and section totals.
If threshold is provided, appends a 'Security Gate' field with pass/fail
status; related to -cicd GRADE option.
Source code in humble.py
2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 | |
build_html_writers()
Build the ordered rules that format the main sections.
Each writer takes (html_final, ln_rstrip), writes the line if it
matches and returns whether it did; the values they depend on are
resolved once here, instead of once per line.
Related to -o html option.
Source code in humble.py
3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 | |
build_tmp_file(export_date, file_ext, lang, humble_str, url)
Build the default filename for the temporary export file.
Formats a unique name from the URL scheme, domain, port, and timestamp;
related to -o option.
Tip
tldextract is lazy-loaded to avoid unnecessary overhead when the
analysis is not exported.
Source code in humble.py
4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 | |
calculate_highlights(url_ln, field_index, func)
Extract the specific date from an analysis.
Based on the required highlight metric; related to -a option.
Source code in humble.py
867 868 869 870 871 872 873 874 875 876 877 | |
calculate_trends(values)
Compute trends based on several analyses of the same URL.
Info
Trends are related to the totals of missing headers, fingerprints,
deprecated/insecure, empty, and total warnings for a given URL: the
analysis history file, analysis_h.txt, must contain at least five
analyses of the same URL in order to calculate reliable trends, and
only the five most recent analyses of that URL are taken into
account.
Trend values:
Stable: all five totals are identicalImproving: totals consistently decreaseWorsening: totals consistently increaseFluctuating: No clear trend is detected; totals alternate
Source code in humble.py
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | |
check_analysis(filepath)
Check if analysis history file, analysis_h.txt, exists.
Source code in humble.py
681 682 683 684 685 | |
check_cicd(analysis_grade, threshold_grade)
Check if the analysis grade fails the minimum required for CI/CD.
Both grades must belong to GRADE_ORDER, which is guaranteed by
validate_cicd_grade; equal grades pass.
Source code in humble.py
2390 2391 2392 2393 2394 2395 2396 2397 | |
check_export_scope()
Determine the scope of the export process based on the -o option.
If the value of that option is not all (e.g., csv), it proceeds to
export the analysis in that format; otherwise, it exports it to all
supported formats and terminate execution.
Source code in humble.py
2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 | |
check_frame_options(args, headers_l, l_miss, m_cnt, skip_headers)
Determine whether to report a missing X-Frame-Options header.
Info
X-Frame-Options won't be reported as missing if the
frame-ancestors directive of Content-Security-Policy is
present: the latter is the comprehensive, modern, and preferred way.
Source code in humble.py
1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 | |
check_input_traversal(user_input)
Check user input for path traversal patterns.
Exit is one is found; related to -of and -op options.
Source code in humble.py
1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 | |
check_missing_headers(m_cnt, l_miss, l_detail, merged_set, xfo_skipped)
Print the missing security-related HTTP response headers.
Based on those I consider essential.
Note
strict=False is used because l_detail contains [mxfo] but l_miss
does not yet contain X-Frame-Options: this header is checked for in
check_frame_options function.
Note
The highlighted headers
are defined in the EXP_HEADERS tuple and correspond to some of those
indicated in the MDN list
of HTTP headers.
Source code in humble.py
1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 | |
check_output_format(final_filename, reliable, tmp_filename)
Dispatch the export logic for the selected output format.
Maps each supported format (text, CSV, JSON, XLSX, XML, HTML and PDF) to its corresponding function. For text output, handles CI/CD totals and OWASP compliance checks; for JSON, toggles between brief and detailed reports.
Related to -o option.
Source code in humble.py
2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 | |
check_output_path(args)
Validate the provided path when exporting an analysis.
Exit in case of error; related to -op option.
Source code in humble.py
2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 | |
check_owasp_compliance(tmp_filename)
OWASP Secure Headers Project best practices checks.
Related to -c option.
Source code in humble.py
3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 | |
check_proxy_url(proxy_host, proxy_port, timeout, failed_proxy)
Check if the proxy server is reachable, related to -p option.
Source code in humble.py
304 305 306 307 308 309 310 | |
check_python_version()
Verify that the host's Python version meets the minimum requirements.
Prints an error and exit if the version is below the threshold defined in
PYTHON_REQUIRED_VERSION.
Source code in humble.py
269 270 271 272 273 274 275 276 277 278 279 280 | |
check_russian_scope()
Validate if the target domain is within the Russian scope and exit if so.
Note
You can read my reasons here.
Source code in humble.py
3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 | |
check_skip_file()
Exclude the headers defined in the humble.skip file from the analysis.
Returns a list of clean header name strings.
Source code in humble.py
2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 | |
check_unsafe_cookies()
Set-Cookie header analysis.
Source code in humble.py
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 | |
check_updates(local_version)
Check for updated versions of humble on GitHub.
After that exit; related to -v option.
Source code in humble.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
check_updates_diff(days_diff, github_version, local_version)
humble update logic.
Check whether the local version is more than a month older than the latest
on GitHub, related to -v option.
Source code in humble.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
choose_xlsx_format(bold_fmt, cell_fmt, cell_value, col_index, hidden_fmt, row_index, prev_section)
Choose the cell format for an XLSX export based on position and content.
Tracks section changes across rows to apply bold, hidden, or standard
formatting; related to -o xlsx option.
Source code in humble.py
2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 | |
clean_html_final(final_filename)
Remove content related to preformatted text.
Related to -o html option.
Source code in humble.py
3770 3771 3772 3773 3774 3775 3776 3777 3778 | |
color_pdf_line(line, hcolor, vcolor, chunks, i, pdf)
Locate lines to which a specific color should be applied.
Relate to -o pdf option.
Source code in humble.py
3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 | |
compare_analysis_results(analysis_totals, current_counts)
Print the differences in totals between analyses of the same URL.
Source code in humble.py
631 632 633 634 635 636 637 638 639 640 641 | |
csp_analyze_content(csp_header)
Content-Security-Policy header analysis.
Source code in humble.py
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 | |
csp_base64_nonce(nonce, nonce_refs, i_cnt)
Content-Security-Policy header checks related to Base64 nonces.
Source code in humble.py
1349 1350 1351 1352 1353 1354 1355 | |
csp_check_additional(csp_dirs_vals)
Content-Security-Policy header check.
Related to broad and insecure values.
Source code in humble.py
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | |
csp_check_broad(csp_dirs_vals)
Content-Security-Policy header check related to broad values.
Source code in humble.py
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 | |
csp_check_eval(csp_dirs_vals)
Content-Security-Policy header check.
Related to unsafe-eval and wasm-unsafe-eval keywords.
Source code in humble.py
1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | |
csp_check_hashes(csp_h)
Content-Security-Policy header checks related to hashes.
Source code in humble.py
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 | |
csp_check_ignored(csp_header)
Content-Security-Policy header check.
Related to strict-dynamic keyword.
Source code in humble.py
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | |
csp_check_inline(csp_dirs_vals)
Content-Security-Policy header check.
Related to unsafe-inline keyword.
Source code in humble.py
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 | |
csp_check_insecure(csp_dirs_vals)
Content-Security-Policy header check related to insecure values.
Source code in humble.py
1230 1231 1232 1233 1234 1235 1236 1237 1238 | |
csp_check_ip(csp_h)
Content-Security-Policy header check related to IP address values.
Source code in humble.py
1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 | |
csp_check_missing(csp_dirs)
Content-Security-Policy header check.
Related to missing directives.
Source code in humble.py
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | |
csp_check_nonces(csp_h)
Content-Security-Policy header checks.
Related to hexadecimal and Base64 nonces.
Source code in humble.py
1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 | |
csp_check_unknown(csp_h)
Content-Security-Policy header check related to unknown directives.
Source code in humble.py
1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | |
csp_hex_nonce(nonce, nonce_refs, i_cnt)
Content-Security-Policy header checks.
Related to hexadecimal nonces.
Source code in humble.py
1340 1341 1342 1343 1344 1345 1346 | |
csp_print_broad(csp_broad_dirs, csp_broad_v, i_cnt)
Print the broad value in the Content-Security-Policy header.
Source code in humble.py
1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 | |
csp_print_deprecated(csp_deprecated)
Content-Security-Policy header check.
Print deprecated directives.
Source code in humble.py
1384 1385 1386 1387 1388 1389 1390 1391 1392 | |
csp_print_details(csp_values, csp_title, csp_desc, csp_refs)
Content-Security-Policy` header related.
Group the deprecated directives.
Source code in humble.py
1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | |
csp_print_insecure(csp_insec_v, csp_insec_dirs, i_cnt)
Print the insecure value in the Content-Security-Policy header.
Source code in humble.py
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 | |
csp_print_missing(csp_ref, csp_ref_brief)
Print the missing directive in the Content-Security-Policy header.
Source code in humble.py
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | |
csp_print_nonce(nonce, nonce_refs, i_cnt)
Content-Security-Policy header checks.
Print insecure Base64 and hexadecimal nonces
Source code in humble.py
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 | |
csp_print_unknown(unknown_dir)
Print unknown directives in the Content-Security-Policy header.
Source code in humble.py
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 | |
csp_print_unsafe(csp_unsafe_dirs, detail_t, detail_d, lines_n, i_cnt)
Content-Security-Policy header check.
Print the occurrences of unsafe-eval and unsafe-inline keywords.
Source code in humble.py
1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | |
csp_unquoted_hashes(csp_h)
Content-Security-Policy header check related to unquoted hashes.
Source code in humble.py
1314 1315 1316 1317 1318 1319 1320 1321 | |
custom_help_formatter(prog)
Format help output with an increased character limit per line.
Source code in humble.py
4311 4312 4313 | |
decrease_html_spacing(tmp_filename)
Decrease the spacing between sections.
Related to -o html option.
Source code in humble.py
3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 | |
delete_lines(*, reliable=True)
Clear console lines to standardize the final analysis output format.
Removes previously printed lines to ensure that final messages (success or error) are consistently padded with a blank line before and after.
Source code in humble.py
1505 1506 1507 1508 1509 1510 1511 1512 1513 | |
escape_html_value(ln)
Escape a label-delimited value while preserving humble's own tags.
Only the content inside the single quotes following a localized value
label (Value:/Valor:) is escaped, with quote=False so benign
output is unchanged; lines without such a label are returned unaltered.
Related to -o html option.
Source code in humble.py
3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 | |
export_all_formats(final_filename, tmp_filename)
Export the analysis to all supported formats.
This function sequentially invokes the functions for CSV, XLSX, JSON,
XML, HTML, PDF, and TXT exports. It passes the export_all flag where
applicable to ensure consistent processing and terminate execution after
displaying the final export path.
Related to -o all option.
Source code in humble.py
2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 | |
export_html_file(final_filename, tmp_filename, *, export_all=False)
HTML export of the analysis, related to -o html option.
Source code in humble.py
3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 | |
export_pdf_file(tmp_filename, *, export_all=False)
PDF export of the analysis, related to -o pdf option.
Tip
fpdf2 is lazy-loaded to avoid unnecessary overhead when PDF export is
not used.
Source code in humble.py
3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 | |
extract_date_metrics(url_ln)
Extract totals, by month and year, from the analyses performed on a URL.
Related to -a option.
Source code in humble.py
802 803 804 805 806 807 808 809 810 811 812 813 814 | |
extract_global_metrics(all_analysis)
Compute metrics to print statistics across all URL analyses.
Related to -a option.
Source code in humble.py
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 | |
extract_har_content(har_data)
Extract response headers and status code from a HAR file.
A HAR file may be valid JSON yet not follow the expected structure, so
any unexpected type yields empty headers, reported by the caller via
[args_harlines].
Source code in humble.py
3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 | |
fetch_cicd_grade(totals)
Fetch the analysis grade from the totals.
Related to -cicd GRADE option.
Source code in humble.py
2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 | |
finalize_export(final_filename, temp_filename, file_extension, export_all)
Manage the completion of exporting an analysis.
Handle file cleanup, renaming, and termination based on the export mode:
in standalone mode (export_all=False), display the final path, remove
temporary files, and exit; in batch mode (export_all=True), rename the
generated file with the appropriate extension and update its content.
Related to -o option.
Source code in humble.py
2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 | |
fix_pdf_all_export(tmp_filename)
Format and applies the correct extension to the PDF file.
Related to -o all option.
Source code in humble.py
2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 | |
fix_xlsx_all_export(csv_filename, export_all)
Apply the correct extension to the XSLX file.
Related to -o all option.
Source code in humble.py
2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 | |
fng_statistics_term(fng_term)
Count fingerprint headers per provided term.
Exit if no results are found, related to -f option.
Source code in humble.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
fng_statistics_term_content(fng_groups, fng_term, term_cnt, fng_incl)
Compute percentage of fingerprint headers matching the search term.
Related to -f option.
Source code in humble.py
423 424 425 426 427 428 429 430 431 | |
fng_statistics_term_groups(fng_incl, fng_term)
Compute the total of fingerprint headers per provided term.
It takes into account also the service; related to -f option.
Source code in humble.py
410 411 412 413 414 415 416 417 418 419 420 | |
fng_statistics_term_sorted(fng_incl, fng_term, fng_groups)
Print the service associated with the term provided.
In alphabetical order and terminate execution; related to -f option.
Source code in humble.py
434 435 436 437 438 439 440 441 442 443 444 445 446 | |
fng_statistics_top()
Print top 20 HTTP fingerprint header statistics.
Grouped by service and terminate execution, related to -f option.
Source code in humble.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
fng_statistics_top_groups(fng_lines, fng_incl)
Count fingerprint headers per service, related to -f option.
Source code in humble.py
365 366 367 368 369 370 | |
fng_statistics_top_result(fng_top_groups, fng_incl)
Print the Top 20 services.
By total number of fingerprint headers, related to -f option.
Source code in humble.py
373 374 375 376 377 378 379 380 381 382 383 384 385 | |
format_analysis_results(*diff, en_cnt_w, t_cnt)
Format differences in the analysis.
Between the last and the current one for the same URL.
Source code in humble.py
644 645 646 647 648 649 650 651 652 653 654 | |
format_html_bold(html_final, ln_rstrip, inside_section)
Bold the section names.
Related to -o html option.
Source code in humble.py
3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 | |
format_html_compatibility(html_final, ln_rstrip)
Write formatted lines for browser compatibility section.
Related to -o html option.
Source code in humble.py
3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 | |
format_html_csp(ln)
Bold Content-Security-Policy header directives.
Related to -o html option.
Source code in humble.py
3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 | |
format_html_empty(ln, ln_rstrip, l_empty)
Apply format to empty HTTP response headers.
By validating line content against a predefined list of empty headers.
Related to -o html option.
Source code in humble.py
3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 | |
format_html_enabled(ln, html_final)
Write formatted lines for the section with enabled HTTP headers.
Related to -o html option.
Source code in humble.py
3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 | |
format_html_fingerprint(args, ln, l_fng)
Write formatted lines for fingerprint headers.
Related to -o html option.
Source code in humble.py
3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 | |
format_html_headers(ln, header_prefixes)
Format HTTP response header lines for an HTML export.
Sanitizes header values using HTML escaping to ensure that special
characters (e.g., < or > in headers) are rendered correctly and do not
interfere with the HTML structure; related to the -o html option.
Source code in humble.py
3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 | |
format_html_info(html_final, ln_rstrip)
Write formatted lines.
For the GitHub URL of humble and the section with basic information.
Related to -o html option.
Source code in humble.py
3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 | |
format_html_references(html_final, ln_rstrip, *, lang_slice)
Write formatted lines for references.
Related to -o html option.
Source code in humble.py
3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 | |
format_html_rest(html_final, ln, *, l_empty, l_total, fng_sorted, header_prefixes)
Write formatted lines for the rest of the sections.
E.g. highlighting in red the insecure headers; related to -o html option.
Source code in humble.py
3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 | |
format_html_totals(ln, l_total)
Highlight in red the header that fails any of the checks.
Related to -o html option.
Source code in humble.py
3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 | |
format_html_warnings(html_final, ln_rstrip, *, ko_strings, ok_string)
Write formatted lines for sections without results.
Either because they have passed all checks or because the headers could not be retrieved.
Related to -o html option.
Source code in humble.py
3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 | |
format_htmlpdf_all_export(line, export_format, target_state, in_browser)
Format the previously selected lines for HTML and PDF exports.
Related to -o all option.
Source code in humble.py
2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 | |
format_json(json_data, json_lns)
Format content, grouping duplicate keys, for a JSON export.
Related to -o json -b options.
Source code in humble.py
2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 | |
format_pdf_chunks(chunk, chunks, chunk_c, i, pdf)
Apply formatting and positioning to blocks of text.
Related to -o pdf option.
Source code in humble.py
3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 | |
format_pdf_lines(line, pdf, ypos)
Identify lines, by length and content, to apply formatting.
Relatede to -o pdf option.
Source code in humble.py
3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 | |
format_pdf_links(i, pdf_string, pdf, pdf_prefixes)
Apply a specific format to lines containing links.
Related to -o pdf option.
Source code in humble.py
3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 | |
generate_csv(final_filename, temp_filename, *, to_xlsx=False, export_all=False)
Export to CSV and XSLX and exit.
Related to -o csv option.
Source code in humble.py
2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 | |
generate_date_groups(year_cnt, url_ln)
Generate a formatted summary of analyses performed on a URL.
By year and month; related to -a option.
Source code in humble.py
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | |
generate_html()
Provide content for the variables of the template.
Source: /additional/html_template.html; related to -o html option.
Source code in humble.py
3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 | |
generate_json(final_filename, temp_filename, *, export_all=False)
JSON export of a brief analysis and exit.
Related to -o json -b options.
Source code in humble.py
2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 | |
generate_json_detailed(final_filename, temp_filename, *, export_all=False)
JSON export of a detailed analysis and exit.
Related to -o json option.
Source code in humble.py
2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 | |
generate_pdf(pdf, tmp_filename, pdf_links, pdf_prefixes, ypos, *, export_all=False)
Generate the required file structure, including metadata.
Related to -o pdf option.
Source code in humble.py
3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 | |
generate_xlsx(final_filename, temp_filename, *, export_all=False)
XLSX spreadsheet export of the analysis and exit.
Related to -o xlsx option.
Tip
xlsxwriter is lazy-loaded to avoid unnecessary overhead when XLSX
export is not used.
Source code in humble.py
2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 | |
generate_xml(final_filename, temp_filename, *, export_all=False)
XML export of the analysis, related to -o xml option.
Note
According to here (XML vulnerabilities section), here and here the minimum Python version required to run humble (3.11) should not be vulnerable to common XML attacks.
Additionally, the DTD used to generate the XML is defined in the
constant DTD_CONTENT.
Source code in humble.py
3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 | |
get_additional_metrics(adj_url_ln)
Compute the total of analyses performed on a URL, by month and year.
Related to -a option.
Source code in humble.py
791 792 793 794 795 796 797 798 799 | |
get_analysis_metrics(all_analysis)
Compute statistics for all analyses performed on a given URL.
Related to -a option.
Source code in humble.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | |
get_analysis_results()
Print analysis results and summary.
Source code in humble.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
get_analysis_totals(url_ln)
Recover analysis totals, normalizing those performed before 11/28/2024.
Note
To avoid errors with analyses performed before 11/28/2024, the date on which enabled security headers began being considered when calculating differences between analyses of the same URL.
Therefore, analyses performed before that date are assumed to have no security headers enabled.
Source code in humble.py
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
get_analytics_length(section)
Return the alignment padding for each item in a section.
Source code in humble.py
1658 1659 1660 1661 1662 1663 1664 1665 | |
get_averages_metrics(analytics_w, third_m)
Print average-related metrics details for a URL analysis.
Related to -a option.
Source code in humble.py
981 982 983 984 985 986 987 988 989 990 | |
get_basic_global_metrics(analytics_l, total_a, first_m)
Print metrics details across all URL analyses.
Related to -a option.
Source code in humble.py
1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 | |
get_basic_metrics(total_a, first_m)
Print base metrics details for a URL analysis.
Related to -a option.
Source code in humble.py
945 946 947 948 949 950 951 952 953 954 955 | |
get_cicd_labels()
Print literals related to the analysis designed for CI/CD.
Related to -cicd option.
Source code in humble.py
2550 2551 2552 2553 2554 2555 2556 | |
get_date_metrics(additional_m)
Print date-related metrics details related.
Source code in humble.py
1009 1010 1011 | |
get_detail(id_mode, *, replace=False)
Print a message, optionally removing newlines.
Source code in humble.py
1748 1749 1750 1751 1752 1753 1754 1755 1756 | |
get_enabled_headers(args, headers_l, t_enabled)
Print the contents of the section with enabled security headers.
Highlighting the experimental ones.
Note
The file associated with this check is security.txt.
The highlighted headers
are defined in the EXP_HEADERS tuple and correspond to some of those
indicated in the MDN list
of HTTP headers.
Source code in humble.py
1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 | |
get_epilog_content(id_mode)
Return examples of use and contribution guidelines for humble.py.
Related to -h option.
Source code in humble.py
1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 | |
get_fingerprint_detail(header, headers, idx_fng, l_fng_ex, args)
Print the name, service and value of the fingerprint header.
Source: /additional/fingerprint.txt.
Source code in humble.py
1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 | |
get_fingerprint_headers()
Print the content in the section with fingerprint headers.
Note
The file associated with this check is fingerprint.txt.
Source code in humble.py
1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 | |
get_first_metrics(adj_url_ln)
Compute key analytics metrics of the analyses performed on a URL.
Related to -a option.
Source code in humble.py
750 751 752 753 754 755 756 757 758 759 760 761 | |
get_global_first_metrics(adj_url_ln)
Compute key analytics metrics across all URL analyses.
Related to -a option.
Source code in humble.py
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | |
get_global_metrics(url_ln, url_lines)
Compute key analytics metrics across all URL analyses.
Related to -a option.
Source code in humble.py
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 | |
get_global_totals(url_ln, field)
Compute totals metrics across all URL analyses.
Related to -a option.
Source code in humble.py
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | |
get_highlights(adj_url_ln)
Compute highlight metrics of analyses performed on a URL.
Related to -a option.
Source code in humble.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | |
get_highlights_metrics(fourth_m)
Print highlight-related metrics details for a URL analysis.
Related to -a option.
Source code in humble.py
993 994 995 996 997 998 | |
get_insecure_checks()
Skips security checks for specified HTTP response headers.
Related to -s option.
Source code in humble.py
2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 | |
get_l10n_content()
Load the localization file for the specified language.
Source code in humble.py
543 544 545 546 547 548 | |
get_max_lnlength(section)
Return the length of the longest item in a section.
Source code in humble.py
1647 1648 1649 1650 1651 1652 1653 1654 1655 | |
get_month_counts(year, url_ln)
Compute the total of analyses performed on a URL by month.
Related to -a option.
Source code in humble.py
834 835 836 837 838 839 840 841 842 843 844 845 | |
get_second_metrics(adj_url_ln, index, total_a)
Compute the total of analyses performed on a URL that meet a key metric.
Related to -a option.
Source code in humble.py
764 765 766 767 768 769 770 771 772 773 | |
get_security_metrics(analytics_s, second_m)
Print security metrics for a URL analysis.
Related to -a option.
Source code in humble.py
958 959 960 961 962 963 964 965 966 967 968 | |
get_skipped_unsupported_headers(cli_headers, insecure_headers, file_skipped)
Validate skipped headers against the list of analyzed security headers.
Return unsupported header names and the list of headers to skip during analysis.
Source code in humble.py
2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 | |
get_third_metrics(adj_url_ln)
Compute metrics related to averages of analyses performed on a URL.
Related to -a option.
Source code in humble.py
776 777 778 779 780 781 782 783 784 785 786 787 788 | |
get_tmp_file(args, export_date)
Determine the temporary export file path for the current analysis.
Selects between a custom name (via -of) or a generated one based on date,
language, and URL; applies the correct extension and resolves the absolute
path if an output directory is specified (via -op option).
Related to -o option.
Source code in humble.py
4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 | |
get_trend_metrics(fifth_m)
Print trend-related metrics details for a URL analysis.
Source code in humble.py
1001 1002 1003 1004 1005 1006 | |
get_trends(adj_url_ln)
Print trends based on the totals of analyses performed on a URL.
Source code in humble.py
880 881 882 883 884 885 886 887 888 889 890 891 | |
get_user_agent(user_agent_id)
Select and validate the User-Agent for a URL analysis.
Source: additional/user-agents.txt. Exit if it is not found; related to
-ua option.
Source code in humble.py
2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 | |
get_warnings_metrics(additional_m, analytics_w)
Print warning-related metrics details for a URL analysis.
Related to -a option.
Source code in humble.py
971 972 973 974 975 976 977 978 | |
grade_analysis(en_cnt, m_cnt, f_cnt, i_cnt, e_cnt)
Grade the analysis based on its results.
Source code in humble.py
668 669 670 671 672 673 674 675 676 677 678 | |
header_eligible(header)
Check if an HTTP response header is eligible to be analyzed.
Returns True if the header is present in headers_l (a dictionary
storing the lowercased HTTP response headers of the analyzed URL)
and not in the list of headers skipped via the -s option;
False otherwise.
Source code in humble.py
2153 2154 2155 2156 2157 2158 2159 2160 2161 | |
initialize_pdf(pdf, tmp_filename, ypos, *, export_all=False)
Retrieve literals to apply the appropriate formatting.
Related to -o pdf option.
Source code in humble.py
3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 | |
json_detailed_empty(json_lns)
Print the contents of empty HTTP response headers values.
Related to -o json option.
Source code in humble.py
2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 | |
json_detailed_fng(json_lns, fingerprint_set)
Select the lines to include in the fingerprint section.
Related to -o json option.
Source code in humble.py
3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 | |
json_detailed_fng_process(line, fingerprint_set, entry, current_header, fng_header, fng_val)
Format the lines to include in the fingerprint section.
Related to -o json option.
Source code in humble.py
3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 | |
json_detailed_format(json_lns, *, is_compat=False, is_l10n=False)
Format lines in specific sections.
Related to -o json option.
Source code in humble.py
2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 | |
json_detailed_format_add(json_lns, header_t, value_t)
Convert raw header lines into a list using the given header.
Related to -o json option.
Source code in humble.py
2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 | |
json_detailed_info(json_lns)
Print the contents of basic info.
Related to -o json option.
Source code in humble.py
2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 | |
json_detailed_ins(json_lns, insecure_checks)
Select the lines to include in the deprecated/insecure section.
Related to -o json option.
Source code in humble.py
3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 | |
json_detailed_ins_append(line, ref_t, ref_o, entry, header, header_t, detail_t, result, is_header)
Add lines to the deprecated/insecure headers section.
Related to -o json option.
Source code in humble.py
3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 | |
json_detailed_ins_checks(checks_list, insecure_checks)
Select the content to include in the deprecated/insecure section.
Related to -o json option.
Source code in humble.py
3111 3112 3113 3114 3115 3116 3117 3118 3119 | |
json_detailed_ins_headers(line, line_s, checks_list, ref_t)
Determine if a line represents a deprecated/insecure header.
Related to -o json option.
Source code in humble.py
3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 | |
json_detailed_ins_process(json_lns, checks_list, ref_t, ref_o, header_t, detail_t)
Format the lines to include in the deprecated/insecure section.
Related to -o json option.
Source code in humble.py
3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 | |
json_detailed_miss(json_lns, l_miss, json_miss_h, json_miss_d, json_miss_r)
Select the lines to include in the missing section.
Related to -o json option.
Source code in humble.py
2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 | |
json_detailed_miss_add(json_lns, l_miss, json_miss_keys, json_det_mref)
Add lines to the missing section.
Related to -o json option.
Source code in humble.py
2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 | |
json_detailed_miss_process(line, l_miss, json_miss_keys, json_det_mref, result, entry)
Format lines in the missing section.
Related to -o json option.
Source code in humble.py
2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 | |
json_detailed_parse(data, txt_sections)
Parse sections for a JSON export, related to -o json option.
Source code in humble.py
2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 | |
json_detailed_response(json_lns)
Print the contents of HTTP response headers.
Related to -o json option.
Source code in humble.py
2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 | |
json_detailed_results(json_lns)
Add detailed content to the sections.
Related to -o json option.
Source code in humble.py
3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 | |
json_detailed_sources(file_idx, slice_idx)
Read source file contents from the /additional path for a JSON export.
Extracts a sliced subset of lines for use in fingerprint and
deprecated/insecure header sections; related to -o json option.
Source code in humble.py
2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 | |
json_detailed_write(json_lns, json_section, json_miss_h, json_miss_d, json_miss_r)
Write sections for a JSON export, related to -o json option.
Source code in humble.py
2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 | |
make_http_request(custom_headers, proxy)
Make the request to the provided URL, disabling certain checks.
Note
I have disabled the following checks to allow the analysis of URLs in certain cases (e.g., development environments, hosts with outdated servers/software or self-signed certificates) and because they exceed the scope of this tool:
- Certificate Verification
- Hostname Verification
- Certificate Requirement
If -df option is provided (args.redirects) the exact URL will
be analyzed; otherwise the last redirected URL will be analyzed.
Source code in humble.py
4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 | |
match_url_lines(all_analysis)
Return history lines whose URL field exactly matches URL.
Splitting on " ; " and comparing the URL field (index 1) avoids
substring collisions (e.g. example.com vs example.com.evil.com);
related to -a option and to the analysis history file.
Source code in humble.py
567 568 569 570 571 572 573 574 575 | |
normalize_htmlpdf_all_export(export_format, tmp_filename, final_filename=None)
Normalize section and line formatting for HTML and PDF exports.
Processes the analysis output and delegates to the appropriate export
function; related to -o all option.
Source code in humble.py
2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 | |
normalize_output_file(filename)
Normalize the filename by stripping paths and removing extensions.
Aborts execution if the resulting filename is invalid (e.g., '.html').
Source code in humble.py
4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 | |
normalize_txt_all_export(tmp_filename)
Apply format to section and lines to the TXT file.
Related to -o all option.
Source code in humble.py
2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 | |
nourl_user_agent(user_agent_id)
Display available User-Agents if the ID is 0.
Otherwise, display an error indicating that a URL is required for the
provided User-Agent ID; related to -ua option.
Source code in humble.py
2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 | |
parse_cicd_lines(line, pattern, cicd_total_t, cicd_diff_t)
Process lines associated with analysis designed for CI/CD.
Related to -cicd option.
Source code in humble.py
2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 | |
parse_cicd_sections(cicd_diff_t, cicd_total_t, lines)
Parse analysis output into CI/CD info and totals sections.
Extracts metadata and scoring lines from the analysis, computes totals,
and appends the grade detail; related to --cicd option.
Source code in humble.py
2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 | |
parse_cicd_totals(cicd_totals_lines, cicd_total_t, cicd_diff_t, pattern)
Print the total of findings per section.
Along with the differences between the current analysis and the last one performed against the URL; designed for CI/CD.
Related to -cicd option.
Source code in humble.py
2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 | |
parse_csv(csv_section, csv_source, csv_writer)
Extract and write data for matching section items for a CSV export.
Related to -o csv option.
Source code in humble.py
2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 | |
parse_har_file(file_path)
Parse a HAR file.
Source code in humble.py
3976 3977 3978 3979 3980 3981 3982 3983 | |
parse_input_file(input_headers, input_source, status_code)
Parse the headers and values.
Related to -if option.
Source code in humble.py
4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 | |
parse_json(sections, txt_sections)
Parse sections for a JSON export; related to -o json -b options.
Source code in humble.py
2762 2763 2764 2765 2766 2767 2768 2769 2770 | |
parse_request_headers(request_headers)
Add the provided headers to the request.
Exit if any of them are not well-formed; related to -H option.
Source code in humble.py
4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 | |
parse_user_agent(*, user_agent=False)
Select and validate the provided user agent, related to -ua option.
Source code in humble.py
2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 | |
parse_xml(root, section, stripped_txt)
Parse sections of an XML export; related to -o xml option.
Source code in humble.py
3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 | |
permissions_analyze_content(perm_header, i_cnt)
Permissions-Policy header analysis.
Source code in humble.py
1451 1452 1453 1454 1455 1456 1457 1458 | |
permissions_check_broad(perm_header)
Permissions-Policy header check related to broad values.
Source code in humble.py
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | |
permissions_print_broad(perm_broad_dirs, i_cnt)
Print the broad values in the Permissions-Policy header.
Source code in humble.py
1494 1495 1496 1497 1498 1499 1500 1501 1502 | |
permissions_print_deprecated(perm_header)
Print deprecated directives in the Permissions-Policy header.
Source code in humble.py
1461 1462 1463 1464 1465 1466 1467 1468 1469 | |
print_analysis_results(totals, max_secl, en_cnt_w)
Print the totals for the current analysis.
Source code in humble.py
657 658 659 660 661 662 663 664 665 | |
print_basic_info(export_filename)
Print basic analysis details.
Date, time, URL, User-Agent (-ua option), input file (-if option) and
exported filename (-o option).
Source code in humble.py
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 | |
print_browser_compatibility(compat_headers)
Print links for browser compatibility of enabled HTTP headers.
Note
References provided by Can I use.
Source code in humble.py
1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 | |
print_cicd_totals(tmp_filename, threshold_grade=None)
Print a JSON-formatted CI/CD summary and exits.
If threshold_grade is provided, appends a 'Security Gate' field and exits
if the analysis grade does not reach that threshold; equal grades pass.
Source code in humble.py
2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 | |
print_detail(id_mode, num_lines=1)
Print detailed information about the finding across multiple lines.
Source code in humble.py
1677 1678 1679 1680 1681 1682 1683 | |
print_detail_l(id_mode, *, analytics=False, no_headers=False)
Print detailed information about the finding.
Removing lines from the output based on it.
Note
pairwise is used to match each bracketed ID with its corresponding
descriptive text on the following line (bridging the line break) from
l10n_main, which contains the multilingual strings and descriptions
used for the final report.
Source code in humble.py
1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 | |
print_detail_r(id_mode, *, is_red=False)
Print detailed information about the finding using a distinctive format.
Note
pairwise is used to match each bracketed ID with its corresponding
descriptive text on the following line (bridging the line break) from
l10n_main, which contains the multilingual strings and descriptions
used for the final report.
Source code in humble.py
1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | |
print_detail_s(id_mode, *, max_ln=False)
Print message with leading newline and optional whitespace preservation.
Note
pairwise is used to match each bracketed ID with its corresponding
descriptive text on the following line (bridging the line break) from
l10n_main, which contains the multilingual strings and descriptions
used for the final report.
Source code in humble.py
1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 | |
print_details(short_d, long_d, id_mode, i_cnt)
Print detailed information about the finding.
Source code in humble.py
1668 1669 1670 1671 1672 1673 1674 | |
print_empty_headers(headers, l_empty)
Print the contents of the section with empty HTTP response headers.
Source code in humble.py
1951 1952 1953 1954 1955 1956 1957 1958 1959 | |
print_enabled_headers(args, exp_s, header, headers_d)
Print enabled HTTP response headers.
Source: additional/security.txt.
Source code in humble.py
1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 | |
print_error_detail(id_mode, *, clean_lines=False)
Print an error message and exit, optionally clearing previous output.
Source code in humble.py
1759 1760 1761 1762 1763 1764 | |
print_export_path(filename, reliable, *, export_all=False)
Print the export path.
Displays the file path for single reports (e.g. 'html') or the directory
for bulk exports (e.g. 'all'); related to -o option.
Source code in humble.py
1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 | |
print_extended_info(args, reliable, status_code, headers_skipped, skip_set)
Print extended analysis details.
Request (-H option) and skipped (-s option) headers, proxy usage
(-p option) and specific HTTP 4xx errors.
Source code in humble.py
1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 | |
print_extra_info(reliable)
Print supplementary analysis details.
Specific 4xx errors, reliability warnings and redirects (-df option).
Source code in humble.py
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 | |
print_fingerprint_headers(headers_l, l_fng_ex, titled_fng)
Identify and print fingerprint headers.
Source code in humble.py
1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 | |
print_fng_header(header)
Print the header name in the section with fingerprint headers.
Source code in humble.py
1548 1549 1550 1551 1552 1553 | |
print_general_info(reliable, export_filename, headers_skipped, skip_set)
Print the content in the section with basic information.
Source code in humble.py
1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | |
print_global_metrics(analytics_l, analytics_s, analytics_w, total_a, first_m, second_m, third_m, additional_m)
Print metrics across all URL analyses, related to -a option.
Source code in humble.py
1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | |
print_header(header)
Print the header name.
Source code in humble.py
1543 1544 1545 | |
print_http_exception(exception_id, exception_v)
Print the exception received during analysis.
Source code in humble.py
3834 3835 3836 3837 3838 3839 | |
print_l10n_file(args, l10n_file, *, slice_ln=False)
Print the contents of a file in the specified language and exit.
Source code in humble.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
print_metrics(analytics_s, analytics_w, total_a, *m_data)
Build the metrics dictionary for the final statistics output of a URL.
Consolidates and formats security, analysis, and trend values with localized headers.
Source code in humble.py
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | |
print_missing_headers(args, headers_l, l_detail, l_miss)
Print the contents of the section with missing HTTP Security Headers.
Note
The file associated with this check is missing.txt.
Source code in humble.py
1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 | |
print_nosec_headers(*, enabled=True)
Print a message if no security-related HTTP response headers are enabled.
Or if none was received.
Source code in humble.py
1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 | |
print_nowarnings()
Check if no results were found in sections of the analysis.
Source code in humble.py
1535 1536 1537 1538 1539 1540 | |
print_owasp_findings(header_dict, header_list)
Print OWASP Secure Headers Project check results.
Related to -c option.
Source code in humble.py
3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 | |
print_owasp_missing(header_list)
Print OWASP Secure Headers Project missing check results.
Related to -c option.
Source code in humble.py
3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 | |
print_owasp_rec(wrong_owasp, header_dict)
Print OWASP Secure Headers Project recommended values check results.
Related to -c option.
Source code in humble.py
3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 | |
print_owasp_summary(missing, wrong)
Format lines for results of OWASP Secure Headers Project checks.
Related to -c option.
Source code in humble.py
3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 | |
print_owasp_wrong(header_dict)
Print OWASP Secure Headers Project enabled headers check results.
Related to -c option.
Source code in humble.py
3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 | |
print_request_headers(added_request_headers)
Print requested HTTP request headers.
Source code in humble.py
2164 2165 2166 2167 2168 2169 2170 2171 | |
print_response_headers()
Print response headers, related to -r option.
Source code in humble.py
1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 | |
print_skipped_headers(skip_set)
Print skipped HTTP response headers.
Source code in humble.py
2144 2145 2146 2147 2148 2149 2150 | |
print_unsafe_cookies(unsafe_cks)
Print unsafe cookies in the Set-Cookie header.
Source code in humble.py
1444 1445 1446 1447 1448 | |
print_unsupported_headers(unsupported_headers)
Print unsupported HTTP response headers.
For those which it has been expressly indicated to skip their security analysis and exit.
Source code in humble.py
2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 | |
print_user_agents(user_agents)
Print available User-Agents and exit.
Related to -ua option.
Source code in humble.py
2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 | |
process_htmlpdf_all_export(lines, start_index, export_format, is_html)
Process line formatting and section prefixing for HTML and PDF exports.
Applies state-based formatting to each line; related to -o all option.
Source code in humble.py
2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 | |
process_http_error(r, exception_d)
Print error messages based on HTTP response code during analysis.
Source code in humble.py
4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 | |
process_http_request(status_code, reliable, body, proxy, custom_headers)
Perform an HTTP request using a background thread.
It manages response processing and ensure the target URL is reachable within a set timeout.
The analysis is flagged as unreliable if a response isn't received within
the (REQ_TIMEOUT - REQ_WARNING) constants. The function will terminate
execution if the request exceeds the REQ_TIMEOUT constant.
Source code in humble.py
4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 | |
process_http_response(r, exception, status_code, reliable, body)
Process an HTTP response and its exceptions.
Storing headers, status code and body, and determining if the analyzed URL returns an HTML document.
Note
References:
Source code in humble.py
4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 | |
process_proxy_url(proxy_url, timeout)
Parse and validate proxy URL accessibility, related to -p option.
Source code in humble.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
process_request_headers(request_headers)
Verify that the request headers provided are well-formed.
Exit if empty entries are found, while returning a list of any malformed headers.
Source code in humble.py
4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 | |
process_requests_exception(exception)
Print error messages for request timeout and unhandled exceptions.
Source code in humble.py
4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 | |
process_server_error(http_status_code, l10n_id)
Print error message for specific server error (5xx) during analysis.
Source code in humble.py
4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 | |
save_analysis_results(t_cnt)
Save analysis results to the analysis history file, analysis_h.txt.
Info
Totals, in order, of each entry in the history file:
- Date of analysis
- URL analyzed
- Total number of enabled headers
- Total number of missing headers
- Total number of fingerprint headers
- Total number of deprecated/insecure headers
- Total number of empty headers
- Total number of warnings (the four previous totals)
Source code in humble.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | |
sections_htmlpdf_all_export(line, states)
Identify lines requiring specific formatting for HTML and PDF exports.
Matches each line against known section prefixes and returns the appropriate
formatting state; related to -o all option.
Source code in humble.py
2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 | |
set_pdf_chunks(chunks, pdf)
Identify blocks of text to format them.
Related to -o pdf option.
Source code in humble.py
3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 | |
set_pdf_conditions(line, pdf, ypos)
Determine whether to apply specific formatting to a line in a PDF export.
Checks the line against response header conditions and delegates formatting
to set_pdf_warnings if matched; related to -o pdf option.
Source code in humble.py
3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 | |
set_pdf_content(tmp_filename, ok_string, no_headers, pdf, pdf_links, pdf_prefixes, ypos)
Set the format and sections.
Related to -o pdf option.
Source code in humble.py
3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 | |
set_pdf_empty(l_empty, line, pdf, ypos)
Format line with empty headers.
Related to -o pdf option.
Source code in humble.py
3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 | |
set_pdf_file(pdf)
Set display parameters along with metadata.
Related to -o pdf option.
Note
The defined zoom=100 percentage may be ignored by some PDF readers.
For optimal viewing, set the zoom level to 100% manually after opening
the file.
Source code in humble.py
3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 | |
set_pdf_format(line, ok_string, pdf, pdf_links, pdf_prefixes, ypos)
Apply specific format to lines based on its content.
Related to -o pdf option.
Source code in humble.py
3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 | |
set_pdf_links(i, pdf_string)
Check if the line includes a link, to display it with a specific format.
Related to -o pdf option.
Source code in humble.py
3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 | |
set_pdf_metadata(pdf)
Set metadata values for a PDF export; related to -o pdf option.
Source code in humble.py
3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 | |
set_pdf_nowarnings(line, pdf, ypos)
Format line without warnings.
Related to -o pdf option.
Source code in humble.py
3323 3324 3325 3326 3327 3328 3329 | |
set_pdf_sections(line, pdf)
Set the sections of the analysis.
Related to -o pdf option.
Source code in humble.py
3271 3272 3273 3274 3275 3276 3277 3278 3279 | |
set_pdf_warnings(line, pdf, ypos)
Format warnings-related lines.
Related to -o pdf option.
Source code in humble.py
3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 | |
set_xlsx_content(final_filename, workbook)
Define the content and format of the data for a XLSX export.
Related to -o xlsx option.
Source code in humble.py
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 | |
set_xlsx_format(bold_fmt, cell_fmt, col_wd, final_filename, hidden_fmt, worksheet)
Write formatted content with dynamic column widths for a XLSX export.
Related to -o xlsx option.
Note
This function uses defusedcsv to mitigate formula injection attacks
by sanitizing potentially dangerous values.
Source code in humble.py
2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 | |
set_xlsx_metadata(workbook)
Set metadata values for a XLSX export, related to -o xlsx option.
Source code in humble.py
2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 | |
set_xlsx_width(col_wd, worksheet)
Set column widths for a XLSX export, related to -o xlsx option.
Source code in humble.py
2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | |
testssl_analysis(testssl_cmd)
Run TLS/SSL analysis with testssl.sh, related to -e option.
Note
This function is safe from injection: shell=True is not used,
arguments are passed as a list and testssl.sh options are defined in
the TESTSSL_OPTIONS constant.
Source code in humble.py
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | |
testssl_command(testssl_temp_path, uri)
Prepare the TLS/SSL analysis.
Validate the URI and prompt the user to accept terms and exit if declined;
related to -e option.
Tip
The options used in the analysis are defined in the TESTSSL_OPTIONS
constant:
-f: checks robust forward secrecy key exchange-g: checks several server implementation bugs-p: checks the availability of SSL/TLS protocols-U: tests all vulnerabilities, like Heartbleed, ROBOT and sweet32-s: tests lists of cipher suites/categories by strength--hints: (available in the future) give hints how to fix a finding
Check the testssl.sh documentation for a list of all available options.
Source code in humble.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
threshold_cicd(threshold_grade, totals)
CI/CD threshold validation.
Related to -cicd GRADE option.
Source code in humble.py
2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 | |
url_analytics(*, is_global=False)
Print analysis statistics for all analyses performed on a URL and exit.
Related to the -a option.
Source code in humble.py
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | |
validate_cicd_grade(threshold_norm, threshold_grade, totals)
Validate the target threshold and the actual analysis grade.
Ensures both grades exist within GRADE_ORDER: exits in case of an invalid
threshold or an undeterminable analysis grade.
Source code in humble.py
2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 | |
validate_file_access(target_path, *, context='history')
Check if the history or export files can be accessed or created.
Exit if an error occurs during the export of an analysis.
Source code in humble.py
2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 | |
validate_path(output_path)
Validate permissions in the provided path.
Exit in case of error, related to -op option.
Source code in humble.py
1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 | |
validate_testssl_uri(uri)
Check that the URI is well-formed before analyzing it.
Exit with a specific message if the URI has no scheme, an unsupported
one, or no host; related to -e option.
Source code in humble.py
465 466 467 468 469 470 471 472 473 474 475 476 477 | |
validate_url(url)
Exit cleanly if the URL cannot be parsed.
urlparse() raises ValueError on malformed URLs (e.g. an unclosed
IPv6 bracket), and accessing .port does so on an invalid port; this
guards check_russian_scope() and every later consumer from an
uncaught traceback. Scheme and host remain the responsibility of the
requests library, reported via exception_d.
Related to -u option.
Source code in humble.py
3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 | |
write_csv_content(csv_file, txt_source)
Write headers and parse content.
Related to -o csv option.
Note
defusedcsv is used to mitigate formula injection attacks by
sanitizing potentially dangerous values
Source code in humble.py
2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 | |
write_html_line(html_final, ln, html_writers, html_rest, inside_section)
Write a single line of the analysis, applying the first matching rule.
Section names are handled apart, being the only stateful case; lines
matching no rule fall through to format_html_rest().
Related to -o html option.
Source code in humble.py
3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 | |
write_json(json_lns, json_section, sections)
Format content for a JSON export.
Related to -o json -b options.
Source code in humble.py
2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 | |