Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
encbladexp committed Sep 28, 2024
0 parents commit 4921604
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Documentation

* [OpenSSL Index Format](https://pki-tutorial.readthedocs.io/en/latest/cadb.html)
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/encbladexp/expired_certificate_check

go 1.23.1
53 changes: 53 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package main

import (
"encoding/csv"
"fmt"
"os"
)

type Certificate struct {
Status string
Expired string
Revoked string
Serial string
Filename string
CN string
}

type Certificates struct {
Certificates []Certificate
}

func (c *Certificates) process_line(line []string) {
cert := Certificate{
line[0],
line[1],
line[2],
line[3],
line[4],
line[5],
}
c.Certificates = append(c.Certificates, cert)
}

const FILENAME = "index.txt"

func main() {
file, err := os.Open(FILENAME)
if err != nil {
panic(err)
}
defer file.Close()
csvreader := csv.NewReader(file)
csvreader.Comma = '\t'
lines, err := csvreader.ReadAll()
if err != nil {
panic(err)
}
cert_store := Certificates{}
for _, line := range lines {
cert_store.process_line(line)
}
fmt.Println(cert_store.Certificates)
}

0 comments on commit 4921604

Please sign in to comment.