CaliDog / certstream-python

Python library for connecting to CertStream
MIT License
425 stars 72 forks source link

How to write certstream output to json file? #17

Closed bedford1234 closed 6 years ago

bedford1234 commented 6 years ago

Hello,

I see this statement certstream --json | jq -r '.data | [.source.url, (.cert_index|tostring), .leaf_cert.subject.aggregated] | join(",")' on the certstream.io website, my question is how do I write the certstream results to a json file I can save.

I would greatly appreciate your help!

ghost commented 6 years ago

Just use bash features and append > yourfile.json to the command

bedford1234 commented 6 years ago

Hello @wagner-certat

Thank you for your response! I tried this command and certstream starts listening for events but it produces no output.

certstream --json | jq -r '.data | [.source.url, (.cert_index|tostring), .leaf_cert.subject.aggregated] | join(",")' > mycertstreamfile.json

Do you have any clue what is wrong with the command?

ghost commented 6 years ago

It produces no output because the output is in the file

bedford1234 commented 6 years ago

@wagner-certat How do write the full certificate transparency log data like seen on the certstream.io website as shown in the screenshot below.

image

ghost commented 6 years ago

I do not understand what you want to say.

bedford1234 commented 6 years ago

@wagner-certat I got the screenshot from the calidog certstream website. If you go to the bottom of the https://certstream.calidog.io/ webpage you will see details there. I want to get all of the attributes like serial number, notbefore, notafter from the certificate in my json file. How would I do that? I would greatly appreciate it!

bedford1234 commented 6 years ago

@wagner-certat I got the screenshot from the calidog certstream website. If you go to the bottom of the https://certstream.calidog.io/ webpage you will see details there. I want to get all of the attributes like serial number, notbefore, notafter from the certificate in my json file. How would I do that? I would greatly appreciate it!

Fusl commented 6 years ago

What you want is just certstream --json > mycertstreamfile.json

Fitblip commented 6 years ago

@fusl is correct, so I'm going to close this. @bedford1234 - please re-open if there's a bug or some other thing you'd like to discuss.