🔧 chk_url_ips V1R1 — Rapport technique🔧 chk_url_ips V1R1 — Rapport technique
Métriques clés
Key metrics
| Indicateur | Valeur |
|---|---|
| Lignes de code | ~2 800 |
| Fonctions principales | 45+ |
| Formats d'hôtes | hostname, IP, plage IP, CIDR |
| Sorties | HTML · JSON cert · JSON RDAP · CSV |
| Plateformes | Windows · Linux · macOS |
| Dépendances | cryptography · requests · ipwhois · tldextract · paramiko (optionnel) |
| Metric | Value |
|---|---|
| Lines of code | ~2 800 |
| Main functions | 45+ |
| Host formats | hostname, IP, IP range, CIDR |
| Outputs | HTML · JSON cert · JSON RDAP · CSV |
| Platforms | Windows · Linux · macOS |
| Dependencies | cryptography · requests · ipwhois · tldextract · paramiko (optional) |
Architecture — flux d'exécution
Architecture — execution flow
argparse → analyze_hosts() → expand_ip_range() → main(host, port)
↓
fetch_cert_chain() → openssl s_client → save_certificates()
↓
process_extensions() + resolve_domain_ips() → dns_ips_list_v4
↓
build_dns_resolution_table(level) → dns_resolution_table
build_analysis_summary() → status + renewal commands
get_rdap_json_from_ip() + parse_rdap_network() → rdap_network
↓
generate_html_report() · generate_json_report() · generate_csv_report()
argparse → analyze_hosts() → expand_ip_range() → main(host, port)
↓
fetch_cert_chain() → openssl s_client → save_certificates()
process_extensions() + resolve_domain_ips() → dns_ips_list_v4
build_dns_resolution_table(level) → dns_resolution_table
build_analysis_summary() → status + renewal commands
get_rdap_json_from_ip() + parse_rdap_network() → rdap_network
generate_html_report() · generate_json_report() · generate_csv_report()
Fonctions principales
Main functions
| Fonction | Rôle | Retour |
|---|---|---|
| analyze_hosts() | Point d'entrée principal — orchestration complète | None |
| main(host, port) | Analyse un host:port — boucle sur les IPs résolues | list[str] DNS clean |
| fetch_cert_chain() | Récupère la chaîne PEM via openssl s_client | CertChainResult |
| save_certificates() | Parse les PEM → objets x509, extrait métadonnées | CertChainResult |
| process_extensions() | Extrait les SANs, résout les IPs (level 1) | list[str] |
| build_dns_resolution_table() | Construit table dns_to_ips + ip_to_dns (level 0/1/2) | dict |
| build_analysis_summary() | Évalue expiration, algo, taille clé → commandes renouvellement | dict |
| get_rdap_json_from_ip() | Interroge ARIN RDAP pour une IP | dict |
| parse_rdap_network() | Extrait les champs utiles du JSON RDAP brut | dict |
| generate_html_report() | Produit le rapport HTML dark theme autonome | None (fichier) |
| resolve_domain_ips() | Résolution DNS avec @lru_cache | tuple |
| expand_ip_range() | Expanse une plage IP en liste d'IPs | tuple(int, list) |
| verify_chain() | Vérifie les liens issuer→subject de la chaîne | None |
| Function | Role | Return |
|---|---|---|
| analyze_hosts() | Main entry point — full orchestration | None |
| main(host, port) | Analyses one host:port — loops over resolved IPs | list[str] clean DNS |
| fetch_cert_chain() | Retrieves PEM chain via openssl s_client | CertChainResult |
| save_certificates() | Parses PEM → x509 objects, extracts metadata | CertChainResult |
| process_extensions() | Extracts SANs, resolves IPs (level 1) | list[str] |
| build_dns_resolution_table() | Builds dns_to_ips + ip_to_dns tables (level 0/1/2) | dict |
| build_analysis_summary() | Evaluates expiry, algo, key size → renewal commands | dict |
| get_rdap_json_from_ip() | Queries ARIN RDAP for an IP | dict |
| parse_rdap_network() | Extracts useful fields from raw RDAP JSON | dict |
| generate_html_report() | Produces standalone dark-theme HTML report | None (file) |
| resolve_domain_ips() | DNS resolution with @lru_cache | tuple |
| expand_ip_range() | Expands an IP range to a list of IPs | tuple(int, list) |
| verify_chain() | Verifies issuer→subject links in the chain | None |
Structure des rapports HTML
HTML report structure
Chaque rapport HTML généré contient les sections suivantes dans l'ordre :
- Analysis Summary — banner vert/amber/rouge + commandes renouvellement si anomalie
- Summary bar — temps restant, nombre de certificats, IP, organisation
- Network Info (RDAP) — organisation, handle, CIDR, country, range
- Certificats — une card par certificat (subject, issuer, dates, empreintes, extensions SANs avec IPs)
- DNS Resolution Table — panel 1 : DNS→IPv4 · panel 2 : IP unique→noms (cert/PTR)
Each generated HTML report contains the following sections in order:
- Analysis Summary — green/amber/red banner + renewal commands if anomaly detected
- Summary bar — time remaining, certificate count, IP, organisation
- Network Info (RDAP) — organisation, handle, CIDR, country, range
- Certificates — one card per certificate (subject, issuer, dates, fingerprints, SAN extensions with IPs)
- DNS Resolution Table — panel 1: DNS→IPv4 · panel 2: unique IPs→names (cert/PTR)
Répertoire de sortie
Output directory
Le répertoire racine _SCRIPT_ROOT est dérivé du nom du script sans extension, créé dans le répertoire courant au moment du lancement (CWD). Chaque outil garde ainsi son propre arbre de sortie.
CWD/chk_url_ips_V1R1/{html,json,csv,certificate,tmp,log}/CUSTOMER/YYYYMMDD/
The root directory _SCRIPT_ROOT is derived from the script name without extension, created in the current working directory at launch time (CWD). Each tool thus keeps its own output tree.
CWD/chk_url_ips_V1R1/{html,json,csv,certificate,tmp,log}/CUSTOMER/YYYYMMDD/
Compatibilité Windows
Windows compatibility
Toutes les créations de répertoires utilisent Path.mkdir(parents=True, exist_ok=True). Les chemins sont construits via pathlib.Path. L'encodage console est géré avec errors='replace'. Compatible Windows 10/11 avec Python 3.8+.
All directory creation uses Path.mkdir(parents=True, exist_ok=True). Paths are built via pathlib.Path. Console encoding is handled with errors='replace'. Compatible with Windows 10/11 and Python 3.8+.