MrTuxx / SocialPwned

SocialPwned is an OSINT tool that allows to get the emails, from a target, published in social networks such as Instagram, Linkedin and Twitter to find possible credentials leaks in PwnDB or Dehashed and obtain Google account information via GHunt.
GNU General Public License v3.0
1.01k stars 105 forks source link

KeyError: 'data" #4

Closed Shraknard closed 3 years ago

Shraknard commented 3 years ago

Hello,

I have an error while trying to scrap Linkedn. it is able to get the list of companies but when trying to get the employees, it fail at some point. I tried this on a basic Ubuntu with python3. Thanks for the script anyway :)

Here is the command : python3 socialpwned.py --credentials creds.json --output out.txt --linkedin --search-companies "MyCompany" --employees --pwndb

And here is the output :

Traceback (most recent call last):
  File "socialpwned.py", line 51, in <module>
    run(args)
  File "SocialPwned/core/main.py", line 214, in run
    results.extend(linkedinParameters(args,in_email,in_password))
  File "SocialPwned/core/main.py", line 109, in linkedinParameters
    users = linkedin.getCompanyEmployees(api,companies)
  File "SocialPwned/core/linkedin.py", line 46, in getCompanyEmployees
    employees = searchUsersOfCompany(api,nameCompany)
  File "SocialPwned/core/linkedin.py", line 84, in searchUsersOfCompany
    employees = api.search_people(keywords=nameCompany)
  File "SocialPwned/lib/LinkedInAPI/linkedin.py", line 177, in search_people
    data = self.search(params, limit=limit)
  File "SocialPwned/lib/LinkedInAPI/linkedin.py", line 107, in search
    for i in range(len(data["data"]["elements"])):
KeyError: 'data'
MrTuxx commented 3 years ago

Hello,

I have been going through the code and doing some tests. The problem seems to be when a company name has a comma in it, for example: "MyCompany, LLC".

This error also occurs when searching for employees when of the company "MyCompany, LLC".

To fix it I simply put a replace(',' ''), in the API call. I think it is enough because I have not identified more characters that generate an error.

Try now after applying the changes in master, if it is solved close the issue.

Shraknard commented 3 years ago

Hi !

The changes you've made didn't worked for me but I noticed they were dashes and parenthesis in the name it failed on. So I followed your lead with the replace strategy and its now working when I replace parenthesis in search_people() the same way you did with comas. Dashes seems not to be a problem.

I can now close the issue. Thanks a lot for your fast answer and for the tool !