improvement of antispam

This commit is contained in:
Romain Bignon 2011-10-05 15:42:20 +02:00
commit 0a61ecc6c2
2 changed files with 21 additions and 2 deletions

View file

@ -49,6 +49,25 @@ class AntiSpam(object):
return False
if profile['about2'].endswith('mmmmmmmmmmmmmmmm'):
return False
if profile['last_ip'].startswith('41.202.'):
return False
if profile['last_ip'] == '62.157.186.18':
return False
return True
def check_contact(self, contact):
if not self.check_profile(contact.aum_profile):
return False
ipaddr = contact.profile['info']['IPaddr'].value
if ipaddr.split(' ')[0].endswith('.amsterdam.ananoos.net'):
return False
if ipaddr.rstrip(')').endswith('.afnet.net'):
return False
if ipaddr.split(' ')[0].endswith('.tedata.net'):
return False
if ipaddr.split(' ')[0].endswith('kupo.fr'):
return False
return True
def check_mail(self, mail):

View file

@ -164,7 +164,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
if not mail['id_from'] in contacts:
with self.browser:
contacts[mail['id_from']] = self.get_contact(mail['id_from'])
if self.antispam and not self.antispam.check_profile(contacts[mail['id_from']].aum_profile):
if self.antispam and not self.antispam.check_contact(contacts[mail['id_from']]):
self.logger.info('Skipped a spam-mail-profile from %s' % mails['member']['pseudo'])
self.report_spam(thread.id)
break
@ -240,7 +240,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
if basket['isBan'] or parse_dt(basket['date']) <= slut['lastmsg']:
continue
contact = self.get_contact(basket['id'])
if self.antispam and not self.antispam.check_profile(contact.aum_profile):
if self.antispam and not self.antispam.check_contact(contact):
self.logger.info('Skipped a spam-basket from %s' % contact.name)
self.report_spam(basket['id'])
continue