-
Notifications
You must be signed in to change notification settings - Fork 91
/
search_certs.py
52 lines (46 loc) · 1.13 KB
/
search_certs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""Search certificate data set."""
from censys.search import CensysCerts
c = CensysCerts()
# Single page of search results
query = c.search(
"parsed.subject.country: AU",
fields=[
"names",
"fingerprint_sha256",
"parsed.issuer.organization",
"parsed.subject.postal_code",
],
sort=["parsed.issuer.organization", "parsed.subject.postal_code"],
)
hits = query()
print(hits)
# Multiple pages of search results
query = c.search(
"parsed.subject.country: AU",
fields=[
"names",
"fingerprint_sha256",
"parsed.issuer.organization",
"parsed.subject.postal_code",
],
sort=["parsed.issuer.organization", "parsed.subject.postal_code"],
pages=2,
per_page=5,
)
for hits in query:
for hit in hits:
print(hit)
# View all results
query = c.search(
"parsed.subject.country: AU",
fields=[
"names",
"fingerprint_sha256",
"parsed.issuer.organization",
"parsed.subject.postal_code",
],
sort=["parsed.issuer.organization", "parsed.subject.postal_code"],
pages=2,
per_page=5,
)
print(query.view_all())