Skip to content

Commit ecb6fbf

Browse files
committed
chg: [passivessl] import was borked
1 parent af4e61c commit ecb6fbf

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

main.go

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ func main() {
156156
}
157157

158158
// Parse Certificate Folder
159-
c.certPath = string(readConfFile(*confdir, "certfolder"))
159+
if !*pull {
160+
c.certPath = string(readConfFile(*confdir, "certfolder"))
161+
}
160162
c.recursive = *recursive
161163
c.tarball = *tarball
162164
c.format = *format
@@ -189,16 +191,31 @@ func main() {
189191
for {
190192
err := errors.New("")
191193
jsonPath, err = redis.String(cr.Do("LPOP", "analyzer:ja3-jl:"+c.redisQueue))
194+
err = filepath.Walk(jsonPath,
195+
func(path string, info os.FileInfo, err error) error {
196+
if err != nil {
197+
return err
198+
}
199+
if !info.IsDir() {
200+
fd, err := os.Open(path)
201+
if err != nil {
202+
log.Fatal(err)
203+
}
204+
bf := bufio.NewReader(fd)
205+
fmt.Println(path)
206+
processFile(bf, path, c.format)
207+
// Exit Signal Handle
208+
select {
209+
case <-s:
210+
fmt.Println("Exiting...")
211+
os.Exit(0)
212+
default:
213+
}
214+
}
215+
return nil
216+
})
192217
if err != nil {
193-
time.Sleep(2 * time.Second)
194-
}
195-
// Exit Signal Handle
196-
select {
197-
case <-s:
198-
fmt.Println("Exiting...")
199-
os.Exit(0)
200-
default:
201-
continue
218+
log.Fatal(err)
202219
}
203220
}
204221
} else { // Files
@@ -214,6 +231,7 @@ func main() {
214231
log.Fatal(err)
215232
}
216233
bf := bufio.NewReader(fd)
234+
fmt.Println(path)
217235
processFile(bf, path, c.format)
218236
}
219237
return nil
@@ -362,8 +380,10 @@ func insertLeafCertificate(fp string, c certMapElm) error {
362380
}
363381
}
364382
J:
365-
q := `INSERT INTO "certificate" (hash, "is_CA", "is_SS", issuer, subject, cert_chain, is_valid_chain, file_path) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ON CONFLICT DO NOTHING`
383+
// q := `INSERT INTO "certificate" (hash, "is_CA", "is_SS", issuer, subject, cert_chain, is_valid_chain, file_path) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ON CONFLICT DO NOTHING`
384+
q := `INSERT INTO "certificate" (hash, "is_CA", "is_SS", issuer, subject, cert_chain, is_valid_chain, file_path) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ON CONFLICT (hash) DO UPDATE SET file_path = excluded.file_path`
366385
_, err = db.Exec(q, c.CertHash, c.Certificate.IsCA, false, c.Certificate.Issuer.String(), c.Certificate.Subject.String(), nil, false, fp)
386+
fmt.Println(fp)
367387
if err != nil {
368388
return err
369389
}

0 commit comments

Comments
 (0)