Skip to content

refactor: entrypoint of script#2143

Open
a-wallen wants to merge 1 commit intosherlock-project:masterfrom
a-wallen:refactor_entrypoint
Open

refactor: entrypoint of script#2143
a-wallen wants to merge 1 commit intosherlock-project:masterfrom
a-wallen:refactor_entrypoint

Conversation

@a-wallen
Copy link
Copy Markdown

Parse the system args in main() for command line use.

For people using this in their python script they should be able to supply the same arguments in the function.

@ppfeister ppfeister added the enhancement New feature or request label May 30, 2024
@ppfeister ppfeister self-assigned this May 30, 2024
Copy link
Copy Markdown
Member

@ppfeister ppfeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm.
4/9 of the original unit tests seem to fail. Upon further investigation, this is what I've come away with --

Unit tests ran with:

cd sherlock
python -m unittest tests.all --verbose

As a standalone script...

python3 sherlock xyz works as before Sherlock was packaged (this is a +), but this (on its own) is also not hugely beneficial for Sherlock's inclusion in other scripts as a module or package, only really as an included file.


Now the various installed-package forms...

pip install .
sherlock test123

Install works fine. Manual test however fails with infinite recursion.

Note that sherlock --version seems to work, just not beginning any scans.

And when testing the now-installed package within Python...

import sherlock
sherlock({anything})

Returns that sherlock is not a callable module.

I'm not seeing any part of entrypoint main() that accepts passed (python) args, only the original cli parser args. It seems that sherlock() was given extra arguments (with defaults), but this is not the package entrypoint as defined by pyproject.

@a-wallen
Copy link
Copy Markdown
Author

Could you send me any resources for testing this project?

@ppfeister
Copy link
Copy Markdown
Member

@a-wallen Somehow missed your reply

I have Sherlock integrated over here if you're looking for a known-good and functional example of scripted use
User journey actually wasn't that bad. 90% of that file is processing the returned data, the actual Sherlock integration is only a few lines.

The crux of the entire integration came down to this:

from sherlock_project.sherlock import sherlock
from sherlock_project.sites import SitesInformation
from sherlock_project.notify import QueryNotify

sites = SitesInformation()
sites_data = { site.name: site.information for site in sites }

results:List[Dict] = sherlock(
    username=query,
    site_data=sites_data,
    query_notify=QueryNotify(),
    timeout=timeout,
)

where the rest is just working the returned results.

After working a proper integration, I'm not too sure what specifically needs improvement other than proper type setting and docstrings (open to suggestions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants