-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrintOutSuspiciousCreatives.py
More file actions
33 lines (29 loc) · 1015 Bytes
/
Copy pathPrintOutSuspiciousCreatives.py
File metadata and controls
33 lines (29 loc) · 1015 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
28
29
30
31
32
33
from pymongo import MongoClient
def establishLocalMongo():
client = MongoClient('mongodb://localhost:27017', authSource='creatives')
db = client['creatives']
validChecksum = db['validChecksum']
return validChecksum
validChecksum = establishLocalMongo()
orgIds = set()
blockedChecksums = set()
with open("./blockedIds") as fp:
for line in fp:
orgIds.add(line.rstrip('\n'))
for creative in validChecksum.find():
orgId = creative['organizationId']
checksum = creative['checksum']
if orgId in orgIds:
blockedChecksums.add(checksum)
suspiciousChecksums = []
for checksum in blockedChecksums:
for creative in validChecksum.find({"checksum":checksum}):
try:
decision = creative['decision']
except:
decision = ""
if decision != "":
print("The following creatives have the same checksum" + checksum)
for c in validChecksum.find({"checksum":checksum}):
print(c)
break