chg: [Mail Credential] add tld statistic

pull/250/head
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 packages import Paste
from pubsublogger import publisher from pubsublogger import publisher
from Helper import Process from Helper import Process
import datetime
import re import re
import redis import redis
from pyfaup.faup import Faup from pyfaup.faup import Faup
@ -140,7 +141,13 @@ if __name__ == "__main__":
#for searching credential in termFreq #for searching credential in termFreq
date = datetime.datetime.now().strftime("%Y%m")
for cred in creds: 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 cred = cred.split('@')[0] #Split to ignore mail address
#unique number attached to unique path #unique number attached to unique path

View File

@ -20,6 +20,8 @@ from packages import Paste
from packages import lib_refine from packages import lib_refine
from pubsublogger import publisher from pubsublogger import publisher
from pyfaup.faup import Faup
from Helper import Process from Helper import Process
if __name__ == "__main__": if __name__ == "__main__":
@ -28,6 +30,8 @@ if __name__ == "__main__":
config_section = 'Mail' config_section = 'Mail'
faup = Faup()
p = Process(config_section) p = Process(config_section)
addr_dns = p.config.get("Mail", "dns") addr_dns = p.config.get("Mail", "dns")
@ -93,8 +97,10 @@ if __name__ == "__main__":
print('mail;{};{};{}'.format(MX_values[1][mail], mail, PST.p_date)) 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') p.populate_set_out('mail;{};{};{}'.format(MX_values[1][mail], mail, PST.p_date), 'ModuleStats')
country = mail.split('.')[-1] faup.decode(mail)
server_statistics.hincrby('mail_by_country:'+date, country, MX_values[1][mail]) tld = faup.get()['tld']
print(tld)
server_statistics.hincrby('mail_by_tld:'+date, tld, MX_values[1][mail])
prec_filename = filename prec_filename = filename