Exemplo n.º 1
0
 def test_deobfuscate_email(self):
     input = """
         test at example dot com
         test@example dot com
         test at example.com
         test[at]example[dot]com
         test{at}example(dot)com
         For real, mail me at hahaha at example dot com.
         Laughing at polka-dot commercials
         Quick attack. Organize resistance.
         We are at lunch. Come over.
         <li>and at scale.</li>
         <a href="mailto:[email protected]">this</a>
         <*****@*****.**>
         """
     output = """
         [email protected]
         [email protected]
         [email protected]
         [email protected]
         [email protected]
         For real, mail me@[email protected].
         [email protected]
         Quick attack. Organize resistance.
         We are@lunch. Come over.
         <li>and@scale.</li>
         <a href="mailto:[email protected]">this</a>
         <*****@*****.**>
         """
     self.assertEqual(deobfuscate_email(input), output)
Exemplo n.º 2
0
 def test_deobfuscate_email(self):
     input = """
         test at example dot com
         test@example dot com
         test at example.com
         test[at]example[dot]com
         test{at}example(dot)com
         For real, mail me at hahaha at example dot com.
         Laughing at polka-dot commercials
         Quick attack. Organize resistance.
         We are at lunch. Come over.
         <li>and at scale.</li>
         <a href="mailto:[email protected]">this</a>
         <*****@*****.**>
         """
     output = """
         [email protected]
         [email protected]
         [email protected]
         [email protected]
         [email protected]
         For real, mail me@[email protected].
         [email protected]
         Quick attack. Organize resistance.
         We are@lunch. Come over.
         <li>and@scale.</li>
         <a href="mailto:[email protected]">this</a>
         <*****@*****.**>
         """
     self.assertEqual(deobfuscate_email(input), output)
Exemplo n.º 3
0
 def __call__(self, form, field):
     emails = EMAIL_RE.findall(deobfuscate_email(field.data or ''))
     for email in emails:
         try:
             diagnosis = is_email(email, check_dns=True, diagnose=True)
             if diagnosis.code == 0:
                 raise StopValidation(self.message)
         except (dns.resolver.Timeout, dns.resolver.NoNameservers):
             pass
Exemplo n.º 4
0
 def __call__(self, form, field):
     emails = EMAIL_RE.findall(deobfuscate_email(field.data or u''))
     for email in emails:
         try:
             diagnosis = is_email(email, check_dns=True, diagnose=True)
             if diagnosis.code == 0:
                 raise wtforms.validators.StopValidation(self.message)
         except (dns.resolver.Timeout, dns.resolver.NoNameservers):
             pass