fix twitter username handler issue (ref: #244)

This commit is contained in:
Janos Zold 2019-05-17 11:04:18 +01:00
parent bbcb172ed2
commit 68c8376985
2 changed files with 5 additions and 19 deletions

View file

@ -340,7 +340,7 @@ def start():
db.store_all(word, emails, 'email', 'trello')
elif engineitem == 'twitter':
print('\033[94m[*] Searching Twitter. \033[0m')
print('\033[94m[*] Searching Twitter usernames using Google. \033[0m')
search = twittersearch.search_twitter(word, limit)
search.process()
people = search.get_people()

View file

@ -3,6 +3,7 @@
from theHarvester.parsers import myparser
import requests
import time
import re
class search_twitter:
@ -36,24 +37,9 @@ def get_people(self):
# fix invalid handles that look like @user other_output
handles = set()
for handle in to_parse:
handle = str(handle).strip()
if len(handle) > 2:
if ' ' in handle:
handle = handle.split(' ')[0]
# strip off period at the end if exists
if handle[len(handle) - 1] == '.':
handle = handle[:len(handle) - 1]
# strip periods if contains three of them
if '...' in handle:
handle = handle[:handle.index('.')]
if '-' == handle[0]:
handle = handle[1:]
if '-' == handle[1]:
handle = handle[0] + handle[2:]
handles.add(handle)
if '@' in handles:
handles.remove('@')
result = re.search(r'^@?(\w){1,15}', handle)
if result:
handles.add(result.group(0))
return handles
def process(self):