certstream-server-go
certstream-server-go copied to clipboard
Missing certificates
Hello, I have started using your certstream server, but I have the problem. I have python script which is reading stream (endpoint domain-only) and looking for domains from my defined list. Unfortunately a lot of domains are missing in compare to list of catched domains from calidog certstream.
I have two solutions, but neither of them works:
First solution is the same script, as I am using for calidog certstream. With their stream works fine, with my own (your solution) not very well
import certstream
keywords = ["example_domain1", "example_domain2"]
def print_callback(message, context):
logging.debug("Message -> {}".format(message))
all_domains = message['data']['leaf_cert']['all_domains']
for domain in all_domains:
for k in keywords:
if domain.find(k) != -1:
print(f"Found certificate with domain {domain}")
logging.basicConfig(format='[%(levelname)s:%(name)s] %(asctime)s - %(message)s', level=logging.INFO)
certstream.listen_for_events(print_callback, url='wss://192.168.1.101/domains-only/')
Second solution - same results as with previous script, domains are missing
async def read_stream(uri):
async with websockets.connect(uri) as websocket:
while True:
data = await websocket.recv()
try:
json_object = json.loads(data)
all_domains = json_object['data']
for domain in all_domains:
if domain == "example_domain":
print(f"Found certificate with domain {domain}")
except Exception as e:
print(e)
ws_uri = "wss://192.168.1.101/domains-only/"
asyncio.get_event_loop().run_until_complete(read_stream(ws_uri))
Could someone help me, how to find where is the problem, and how can I fix this? Thank you in advance.