-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreport.py
More file actions
27 lines (21 loc) · 778 Bytes
/
report.py
File metadata and controls
27 lines (21 loc) · 778 Bytes
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
"""Generate a report from the all the collected data."""
from __future__ import print_function
from app.common.util import mongo_connect
import csv
import logging
logging.basicConfig(level=logging.DEBUG)
RESOLVES = mongo_connect('localhost', 27017, 'boxcar', 'resolves')
def main():
"""Main."""
wrote = 0
file_name = "fortune-1000-typo-report.csv"
with open(file_name, 'w') as csvfile:
fieldnames = ['seed', 'domain', 'status', 'datetime']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for row in RESOLVES.find({}, {'_id': 0, 'ip': 0}):
writer.writerow(row)
wrote += 1
logging.debug("Wrote %d rows to %s" % (wrote, file_name))
if __name__ == '__main__':
main()