Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HackerTarget API is broken #5

Closed
ssilatel opened this issue Jan 28, 2023 · 4 comments
Closed

HackerTarget API is broken #5

ssilatel opened this issue Jan 28, 2023 · 4 comments

Comments

@ssilatel
Copy link
Contributor

Hey, I think a change you did in the HackerTarget API has caused it to break.

In the commit adef087 you moved the URL to Enum. When I call the API now I get the following error:

HackerTarget.URL.value.scheme,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'scheme'

This happens in the function self.get_query_url of the API. In the return of the function you are using urlunparse, and the first 2 parameters are HackerTarget.URL.value.scheme and HackerTarget.URL.value.netloc. Since HackerTarget.URL.value is a tuple, it doesn't recognise .scheme and .netloc.

Proposed Change

You can use HackerTarget.URL.value[0] and HackerTarget.URL.value[1] instead of .scheme and .netloc respectively.

I wasn't sure if you want to do that or you want to find a better solution, so I didn't make a Pull Request.

@EONRaider
Copy link
Owner

EONRaider commented Jan 28, 2023

You don't need to supply the URL as a parameter but, if you do, make sure you pass the full URL as in "https://api.hackertarget.com" (which is the predefined value)

@ssilatel
Copy link
Contributor Author

I am not supplying any parameters to it. This is all being done in your repo.

@EONRaider
Copy link
Owner

EONRaider commented Jan 28, 2023

I've just reviewed the code and I'm still failing to reproduce the issue you mention. The following code works perfectly and returns all known subdomains for github.com:

from reconlib import hackertarget

domain_info = hackertarget.API("github.com")
domain_info.hostsearch()

print(domain_info.subdomains)  # Displays 241 known hosts at this time

You can also run the tests for the API and see that they all pass.

@EONRaider
Copy link
Owner

Access by field name of the namedtuple that created the problem was replaced with access by index. The issue was generated by an implementation bug in CPython as described in the following conversation: python/cpython#100098

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants