Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions src/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# Copyright (C) 2025 Alexia Michelle
# This file is distributed under the same license as the sslcheck package.
# Alexia Michelle <alexia@goldendoglinux.org>, 2025.

msgid ""
msgstr ""
"Project-Id-Version: sslcheck 1.2.0\n"
"Report-Msgid-Bugs-To: alexia@goldendoglinux.org\n"
"POT-Creation-Date: 2025-06-15 21:03-0300\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-16 08:36-0600\n"
"PO-Revision-Date: 2025-06-15 21:10-0300\n"
"Last-Translator: Alexia Michelle <alexia@goldendoglinux.org>\n"
"Language-Team: English <en@li.org>\n"
Expand All @@ -27,7 +26,8 @@ msgid ""
"sslcheck <domain> prints domain and remainder of days until cert "
"expires\n"
msgstr ""
"sslcheck <domain> prints domain and remainder of days until cert expires\n"
"sslcheck <domain> prints domain and remainder of days until cert "
"expires\n"

#: sslcheck.c:67
#, c-format
Expand All @@ -54,32 +54,42 @@ msgstr "-h --help prints this menu\n"
msgid "-v --version prints version\n"
msgstr "-v --version prints version\n"

#: sslcheck.c:138
#: sslcheck.c:152
#, c-format
msgid "Error creating SSL context\n"
msgstr "Error creating SSL context\n"

#: sslcheck.c:153
#: sslcheck.c:167
#, c-format
msgid "Error getting SSL object\n"
msgstr "Error getting SSL object\n"

#: sslcheck.c:166
#: sslcheck.c:180
#, c-format
msgid "Error connecting to %s\n"
msgstr "Error connecting to %s\n"

#: sslcheck.c:177
#: sslcheck.c:191
#, c-format
msgid "No certificate found for %s\n"
msgstr "No certificate found for %s\n"

#: sslcheck.c:188
#: sslcheck.c:204
#, c-format
msgid "Could not calculate certificate expiration\n"
msgstr "Could not calculate certificate expiration\n"

#: sslcheck.c:195
#: sslcheck.c:214
#, c-format
msgid "Expired %d days ago\n"
msgstr "Expired %d days ago\n"

#: sslcheck.c:220
#, c-format
msgid "Domain: %s | Certificate EXPIRED %d days ago\n"
msgstr "Domain: %s | Certificate EXPIRED %d days ago\n"

#: sslcheck.c:222
#, c-format
msgid "Domain: %s | Days until Certification expires: %d\n"
msgstr "Domain: %s | Days until Certification expires: %d\n"
30 changes: 20 additions & 10 deletions src/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# Copyright (C) 2025 Alexia Michelle
# This file is distributed under the same license as the sslcheck package.
# Alexia Michelle <alexia@goldendoglinux.org>, 2025.

msgid ""
msgstr ""
"Project-Id-Version: sslcheck 1.2.0\n"
"Report-Msgid-Bugs-To: alexia@goldendoglinux.org\n"
"POT-Creation-Date: 2025-06-15 21:03-0300\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-16 08:36-0600\n"
"PO-Revision-Date: 2025-06-15 21:10-0300\n"
"Last-Translator: Alexia Michelle <alexia@goldendoglinux.org>\n"
"Language-Team: Spanish <es@li.org>\n"
Expand All @@ -27,7 +26,8 @@ msgid ""
"sslcheck <domain> prints domain and remainder of days until cert "
"expires\n"
msgstr ""
"sslcheck <dominio> muestra el dominio y los días restantes hasta que expire el certificado\n"
"sslcheck <dominio> muestra el dominio y los días restantes hasta que "
"expire el certificado\n"

#: sslcheck.c:67
#, c-format
Expand All @@ -54,32 +54,42 @@ msgstr "-h --help muestra este menú\n"
msgid "-v --version prints version\n"
msgstr "-v --version muestra la versión\n"

#: sslcheck.c:138
#: sslcheck.c:152
#, c-format
msgid "Error creating SSL context\n"
msgstr "Error creando el contexto SSL\n"

#: sslcheck.c:153
#: sslcheck.c:167
#, c-format
msgid "Error getting SSL object\n"
msgstr "Error obteniendo el objeto SSL\n"

#: sslcheck.c:166
#: sslcheck.c:180
#, c-format
msgid "Error connecting to %s\n"
msgstr "Error al conectar a %s\n"

#: sslcheck.c:177
#: sslcheck.c:191
#, c-format
msgid "No certificate found for %s\n"
msgstr "No se encontró certificado para %s\n"

#: sslcheck.c:188
#: sslcheck.c:204
#, c-format
msgid "Could not calculate certificate expiration\n"
msgstr "No se pudo calcular la expiración del certificado\n"

#: sslcheck.c:195
#: sslcheck.c:214
#, c-format
msgid "Expired %d days ago\n"
msgstr "Caducado hace %d días\n"

#: sslcheck.c:220
#, c-format
msgid "Domain: %s | Certificate EXPIRED %d days ago\n"
msgstr "Dominio: %s | Certificado caducado hace %d días\n"

#: sslcheck.c:222
#, c-format
msgid "Domain: %s | Days until Certification expires: %d\n"
msgstr "Dominio: %s | Días hasta que vence el certificado: %d\n"
33 changes: 22 additions & 11 deletions src/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# Copyright (C) 2025 Alexia Michelle
# This file is distributed under the same license as the sslcheck package.
# Alexia Michelle <alexia@goldendoglinux.org>, 2025.

msgid ""
msgstr ""
"Project-Id-Version: sslcheck 1.2.0\n"
"Report-Msgid-Bugs-To: alexia@goldendoglinux.org\n"
"POT-Creation-Date: 2025-06-15 21:03-0300\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-16 08:36-0600\n"
"PO-Revision-Date: 2025-06-15 21:10-0300\n"
"Last-Translator: Alexia Michelle <alexia@goldendoglinux.org>\n"
"Language-Team: French <fr@li.org>\n"
Expand All @@ -27,7 +26,8 @@ msgid ""
"sslcheck <domain> prints domain and remainder of days until cert "
"expires\n"
msgstr ""
"sslcheck <domaine> affiche le domaine et le nombre de jours restants avant l'expiration du certificat\n"
"sslcheck <domaine> affiche le domaine et le nombre de jours restants "
"avant l'expiration du certificat\n"

#: sslcheck.c:67
#, c-format
Expand All @@ -42,7 +42,8 @@ msgstr "-j --json <domaine> affiche la sortie au format JSON\n"
#: sslcheck.c:69
#, c-format
msgid "-p --port <port> use custom port instead of 443\n"
msgstr "-p --port <port> utilise un port personnalisé à la place de 443\n"
msgstr ""
"-p --port <port> utilise un port personnalisé à la place de 443\n"

#: sslcheck.c:70
#, c-format
Expand All @@ -54,32 +55,42 @@ msgstr "-h --help affiche ce menu\n"
msgid "-v --version prints version\n"
msgstr "-v --version affiche la version\n"

#: sslcheck.c:138
#: sslcheck.c:152
#, c-format
msgid "Error creating SSL context\n"
msgstr "Erreur lors de la création du contexte SSL\n"

#: sslcheck.c:153
#: sslcheck.c:167
#, c-format
msgid "Error getting SSL object\n"
msgstr "Erreur lors de l'obtention de l'objet SSL\n"

#: sslcheck.c:166
#: sslcheck.c:180
#, c-format
msgid "Error connecting to %s\n"
msgstr "Erreur de connexion à %s\n"

#: sslcheck.c:177
#: sslcheck.c:191
#, c-format
msgid "No certificate found for %s\n"
msgstr "Aucun certificat trouvé pour %s\n"

#: sslcheck.c:188
#: sslcheck.c:204
#, c-format
msgid "Could not calculate certificate expiration\n"
msgstr "Impossible de calculer l'expiration du certificat\n"

#: sslcheck.c:195
#: sslcheck.c:214
#, c-format
msgid "Expired %d days ago\n"
msgstr "Expiré il y a %d jours\n"

#: sslcheck.c:220
#, c-format
msgid "Domain: %s | Certificate EXPIRED %d days ago\n"
msgstr "Domaine : %s | Certificat expiré il y a %d jours\n"

#: sslcheck.c:222
#, c-format
msgid "Domain: %s | Days until Certification expires: %d\n"
msgstr "Domaine: %s | Jours restants avant expiration du certificat: %d\n"
33 changes: 22 additions & 11 deletions src/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# Copyright (C) 2025 Alexia Michelle
# This file is distributed under the same license as the sslcheck package.
# Alexia Michelle <alexia@goldendoglinux.org>, 2025.

msgid ""
msgstr ""
"Project-Id-Version: sslcheck 1.2.0\n"
"Report-Msgid-Bugs-To: alexia@goldendoglinux.org\n"
"POT-Creation-Date: 2025-06-15 21:03-0300\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-16 08:36-0600\n"
"PO-Revision-Date: 2025-06-15 21:10-0300\n"
"Last-Translator: Alexia Michelle <alexia@goldendoglinux.org>\n"
"Language-Team: Italian <it@li.org>\n"
Expand All @@ -27,7 +26,8 @@ msgid ""
"sslcheck <domain> prints domain and remainder of days until cert "
"expires\n"
msgstr ""
"sslcheck <dominio> mostra il dominio e i giorni rimanenti fino alla scadenza del certificato\n"
"sslcheck <dominio> mostra il dominio e i giorni rimanenti fino alla "
"scadenza del certificato\n"

#: sslcheck.c:67
#, c-format
Expand All @@ -42,7 +42,8 @@ msgstr "-j --json <dominio> mostra l'output in formato JSON\n"
#: sslcheck.c:69
#, c-format
msgid "-p --port <port> use custom port instead of 443\n"
msgstr "-p --port <porta> usa una porta personalizzata invece di 443\n"
msgstr ""
"-p --port <porta> usa una porta personalizzata invece di 443\n"

#: sslcheck.c:70
#, c-format
Expand All @@ -54,32 +55,42 @@ msgstr "-h --help mostra questo menu\n"
msgid "-v --version prints version\n"
msgstr "-v --version mostra la versione\n"

#: sslcheck.c:138
#: sslcheck.c:152
#, c-format
msgid "Error creating SSL context\n"
msgstr "Errore nella creazione del contesto SSL\n"

#: sslcheck.c:153
#: sslcheck.c:167
#, c-format
msgid "Error getting SSL object\n"
msgstr "Errore nell'ottenimento dell'oggetto SSL\n"

#: sslcheck.c:166
#: sslcheck.c:180
#, c-format
msgid "Error connecting to %s\n"
msgstr "Errore di connessione a %s\n"

#: sslcheck.c:177
#: sslcheck.c:191
#, c-format
msgid "No certificate found for %s\n"
msgstr "Nessun certificato trovato per %s\n"

#: sslcheck.c:188
#: sslcheck.c:204
#, c-format
msgid "Could not calculate certificate expiration\n"
msgstr "Impossibile calcolare la scadenza del certificato\n"

#: sslcheck.c:195
#: sslcheck.c:214
#, c-format
msgid "Expired %d days ago\n"
msgstr "Scaduto %d giorni fa\n"

#: sslcheck.c:220
#, c-format
msgid "Domain: %s | Certificate EXPIRED %d days ago\n"
msgstr "Dominio: %s | Certificato SCADUTO %d giorni fa\n"

#: sslcheck.c:222
#, c-format
msgid "Domain: %s | Days until Certification expires: %d\n"
msgstr "Dominio: %s | Giorni fino alla scadenza del certificato: %d\n"
1 change: 1 addition & 0 deletions src/rebuild-translatable-strings.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ xgettext -k_ -o sslcheck.pot sslcheck.c
msgmerge --update es.po sslcheck.pot
msgmerge --update fr.po sslcheck.pot
msgmerge --update en.po sslcheck.pot
msgmerge --update it.po sslcheck.pot
echo "strings updated. Review the lines that require translation"
32 changes: 27 additions & 5 deletions src/sslcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,21 @@ void print_help() {
}

// Calcula días hasta expiración
int days_until_expiration(X509 *cert) {
int days_until_expiration(X509 *cert, int *is_expired) {
const ASN1_TIME *notAfter = X509_get0_notAfter(cert);
ASN1_TIME *asn1_now = ASN1_TIME_new();
ASN1_TIME_set(asn1_now, time(NULL));

int days = 0, seconds = 0;
ASN1_TIME_diff(&days, &seconds, asn1_now, notAfter);

if (days < 0) {
*is_expired = 1;
days = -days;
} else {
*is_expired = 0;
}

ASN1_TIME_free(asn1_now);
return days;
}
Expand Down Expand Up @@ -186,19 +194,33 @@ int main(int argc, char **argv) {
return EXIT_FAILURE;
}

int days = days_until_expiration(cert);
int is_expired = 0;
int days = days_until_expiration(cert, &is_expired);

if (days < 0) {
if (json_output)
printf("{\"domain\": \"%s\", \"days\": null}\n", hostname);
else
fprintf(stderr, _("Could not calculate certificate expiration\n"));
} else {
if (json_output) {
printf("{\"domain\": \"%s\", \"days\": %d}\n", hostname, days);
if (is_expired) {
printf("{\"domain\": \"%s\", \"days\": %d, \"status\": \"expired\"}\n", hostname, days);
} else {
printf("{\"domain\": \"%s\", \"days\": %d, \"status\": \"valid\"}\n", hostname, days);
}
} else if (short_output) {
printf("%d\n", days);
if (is_expired) {
printf(_("Expired %d days ago\n"), days);
} else {
printf("%d\n", days);
}
} else {
printf(_("Domain: %s | Days until Certification expires: %d\n"), hostname, days);
if (is_expired) {
printf(_("Domain: %s | Certificate EXPIRED %d days ago\n"), hostname, days);
} else {
printf(_("Domain: %s | Days until Certification expires: %d\n"), hostname, days);
}
}
}

Expand Down
Loading