Skip to content

Commit

Permalink
add logs in readme + fix typo + remove useless break in dsn query
Browse files Browse the repository at this point in the history
  • Loading branch information
Issif committed Apr 14, 2020
1 parent 9650d19 commit 3fc63b0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cercat

`certcat` is for **Certificate Catcher**. It's monitores issued certificates from [CertStream](https://certstream.calidog.io/) stream and send an alert to **Slack** if a domain matchs a specified **regexp**.
`certcat` is for **Certificate Catcher**. It's monitors issued certificates from [CertStream](https://certstream.calidog.io/) stream and send an alert to **Slack** if a domain matchs a specified **regexp**.

```bash
websocket +----------+ POST
Expand Down Expand Up @@ -48,6 +48,13 @@ Flags:
-c, --configfile=CONFIGFILE config file
```

## Logs

```bash
2020/04/14 17:29:40 [INFO] : A certificate for 'www.XXXX.fr' has been issued : {"domain":"www.XXXX.fr","SAN":["www.XXXX.fr"],"issuer":"Let's Encrypt","Addresses":["XX.XX.XX.183","XX.XX.XX.182"]}
2020/04/14 17:29:41 [INFO] : A certificate for 'XXXX.fr' has been issued : {"domain":"XXXX.fr","SAN":["mail.XXXX.fr","XXXX.fr","www.XXXX.fr"],"issuer":"Let's Encrypt","Addresses":["XX.XX.XX.108"]}
```

## License

MIT
Expand Down
18 changes: 6 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,15 @@ func certCheckWorker(msgChan <-chan []byte) {
SAN: c.Data.LeafCert.AllDomains,
Addresses: []string{"N/A"},
}
for _, i := range c.Data.LeafCert.AllDomains {
ips, err := net.LookupIP(i)
if err != nil {
continue
}
ips, _ := net.LookupIP(r.Domain)
if len(ips) != 0 {
ipsList := []string{}
if len(ips) != 0 {
for _, j := range ips {
if regIP.MatchString(j.String()) {
ipsList = append(ipsList, j.String())
}
for _, j := range ips {
if regIP.MatchString(j.String()) {
ipsList = append(ipsList, j.String())
}
r.Addresses = ipsList
}
break
r.Addresses = ipsList
}
b, _ := json.Marshal(r)
log.Printf("[INFO] : A certificate for '%v' has been issued : %v\n", r.Domain, string(b))
Expand Down
Binary file removed screenshot.png
Binary file not shown.

0 comments on commit 3fc63b0

Please sign in to comment.