mirror of
https://github.com/laramies/theHarvester.git
synced 2026-09-27 12:04:51 +02:00
This change makes myparser.emails(...) stricter so that, given a word (eg: 'word.com') it does not match domains which end with that word (i.e. some-other-word.com). Subdomains continue to be matched (eg: 'subdomain.word.com'). Also add unit test for emails(...)
19 lines
429 B
Python
19 lines
429 B
Python
#
|
|
# Unit tests for myparser.py
|
|
#
|
|
import myparser
|
|
|
|
import unittest
|
|
|
|
class TestMyParser(unittest.TestCase):
|
|
|
|
def test_emails(self):
|
|
word = 'domain.com'
|
|
results = '***a@domain***banotherdomain.com***c@domain.com***d@sub.domain.com***'
|
|
p = myparser.parser(results, word)
|
|
emails = sorted(p.emails())
|
|
self.assertEquals(emails, [ 'c@domain.com', 'd@sub.domain.com' ])
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|