From da29adac493478b20c75efe0964b2c52a4bf1889 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 03:28:57 +0000 Subject: [PATCH 01/19] Improvements --- src/commands/parse.ts | 32 +++++++++++++++++--------------- src/commands/parseall.ts | 22 +++++++++++++++------- src/functions/index.ts | 2 ++ 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/commands/parse.ts b/src/commands/parse.ts index acd293f..fcd0765 100644 --- a/src/commands/parse.ts +++ b/src/commands/parse.ts @@ -3,6 +3,7 @@ import { parseCert } from '@ghaiklor/x509'; import { Message } from 'eris'; import { Client } from '..'; import { Command, RichEmbed } from '../class'; +import { parseCertificate } from '../functions'; export default class Parse extends Command { constructor(client: Client) { @@ -25,18 +26,19 @@ export default class Parse extends Command { return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot locate Validation directory.***`); } if (!dir.length) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot locate certificate.***`); - const cert = parseCert(`${account.homepath}/Validation/${dir[0]}`); - const subjectCommonName = cert.subject.commonName ? cert.subject.commonName : 'Not Specified'; - const subjectEmailAddress = cert.subject.emailAddress ? cert.subject.emailAddress : 'Not Specified'; - const subjectOrganization = cert.subject.organizationName ? cert.subject.organizationName : 'Not Specified'; - const subjectOrganizationalUnit = cert.subject.organizationalUnitName ? cert.subject.organizationalUnitName : 'Not Specified'; - const subjectCountry = cert.subject.countryName ? cert.subject.countryName : 'Not Specified'; - const issuerCommonName = cert.issuer.commonName ? cert.issuer.commonName : 'Not Specified'; - const issuerEmailAddress = cert.issuer.emailAddress ? cert.issuer.emailAddress : 'Not Specified'; - const issuerOrganization = cert.issuer.organizationName ? cert.issuer.organizationName : 'Not Specified'; - const issuerOrganizationalUnit = cert.issuer.organizationalUnitName ? cert.issuer.organizationalUnitName : 'Not Specified'; - const issuerCountry = cert.issuer.countryName ? cert.issuer.countryName : 'Not Specified'; - const user = this.client.users.get(account.userID) ? this.client.users.get(account.userID) : await this.client.getRESTUser(account.userID); + const cert = await parseCertificate(this.client, dir[0]); + // const cert = parseCert(`${account.homepath}/Validation/${dir[0]}`); + const subjectCommonName = cert.subject.commonName || 'Not Specified'; + const subjectEmailAddress = cert.subject.emailAddress || 'Not Specified'; + const subjectOrganization = cert.subject.organizationName || 'Not Specified'; + const subjectOrganizationalUnit = cert.subject.organizationalUnitName || 'Not Specified'; + const subjectCountry = cert.subject.countryName || 'Not Specified'; + const issuerCommonName = cert.issuer.commonName || 'Not Specified'; + const issuerEmailAddress = cert.issuer.emailAddress || 'Not Specified'; + const issuerOrganization = cert.issuer.organizationName || 'Not Specified'; + const issuerOrganizationalUnit = cert.issuer.organizationalUnitName || 'Not Specified'; + const issuerCountry = cert.issuer.countryName || 'Not Specified'; + const user = this.client.users.get(account.userID) || await this.client.getRESTUser(account.userID); const embed = new RichEmbed(); embed.setTitle('Parse x509 Certificate'); embed.setDescription(`${account.homepath}/Validation/${dir[0]} | ${account.username} <@${user.id}>`); @@ -46,10 +48,10 @@ export default class Parse extends Command { embed.addField('Serial Number', cert.serial, true); embed.addField('Fingerprint', cert.fingerPrint, true); embed.addField('Signature Algorithm', cert.signatureAlgorithm, true); - embed.addField('Public Key Algorithm', cert.publicKey.algorithm, true); + embed.addField('Public Key Algorithm', cert.publicKeyAlgorithm, true); embed.addField('Key Usage', cert.extensions.keyUsage, true); - embed.addField('Extended Key Usage', cert.extensions.extendedKeyUsage, true); - embed.addField('Policies', cert.extensions.certificatePolicies, true); + embed.addField('Extended Key Usage', cert.extensions.extendedKeyUsage.join(', '), true); + embed.addField('Policies', cert.extensions.certificatePolicies.join(', '), true); embed.addField('Issued On', new Date(cert.notBefore).toLocaleString('en-us'), true); embed.addField('Expires On', new Date(cert.notAfter).toLocaleString('en-us'), true); embed.setFooter(this.client.user.username, this.client.user.avatarURL); diff --git a/src/commands/parseall.ts b/src/commands/parseall.ts index 9d9d246..887df58 100644 --- a/src/commands/parseall.ts +++ b/src/commands/parseall.ts @@ -24,20 +24,28 @@ export default class Parseall extends Command { embed.setFooter(`Requested by ${message.member.username}#${message.member.discriminator}`, message.member.avatarURL); embed.setTimestamp(); const search = await this.client.db.Account.find(); - const accounts = search.map((acc) => acc.homepath); + const accounts = search; const final: string[] = []; accounts.forEach(async (a) => { try { - const certFile = readdirSync(`${a}/Validation`)[0]; - const { notAfter } = parseCert(`${a}/Validation/${certFile}`); + const certFile = readdirSync(`${a.homepath}/Validation`)[0]; + const { notAfter } = parseCert(`${a.homepath}/Validation/${certFile}`); // @ts-ignore - const time = moment.preciseDiff(new Date(), notAfter); + const timeObject: {years: number, months: number, days: number, hours: number, minutes: number, seconds: number, firstDateWasLater: boolean} = moment.preciseDiff(new Date(), notAfter, true); + const precise: [number, string][] = []; + // @ts-ignore + const timeArray: number[] = Object.values(timeObject).filter((v) => !isNaN(v)).forEach((t: number) => { // eslint-disable-line + const index = timeArray.indexOf(t); + const measurements = ['yr', 'mo', 'd', 'h', 'm', 's']; + precise.push([t, measurements[index]]); + }); + const time = precise.map(((v) => v.join(''))).join(', '); - if (notAfter < new Date()) final.push(`${this.client.stores.emojis.error} **${a}** Certificate expired ${time} ago`); - else final.push(`${this.client.stores.emojis.success} **${a}** Certificate expires in ${time}`); + if (notAfter < new Date()) final.push(`${this.client.stores.emojis.error} **${a.username}** Certificate expired ${time} ago`); + else final.push(`${this.client.stores.emojis.success} **${a.username}** Certificate expires in ${time}`); } catch (error) { - if (error.message.includes('no such file or directory') || error.message.includes('File doesn\'t exist.')) final.push(`${this.client.stores.emojis.error} **${a}** Unable to locate certificate`); + if (error.message.includes('no such file or directory') || error.message.includes('File doesn\'t exist.')) final.push(`${this.client.stores.emojis.error} **${a.username}** Unable to locate certificate`); else throw error; } }); diff --git a/src/functions/index.ts b/src/functions/index.ts index b4047fb..4395294 100644 --- a/src/functions/index.ts +++ b/src/functions/index.ts @@ -1,2 +1,4 @@ export { default as checkLock } from './checkLock'; export { default as dataConversion } from './dataConversion'; +export { default as checkSS } from './checkSS'; +export { default as parseCertificate } from './parseCertificate'; From 817ac0aa97f6399b83d3ebb7be53d2b12e9f2d1c Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 12:50:52 +0000 Subject: [PATCH 02/19] Check if cert and private key match --- src/commands/cwg_updatecert.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/commands/cwg_updatecert.ts b/src/commands/cwg_updatecert.ts index 05ec502..aa11590 100644 --- a/src/commands/cwg_updatecert.ts +++ b/src/commands/cwg_updatecert.ts @@ -1,4 +1,4 @@ -import { writeFile } from 'fs-extra'; +import { writeFile, unlink } from 'fs-extra'; import axios from 'axios'; import { Message } from 'eris'; import { Command } from '../class'; @@ -20,7 +20,7 @@ export default class CWG_UpdateCert extends Command { if (!args[2]) return this.client.commands.get('help').run(message, ['cwg', this.name]); const dom = await this.client.db.Domain.findOne({ $or: [{ domain: args[0] }, { port: Number(args[0]) || '' }] }); if (!dom) return message.channel.createMessage(`***${this.client.stores.emojis.error} The domain or port you provided could not be found.***`); - const { domain, port, x509 } = dom; + const { domain, port, x509, account } = dom; const { cert, key } = x509; const urls = args.slice(1, 3); // eslint-disable-line @@ -32,7 +32,16 @@ export default class CWG_UpdateCert extends Command { if (!this.isValidCertificateChain(certAndPrivateKey[0])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid Certificate Chain***`); if (!this.isValidPrivateKey(certAndPrivateKey[1])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid Private Key***`); - const writeTasks = [writeFile(cert, certAndPrivateKey[0], { encoding: 'utf8' }), writeFile(key, certAndPrivateKey[1], { encoding: 'utf8' })]; + const path = `/var/CloudServices/temp/${account.id}`; + const temp = [writeFile(`${path}.chain.crt`, certAndPrivateKey[0]), writeFile(`${path}.key.pem`, certAndPrivateKey[1])]; + const removeFiles = [unlink(`${path}.chain.crt`), unlink(`${path}.key.pem`)]; + await Promise.all(temp); + if (!this.isMatchingPair(`${path}.chain.crt`, `${path}.key.pem`)) { + await Promise.all(removeFiles); + return message.channel.createMessage(`${this.client.stores.emojis.error} ***Certificate and private key do not match***`); + } + + const writeTasks = [writeFile(cert, certAndPrivateKey[0], { encoding: 'utf8' }), writeFile(key, certAndPrivateKey[1], { encoding: 'utf8' }), ...removeFiles]; await Promise.all(writeTasks); return message.channel.createMessage(`${this.client.stores.emojis.success} ***Updated certificate for ${domain} on port ${port}***`); @@ -60,4 +69,10 @@ export default class CWG_UpdateCert extends Command { if (this.checkOccurance(key.replace(/^\s+|\s+$/g, ''), '-----END PRIVATE KEY-----') !== 1) return false; return true; } + + public async isMatchingPair(cert: string, privateKey: string) { + const result: string = await this.client.util.exec(`${__dirname}/../bin/checkCertSignatures ${cert} ${privateKey}`); + const { ok }: { ok: boolean } = JSON.parse(result); + return ok; + } } From 2a60c7dcf2ec7899d3fcb57f0bde9a1b27581a46 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 13:07:47 +0000 Subject: [PATCH 03/19] Fix cert pathing --- src/commands/parse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/parse.ts b/src/commands/parse.ts index fcd0765..5c1abf3 100644 --- a/src/commands/parse.ts +++ b/src/commands/parse.ts @@ -26,7 +26,7 @@ export default class Parse extends Command { return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot locate Validation directory.***`); } if (!dir.length) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot locate certificate.***`); - const cert = await parseCertificate(this.client, dir[0]); + const cert = await parseCertificate(this.client, `${account.homepath}/Validation/${dir[0]}`); // const cert = parseCert(`${account.homepath}/Validation/${dir[0]}`); const subjectCommonName = cert.subject.commonName || 'Not Specified'; const subjectEmailAddress = cert.subject.emailAddress || 'Not Specified'; From e21140ce58d2dc4cc6b6515f9e73c3ac7123481d Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 13:19:31 +0000 Subject: [PATCH 04/19] Fix array errors if null --- src/functions/parseCertificate.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/functions/parseCertificate.ts b/src/functions/parseCertificate.ts index 2f45301..f9d78ca 100644 --- a/src/functions/parseCertificate.ts +++ b/src/functions/parseCertificate.ts @@ -35,16 +35,16 @@ export default async function parseCertificate(client: Client, pathToCertificate subject: { commonName: parsedObject.RawParse.Subject.CommonName, emailAddress: parsedObject.AbstractParse.EmailAddress, - organizationName: parsedObject.RawParse.Subject.Organization[0], - organizationalUnitName: parsedObject.RawParse.Subject.OrganizationalUnit[0], - countryName: parsedObject.RawParse.Subject.Country[0], + organizationName: parsedObject.RawParse.Subject.Organization ? parsedObject.RawParse.Subject.Organization[0] : null, + organizationalUnitName: parsedObject.RawParse.Subject.OrganizationalUnit ? parsedObject.RawParse.Subject.OrganizationalUnit[0] : null, + countryName: parsedObject.RawParse.Subject.Country ? parsedObject.RawParse.Subject.Country[0] : null, }, issuer: { commonName: parsedObject.RawParse.Issuer.CommonName, emailAddress: null, - organizationName: parsedObject.RawParse.Issuer.Organization[0], - organizationalUnitName: parsedObject.RawParse.Issuer.OrganizationalUnit[0], - countryName: parsedObject.RawParse.Issuer.Country[0], + organizationName: parsedObject.RawParse.Issuer.Organization ? parsedObject.RawParse.Issuer.Organization[0] : null, + organizationalUnitName: parsedObject.RawParse.Issuer.OrganizationalUnit ? parsedObject.RawParse.Issuer.OrganizationalUnit[0] : null, + countryName: parsedObject.RawParse.Issuer.Country ? parsedObject.RawParse.Issuer.Country[0] : null, }, extensions: { keyUsage: '[ Not implemented by executable ]', From 5bb02c85f0a71c31327067c69707eb986d0b60cc Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:10:12 +0000 Subject: [PATCH 05/19] Should fix certificate status not showing --- src/commands/parseall.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/parseall.ts b/src/commands/parseall.ts index 887df58..ea119c5 100644 --- a/src/commands/parseall.ts +++ b/src/commands/parseall.ts @@ -35,7 +35,8 @@ export default class Parseall extends Command { const timeObject: {years: number, months: number, days: number, hours: number, minutes: number, seconds: number, firstDateWasLater: boolean} = moment.preciseDiff(new Date(), notAfter, true); const precise: [number, string][] = []; // @ts-ignore - const timeArray: number[] = Object.values(timeObject).filter((v) => !isNaN(v)).forEach((t: number) => { // eslint-disable-line + const timeArray: number[] = Object.values(timeObject).filter((v) => typeof v === 'number'); + timeArray.forEach((t) => { // eslint-disable-line const index = timeArray.indexOf(t); const measurements = ['yr', 'mo', 'd', 'h', 'm', 's']; precise.push([t, measurements[index]]); From 18b534f1a89ee24033d71aa3a31637c3f7de7d6f Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:14:41 +0000 Subject: [PATCH 06/19] Fix build? --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 1bd63a7..1a8e4a2 100644 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ # This file builds the Go binaries. Hardcoded by LOC Engineering -CGO_ENABLED=0 go build -o dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go +CGO_ENABLED=0 go build -o dist/bin/storage ./src/go/storage/storage.go src/go/storage/dirsize.go file dist/bin/storage -CGO_ENABLED=0 go build -o dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go +CGO_ENABLED=0 go build -o dist/bin/checkCertificate ./src/go/checkCertificate/checkCertificate.go file dist/bin/checkCertificate -CGO_ENABLED=0 go build -o dist/bin/checkCertSignatures src/go/checkCertSignatures/checkCertSignatures.go +CGO_ENABLED=0 go build -o dist/bin/checkCertSignatures ./src/go/checkCertSignatures/checkCertSignatures.go file /dist/bin/checkCertSignatures From fe382652093e5fd84add61eb4e947128251c8fcd Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:17:10 +0000 Subject: [PATCH 07/19] Revert --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 1a8e4a2..1bd63a7 100644 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ # This file builds the Go binaries. Hardcoded by LOC Engineering -CGO_ENABLED=0 go build -o dist/bin/storage ./src/go/storage/storage.go src/go/storage/dirsize.go +CGO_ENABLED=0 go build -o dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go file dist/bin/storage -CGO_ENABLED=0 go build -o dist/bin/checkCertificate ./src/go/checkCertificate/checkCertificate.go +CGO_ENABLED=0 go build -o dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go file dist/bin/checkCertificate -CGO_ENABLED=0 go build -o dist/bin/checkCertSignatures ./src/go/checkCertSignatures/checkCertSignatures.go +CGO_ENABLED=0 go build -o dist/bin/checkCertSignatures src/go/checkCertSignatures/checkCertSignatures.go file /dist/bin/checkCertSignatures From b2196186be9b5e367634579d0f2c1830bc14476c Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:27:42 +0000 Subject: [PATCH 08/19] Revert "Fix cert pathing" This reverts commit 2a60c7dcf2ec7899d3fcb57f0bde9a1b27581a46. --- src/commands/parse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/parse.ts b/src/commands/parse.ts index 5c1abf3..fcd0765 100644 --- a/src/commands/parse.ts +++ b/src/commands/parse.ts @@ -26,7 +26,7 @@ export default class Parse extends Command { return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot locate Validation directory.***`); } if (!dir.length) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot locate certificate.***`); - const cert = await parseCertificate(this.client, `${account.homepath}/Validation/${dir[0]}`); + const cert = await parseCertificate(this.client, dir[0]); // const cert = parseCert(`${account.homepath}/Validation/${dir[0]}`); const subjectCommonName = cert.subject.commonName || 'Not Specified'; const subjectEmailAddress = cert.subject.emailAddress || 'Not Specified'; From adad62cf960174e3b9d8237d25404a3b75da22a0 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:32:33 +0000 Subject: [PATCH 09/19] idk anymore --- src/commands/parse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/parse.ts b/src/commands/parse.ts index fcd0765..5c1abf3 100644 --- a/src/commands/parse.ts +++ b/src/commands/parse.ts @@ -26,7 +26,7 @@ export default class Parse extends Command { return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot locate Validation directory.***`); } if (!dir.length) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot locate certificate.***`); - const cert = await parseCertificate(this.client, dir[0]); + const cert = await parseCertificate(this.client, `${account.homepath}/Validation/${dir[0]}`); // const cert = parseCert(`${account.homepath}/Validation/${dir[0]}`); const subjectCommonName = cert.subject.commonName || 'Not Specified'; const subjectEmailAddress = cert.subject.emailAddress || 'Not Specified'; From bde6439c25453236b262522644e3ee3109691a6a Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:39:09 +0000 Subject: [PATCH 10/19] Seeing if this does anything --- src/go/checkCertificate/checkCertificate.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/go/checkCertificate/checkCertificate.go b/src/go/checkCertificate/checkCertificate.go index b9cebdd..3430629 100644 --- a/src/go/checkCertificate/checkCertificate.go +++ b/src/go/checkCertificate/checkCertificate.go @@ -2,14 +2,14 @@ package main import ( - "crypto/sha1" - "crypto/x509" - "encoding/hex" - "encoding/json" - "encoding/pem" - "encoding/xml" + "./sha1" + "./x509" + "./hex" + "./json" + "./pem" + "./xml" "fmt" - "io/ioutil" + "./ioutil" "os" ) From b77a0491af22cc047284f4fd6c7959dad0c56abe Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:40:28 +0000 Subject: [PATCH 11/19] ugh --- src/go/checkCertificate/checkCertificate.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/go/checkCertificate/checkCertificate.go b/src/go/checkCertificate/checkCertificate.go index 3430629..b9cebdd 100644 --- a/src/go/checkCertificate/checkCertificate.go +++ b/src/go/checkCertificate/checkCertificate.go @@ -2,14 +2,14 @@ package main import ( - "./sha1" - "./x509" - "./hex" - "./json" - "./pem" - "./xml" + "crypto/sha1" + "crypto/x509" + "encoding/hex" + "encoding/json" + "encoding/pem" + "encoding/xml" "fmt" - "./ioutil" + "io/ioutil" "os" ) From a56895c22cbd146df118ef191bee5cd236c1688e Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:44:24 +0000 Subject: [PATCH 12/19] idek --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e710b4a..25c9234 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "dist/Client.js", "scripts": { "lint": "eslint ./ --ext ts --fix", - "build": "tsc -p ./tsconfig.json && sh ./build.sh", + "build": "tsc -p ./tsconfig.json && sh /var/CloudServices/build.sh", "lint-find": "eslint ./ --ext ts" }, "author": "Library of Code sp-us Engineering Team", From 125e5815f9f8956e4f7319bb97daf955b93076a2 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:45:29 +0000 Subject: [PATCH 13/19] Nope --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25c9234..e710b4a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "dist/Client.js", "scripts": { "lint": "eslint ./ --ext ts --fix", - "build": "tsc -p ./tsconfig.json && sh /var/CloudServices/build.sh", + "build": "tsc -p ./tsconfig.json && sh ./build.sh", "lint-find": "eslint ./ --ext ts" }, "author": "Library of Code sp-us Engineering Team", From 2fa5a2a5ff71b27afffdaab6935dcc275530c238 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:46:19 +0000 Subject: [PATCH 14/19] try this --- build.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 1bd63a7..9890e17 100644 --- a/build.sh +++ b/build.sh @@ -1,7 +1,6 @@ # This file builds the Go binaries. Hardcoded by LOC Engineering -CGO_ENABLED=0 go build -o dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go +go build -o dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go file dist/bin/storage -CGO_ENABLED=0 go build -o dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go +go build -o dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go file dist/bin/checkCertificate -CGO_ENABLED=0 go build -o dist/bin/checkCertSignatures src/go/checkCertSignatures/checkCertSignatures.go -file /dist/bin/checkCertSignatures + From 221680c248727a8ae59da2e1e622f68266f7f748 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:47:05 +0000 Subject: [PATCH 15/19] nope --- build.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 9890e17..1bd63a7 100644 --- a/build.sh +++ b/build.sh @@ -1,6 +1,7 @@ # This file builds the Go binaries. Hardcoded by LOC Engineering -go build -o dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go +CGO_ENABLED=0 go build -o dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go file dist/bin/storage -go build -o dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go +CGO_ENABLED=0 go build -o dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go file dist/bin/checkCertificate - +CGO_ENABLED=0 go build -o dist/bin/checkCertSignatures src/go/checkCertSignatures/checkCertSignatures.go +file /dist/bin/checkCertSignatures From b4ad5d40558c603fbe3e9394d54cabe9b64235bc Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:57:21 +0000 Subject: [PATCH 16/19] . --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 1bd63a7..c682eab 100644 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ # This file builds the Go binaries. Hardcoded by LOC Engineering -CGO_ENABLED=0 go build -o dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go +CGO_ENABLED=0 go build -o ./dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go file dist/bin/storage -CGO_ENABLED=0 go build -o dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go +CGO_ENABLED=0 go build -o ./dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go file dist/bin/checkCertificate -CGO_ENABLED=0 go build -o dist/bin/checkCertSignatures src/go/checkCertSignatures/checkCertSignatures.go +CGO_ENABLED=0 go build -o ./dist/bin/checkCertSignatures src/go/checkCertSignatures/checkCertSignatures.go file /dist/bin/checkCertSignatures From 54c7cb77f191aee0e9b3749916e36b4215597c63 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 15:59:24 +0000 Subject: [PATCH 17/19] . --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index c682eab..4c2ccac 100644 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ # This file builds the Go binaries. Hardcoded by LOC Engineering -CGO_ENABLED=0 go build -o ./dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go +CGO_ENABLED=0 go build -o ./dist/bin/storage ./src/go/storage/storage.go ./src/go/storage/dirsize.go file dist/bin/storage -CGO_ENABLED=0 go build -o ./dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go +CGO_ENABLED=0 go build -o ./dist/bin/checkCertificate ./src/go/checkCertificate/checkCertificate.go file dist/bin/checkCertificate -CGO_ENABLED=0 go build -o ./dist/bin/checkCertSignatures src/go/checkCertSignatures/checkCertSignatures.go +CGO_ENABLED=0 go build -o ./dist/bin/checkCertSignatures ./src/go/checkCertSignatures/checkCertSignatures.go file /dist/bin/checkCertSignatures From 4910ba62db2199014d7441e8ab0ea1ab082d7dec Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 16:13:51 +0000 Subject: [PATCH 18/19] remove 0 values --- src/commands/parseall.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/parseall.ts b/src/commands/parseall.ts index ea119c5..18af83c 100644 --- a/src/commands/parseall.ts +++ b/src/commands/parseall.ts @@ -41,7 +41,7 @@ export default class Parseall extends Command { const measurements = ['yr', 'mo', 'd', 'h', 'm', 's']; precise.push([t, measurements[index]]); }); - const time = precise.map(((v) => v.join(''))).join(', '); + const time = precise.filter((n) => n[0]).map(((v) => v.join(''))).join(', '); if (notAfter < new Date()) final.push(`${this.client.stores.emojis.error} **${a.username}** Certificate expired ${time} ago`); else final.push(`${this.client.stores.emojis.success} **${a.username}** Certificate expires in ${time}`); From 92dec14df815667e4b5ddb488fde0cbff62ddd46 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 1 Jan 2020 16:31:19 +0000 Subject: [PATCH 19/19] Fix something? --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 4c2ccac..0a3a3d8 100644 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ # This file builds the Go binaries. Hardcoded by LOC Engineering -CGO_ENABLED=0 go build -o ./dist/bin/storage ./src/go/storage/storage.go ./src/go/storage/dirsize.go +CGO_ENABLED=0 go build -o dist/bin/storage src/go/storage/storage.go src/go/storage/dirsize.go file dist/bin/storage -CGO_ENABLED=0 go build -o ./dist/bin/checkCertificate ./src/go/checkCertificate/checkCertificate.go +CGO_ENABLED=0 go build -o dist/bin/checkCertificate src/go/checkCertificate/checkCertificate.go file dist/bin/checkCertificate -CGO_ENABLED=0 go build -o ./dist/bin/checkCertSignatures ./src/go/checkCertSignatures/checkCertSignatures.go -file /dist/bin/checkCertSignatures +CGO_ENABLED=0 go build -o dist/bin/checkCertSignatures src/go/checkCertSignatures/checkCertSignatures.go +file dist/bin/checkCertSignatures