mirror of
https://github.com/laramies/theHarvester.git
synced 2025-02-24 22:42:56 +08:00
Merge pull request #11 from rtkpmcalpine/master
Fix EXTRAword.com matching when word is 'word.com'
This commit is contained in:
commit
7585690678
3 changed files with 20 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.pyc
|
|
@ -35,7 +35,7 @@ def emails(self):
|
|||
reg_emails = re.compile(
|
||||
'[a-zA-Z0-9.-_]*' +
|
||||
'@' +
|
||||
'[a-zA-Z0-9.-]*' +
|
||||
'(?:[a-zA-Z0-9.-]*\.)?' +
|
||||
self.word)
|
||||
self.temp = reg_emails.findall(self.results)
|
||||
emails = self.unique()
|
||||
|
|
18
myparser_test.py
Normal file
18
myparser_test.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
#
|
||||
# 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()
|
Loading…
Reference in a new issue