Greenwolf / social_mapper

A Social Media Enumeration & Correlation Tool by Jacob Wilkin(Greenwolf)
GNU General Public License v3.0
3.81k stars 788 forks source link

"Could not authenticate to LinkedIn" #145

Closed glennzw closed 4 years ago

glennzw commented 4 years ago

Even when not selecting LinkedIn (-li) I get the following error:

➜  python3 social_mapper.py -f company -i "SpiderLabs" -m fast -fb
[!] Could not authenticate to LinkedIn. cannot use a string pattern on a bytes-like object

The full dump is:

Traceback (most recent call last):
  File "social_mapper.py", line 886, in <module>
    cookies = authenticate() # perform authentication
  File "social_mapper.py", line 734, in authenticate
    a = login()
  File "social_mapper.py", line 710, in login
    parse = BeautifulSoup(page, "html.parser")
  File "/usr/local/lib/python3.7/site-packages/bs4/__init__.py", line 310, in __init__
    markup, from_encoding, exclude_encodings=exclude_encodings)):
  File "/usr/local/lib/python3.7/site-packages/bs4/builder/_htmlparser.py", line 248, in prepare_markup
    exclude_encodings=exclude_encodings)
  File "/usr/local/lib/python3.7/site-packages/bs4/dammit.py", line 395, in __init__
    for encoding in self.detector.encodings:
  File "/usr/local/lib/python3.7/site-packages/bs4/dammit.py", line 278, in encodings
    self.markup, self.is_html)
  File "/usr/local/lib/python3.7/site-packages/bs4/dammit.py", line 343, in find_declared_encoding
    declared_encoding_match = xml_re.search(markup, endpos=xml_endpos)
TypeError: cannot use a string pattern on a bytes-like object

Seems to originate from the login() function, specifically the line parsing the LinkedIn page via BeautifulSoup:

parse = BeautifulSoup(page, "html.parser") (https://github.com/Greenwolf/social_mapper/blob/master/social_mapper.py#L708)

I've got the latest version of BS installed:

 pip3 list | grep -i beaut 
beautifulsoup4          4.8.1     

I haven't dug much deeper, but seems odd to try authenticate to LinkedIn (i) when I'm not selecting it, and (ii) I removed the LinkedIn creds from the social_mapper.py file.

Any help greatly appreciated.

theaayushanand commented 4 years ago

same issue !

devx00 commented 4 years ago

@theaayushanand @glennzw if you are still having the issue you can fix it quickly by adding page = page.decode('utf-8') before both loadPage calls in the login() method.

rafe-ai commented 4 years ago

I have the same issue. This solves it for me:

-Open social_mapper.py in a text editor.

-find this line: page = loadPage(opener, "https://www.linkedin.com/uas/login")

and change it into: page = loadPage(opener, "https://www.linkedin.com/uas/login").decode('utf-8')

-now find this line: page = loadPage(opener,"https://www.linkedin.com/checkpoint/lg/login-submit", login_data)

and change it into : page = loadPage(opener,"https://www.linkedin.com/checkpoint/lg/login-submit", login_data).decode('utf-8')

Greenwolf commented 4 years ago

Edited social_mapper.py to fix this, thanks