mirror of
https://github.com/laramies/theHarvester.git
synced 2024-09-20 23:37:00 +08:00
added new methods to pytester
This commit is contained in:
parent
e5eaa28acd
commit
0b8e95c80f
864
output.txt
Normal file
864
output.txt
Normal file
File diff suppressed because one or more lines are too long
|
@ -2,6 +2,7 @@
|
|||
# coding=utf-8
|
||||
from theHarvester.discovery import linkedinsearch
|
||||
import pytest
|
||||
import re
|
||||
|
||||
|
||||
class TestGetLinks(object):
|
||||
|
@ -12,5 +13,16 @@ def test_get_links(self):
|
|||
links = search.get_links()
|
||||
assert list(links)
|
||||
|
||||
def test_links_linkedin(self):
|
||||
f = open("test_linkedin_links.txt").read()
|
||||
reg_links = re.compile(r"url=https:\/\/www\.linkedin.com(.*?)&")
|
||||
temp = reg_links.findall(f)
|
||||
resul = []
|
||||
for x in temp:
|
||||
y = x.replace("url=", "")
|
||||
resul.append("https://www.linkedin.com" + y)
|
||||
assert set(resul)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pytest.main()
|
||||
|
|
5
tests/discovery/test_linkedin_links.txt
Normal file
5
tests/discovery/test_linkedin_links.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
LinkedIn</a></h3><div class="s"><div class="hJND5c" style="margin-bottom:2px;word-wrap:break-word"><cite>https://www.linkedin.<b>com</b>/in/gm-tuhin-ialam-546526b8</cite></div><div class="f slp">Albany, New York Area - Facebook Advertising</div><span class="st">Gm Tuhin.ialam. <b>facebook</b>.<b>com</b> at Facebook Advertising. Albany, New York Area. <br>
|
||||
Marketing and Advertising. Facebook Advertising. 0 connections ...</span><br></div></div><div class="g"><h3 class="r"><a href="/url?url=https://in.linkedin.com/in/nikulact&rct=j&frm=1&q=&esrc=s&sa=U&ved=0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQFggcMAM&usg=AOvVaw1Bqufzx2E449oJST9BI5cT">NIKUL www.<b>facebook</b>.<b>com</b>/nikulact - Modeling - Self Modeling ...</a></h3><div class="s"><div class="hJND5c" style="margin-bottom:2px;word-wrap:break-word"><cite>https://in.linkedin.<b>com</b>/in/nikulact</cite><div class="Pj9hGd"><div style="display:inline" onclick="google.sham(this);" aria-expanded="false" aria-haspopup="true" tabindex="0" data-ved="0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQ7B0IHTAD"><span class="CiacGf"></span></div><div style="display:none" class="am-dropdown-menu" role="menu" tabindex="-1"><ul><li class="mUpfKd"><a class="imx0m" href="/search?hl=en&q=related:https://in.linkedin.com/in/nikulact&tbo=1&sa=X&ved=0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQHwgfMAM">Similar</a></li></ul></div></div></div><div class="f slp">Ahmedabad Area, India - Self Modeling</div><span class="st">View NIKUL www.<b>facebook</b>.<b>com</b>/nikulact's profile on LinkedIn, the world's largest <br>
|
||||
professional community. NIKUL has 1 job listed on their profile. See the ...</span><br></div></div><div class="g"><h3 class="r"><a href="/url?url=https://www.linkedin.com/in/victor-scott-9a967343&rct=j&frm=1&q=&esrc=s&sa=U&ved=0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQFggiMAQ&usg=AOvVaw2unq4BLAYGCfUquVZB3R4M">Victor Scott - Metal Band <b>facebook</b>.<b>com</b>/alchemyoftime - Alchemy of ...</a></h3><div class="s"><div class="hJND5c" style="margin-bottom:2px;word-wrap:break-word"><cite>https://www.linkedin.<b>com</b>/in/victor-scott-9a967343</cite></div><div class="f slp">Albany, New York Area - Alchemy of Time</div><span class="st">Victor Scott. Metal Band <b>facebook</b>.<b>com</b>/alchemyoftime at Alchemy of Time. Albany<br>
|
||||
, New York Area. Music. Alchemy of Time. 1 connection ...</span><br></div></div><div class="g"><h3 class="r"><a href="/url?url=https://www.linkedin.com/in/elkhorbat-lkhorbat-6028b33a&rct=j&frm=1&q=&esrc=s&sa=U&ved=0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQFgglMAU&usg=AOvVaw0CgoQP7h8_4jJ1WkOSC6TB">elkhorbat lkhorbat - http://www.<b>facebook</b>.<b>com</b>/pages/elkhorbat ...</a></h3><div class="s"><div class="hJND5c" style="margin-bottom:2px;word-wrap:break-word"><cite>https://www.linkedin.<b>com</b>/in/elkhorbat-lkhorbat-6028b33a</cite></div><div class="f slp">United States - http://www.facebook.com/pages/elkhorbat/302997479939</div><span class="st">View elkhorbat lkhorbat's profile on LinkedIn, the world's largest professional <br>
|
||||
community. elkhorbat has 1 job listed on their profile. See the complete profile on<br>
|
|
@ -35,6 +35,7 @@ def get_people(self):
|
|||
return rawres.people_linkedin()
|
||||
|
||||
def get_links(self):
|
||||
print(self.totalresults)
|
||||
links = myparser.Parser(self.totalresults, self.word)
|
||||
return links.links_linkedin()
|
||||
|
||||
|
|
Loading…
Reference in a new issue