mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
chg: [Mail Credential] add tld statistic
This commit is contained in:
parent
39f54d4420
commit
c20e7d5ab4
2 changed files with 16 additions and 3 deletions
|
@ -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
|
||||
|
|
12
bin/Mail.py
12
bin/Mail.py
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue