chg: [Mail Credential] add tld statistic

This commit is contained in:
Terrtia 2018-07-30 10:19:26 +02:00
parent 39f54d4420
commit c20e7d5ab4
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 16 additions and 3 deletions

View file

@ -28,6 +28,7 @@ import sys
from packages import Paste
from pubsublogger import publisher
from Helper import Process
import datetime
import re
import redis
from pyfaup.faup import Faup
@ -140,7 +141,13 @@ if __name__ == "__main__":
#for searching credential in termFreq
date = datetime.datetime.now().strftime("%Y%m")
for cred in creds:
mail = cred.split('@')[-1]
tld = faup.get()['tld']
print(tld)
server_statistics.hincrby('credential_by_tld:'+date, tld, MX_values[1][mail])
cred = cred.split('@')[0] #Split to ignore mail address
#unique number attached to unique path

View file

@ -20,6 +20,8 @@ from packages import Paste
from packages import lib_refine
from pubsublogger import publisher
from pyfaup.faup import Faup
from Helper import Process
if __name__ == "__main__":
@ -28,6 +30,8 @@ if __name__ == "__main__":
config_section = 'Mail'
faup = Faup()
p = Process(config_section)
addr_dns = p.config.get("Mail", "dns")
@ -92,9 +96,11 @@ if __name__ == "__main__":
for mail in MX_values[1]:
print('mail;{};{};{}'.format(MX_values[1][mail], mail, PST.p_date))
p.populate_set_out('mail;{};{};{}'.format(MX_values[1][mail], mail, PST.p_date), 'ModuleStats')
country = mail.split('.')[-1]
server_statistics.hincrby('mail_by_country:'+date, country, MX_values[1][mail])
faup.decode(mail)
tld = faup.get()['tld']
print(tld)
server_statistics.hincrby('mail_by_tld:'+date, tld, MX_values[1][mail])
prec_filename = filename