diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 76001ae9a..ae6c8b316 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -6,6 +6,3 @@ # Changes made to these items without code owner approval may negatively # impact packaging pipelines. Code owners may need time to verify or adapt. /pyproject.toml @ppfeister @sdushantha -/setup.cfg @ppfeister @sdushantha -/setup.py @ppfeister -/*.spec @ppfeister diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..b21b31ed8 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [ sdushantha, ppfeister ] \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4d47421ae..c53e34ad9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ -# Virtual Environment +# Virtual Environments venv/ bin/ lib/ pyvenv.cfg +poetry.lock # Editor Configurations .vscode/ @@ -14,8 +15,9 @@ __pycache__/ # Pip src/ -# Pip / PyProject Devel & Installation +# Devel, Build, and Installation *.egg-info/ +dist/** # Jupyter Notebook .ipynb_checkpoints diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 996efe8a3..fe91e7ca4 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -68,7 +68,7 @@ Sherlock. This invocation hides the progress text that Sherlock normally outputs, and instead shows the verbose output of the tests. ```console -$ cd sherlock/sherlock +# Assumes pwd is respository root $ python3 -m unittest tests.all --verbose ``` diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 9813a09c0..52c70086e 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -37,13 +37,24 @@ Python pipx install sherlock-project ``` -### Build python package from source (useful for contributors) +### Build live package from source (useful for contributors) + +Building an editable (or live) package links the entry point to your current directory, rather than to the standard install location. This is often useful when working with the code base, as changes are reflected immediately without reinstallation. + +Note that the version number will be 0.0.0 for pipx local builds unless manually changed in the pyproject file (it will prompt the user for an update). ```bash -# pipx is recommended, but pip may suffice if pipx is unavailable -git clone https://github.com/sherlock-project/sherlock.git -cd sherlock -pipx install . +# Assumes repository cloned, and pwd is repository root +pipx install -e . +``` + +### Run package from source (no install) + +If you'd rather not install directly to your system, you can import the module at runtime with `-m`. + +```bash +# Assumes repository cloned, and pwd is repository root +python3 -m sherlock user123 user789 ```

diff --git a/docs/README.md b/docs/README.md index 9df30261d..9b6237a85 100644 --- a/docs/README.md +++ b/docs/README.md @@ -27,11 +27,11 @@ [![PyPI - Version](https://img.shields.io/pypi/v/sherlock-project?logo=PyPi&label=PyPI&color=darkgreen)][ext_pypi] [![Docker Image Version](https://img.shields.io/docker/v/sherlock/sherlock?sort=semver&logo=docker&label=Docker&color=darkgreen)][docs_docker] [![homebrew version](https://img.shields.io/homebrew/v/sherlock?logo=Homebrew&color=darkgreen)][ext_brew] -| Method | Command | Notes | +| | Command | Notes | | - | - | - | -| pypi | `pipx install sherlock-project` | `pip` may be used in place of `pipx` | -| brew | `brew install sherlock` | Community supported | -| docker | `docker pull sherlock/sherlock` | | +| PyPI | `pipx install sherlock-project` | `pip` may be used in place of `pipx` | +| Homebrew | `brew install sherlock` | Community supported | +| Docker | `docker pull sherlock/sherlock` | | ### Alternative guides and methods @@ -133,15 +133,10 @@ Original Creator - [Siddharth Dushantha](https://github.com/sdushantha) [docs_install]: /docs/INSTALL.md [docs_docker]: /docs/INSTALL.md#docker -[docs_docker_dockerhub]: /docs/INSTALL.md#docker -[docs_docker_compose]: /docs/INSTALL.md#using-compose -[docs_docker_source]: /docs/INSTALL.md#build-image-from-source-useful-for-contributors [docs_py]: /docs/INSTALL.md#python -[docs_py_build]: /docs/INSTALL.md#build-python-package-from-source-useful-for-contributors [docs_contrib]: /docs/CONTRIBUTING.md [docs_contrib_adding_targets]: /docs/CONTRIBUTING.md#adding-targets [docs_contrib_removing_targets]: /docs/CONTRIBUTING.md#removing-targets [docs_contrib_restoring_targets]: /docs/CONTRIBUTING.md#restoring-targets [ext_pypi]: https://pypi.org/project/sherlock-project/ [ext_brew]: https://formulae.brew.sh/formula/sherlock - diff --git a/docs/pyproj/README.md b/docs/pyproj/README.md index 446382f5f..f33358a55 100644 --- a/docs/pyproj/README.md +++ b/docs/pyproj/README.md @@ -2,17 +2,12 @@


- +
- Hunt down social media accounts by username across social networks + Hunt down social media accounts by username across 400+ social networks +

+ Additional documentation can be found at our GitHub repository
- Additional documentation can be found on our GitHub repository -
-

- -

- -

## Usage @@ -36,11 +31,12 @@ To search for more than one user: ```bash $ sherlock user1 user2 user3 ``` +
-## Star History +___ - - - - Sherlock Project Star History Chart - +
+

+ + +

diff --git a/pyproject.toml b/pyproject.toml index 7356c0d11..c91b92261 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,48 +1,57 @@ [build-system] -requires = ["setuptools >= 61.0"] -build-backend = "setuptools.build_meta" +requires = [ "poetry-core>=1.2.0" ] +build-backend = "poetry.core.masonry.api" +# poetry-core 1.8 not available in .fc39. Can upgrade to 1.8.0 at .fc39 EOL -[project.scripts] -sherlock = "sherlock:main" +[tool.poetry-version-plugin] +source = "init" -[project.urls] -Homepage = "http://sherlock-project.github.io/" -Repository = "https://github.com/sherlock-project/sherlock.git" -Issues = "https://github.com/sherlock-project/sherlock/issues" - -[project] +[tool.poetry] name = "sherlock-project" +# single source of truth for version is __init__.py +version = "0" +description = "Hunt down social media accounts by username across social networks" +license = "MIT" authors = [ - { name = "Siddharth Dushantha" } + "Siddharth Dushantha " ] maintainers = [ - { name = "Matheus Felipe" }, - { name = "Sondre Karlsen Dyrnes" }, - { name = "Paul Pfeister" } + "Paul Pfeister ", + "Matheus Felipe ", + "Sondre Karlsen Dyrnes " ] -description = "Hunt down social media accounts by username across social networks" readme = "docs/pyproj/README.md" -# Do not set license to file. Causes issues with rpm packaging for some reason. -license = {text = "MIT"} -dynamic = ["dependencies", "version"] +packages = [ { include = "sherlock"} ] keywords = [ "osint", "reconnaissance", "information gathering" ] classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Information Technology", - "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Security" ] +homepage = "https://sherlock-project.github.io/" +repository = "https://github.com/sherlock-project/sherlock" + -[tool.setuptools.dynamic] -dependencies = { file = [ "requirements.txt" ] } -version = { attr = "sherlock.__version__" } +[tool.poetry.urls] +"Bug Tracker" = "https://github.com/sherlock-project/sherlock/issues" -[tool.setuptools] -package-dir = {"" = "sherlock"} +[tool.poetry.dependencies] +python = "^3.8" +certifi = ">=2019.6.16" +colorama = "^0.4.1" +PySocks = "^1.7.0" +requests = "^2.22.0" +requests-futures = "^1.0.0" +stem = "^1.8.0" +torrequest = "^0.1.0" +# pandas can likely be bumped up to ^2.0.0 after fc39 EOL +pandas = ">=1.0.0,<3.0.0" +openpyxl = "^3.0.10" +exrex = "^0.11.0" -[tool.setuptools.package-data] -"*" = ["*.json"] +[tool.poetry.scripts] +sherlock = 'sherlock.sherlock:main' diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index b1dd62522..000000000 --- a/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -certifi>=2019.6.16 -colorama>=0.4.1 -PySocks>=1.7.0 -requests>=2.22.0 -requests-futures>=1.0.0 -stem>=1.8.0 -torrequest>=0.1.0 -pandas>=1.0.0 -openpyxl>=3.0.10 -exrex>=0.11.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8929bbae7..000000000 --- a/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[metadata] -name = Sherlock -author = Sherlock Project -url = http://sherlock-project.github.io/ diff --git a/setup.py b/setup.py deleted file mode 100644 index 434d3f95e..000000000 --- a/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 - -"""Sometimes required for rpm spec - particularly when using pyp2rpm -""" - -from setuptools import setup - -setup() diff --git a/sherlock-project.spec b/sherlock-project.spec deleted file mode 100644 index b07dded1a..000000000 --- a/sherlock-project.spec +++ /dev/null @@ -1,71 +0,0 @@ -# Packager: Paul Pfeister (GitHub @ppfeister) -%global source_ref master - -Name: sherlock-project -Version: 0.14.4 -Release: %autorelease -Summary: Hunt down social media accounts by username across social networks - -License: MIT -URL: https://github.com/sherlock-project/sherlock -Source: %{url}/archive/%{source_ref}.tar.gz -# Switch to new Source URL after adoption of tagged releases - -BuildArch: noarch -BuildRequires: python3-devel -BuildRequires: help2man - -%global _description %{expand: -Hunt down social media accounts by username across 400+ social networks and -websites. New targets are tested and implemented regularly. -} - -%description %{_description} - - -%prep -%autosetup -n sherlock-%{source_ref} - - -%generate_buildrequires -%pyproject_buildrequires - - -%build -%pyproject_wheel - - -%install -%pyproject_install -%pyproject_save_files -l sherlock sites result notify __init__ __main__ - -sed -r -i '1{/^#!/d}' '%{buildroot}%{python3_sitelib}/__main__.py' -sed -r -i '1{/^#!/d}' '%{buildroot}%{python3_sitelib}/sherlock.py' - -install -d '%{buildroot}%{_mandir}/man1' -PYTHONPATH='%{buildroot}%{python3_sitelib}' help2man \ - --no-info \ - --version-string='%{version}' \ - --name='%{summary}' \ - --output='%{buildroot}%{_mandir}/man1/sherlock.1' \ - '%{buildroot}%{_bindir}/sherlock' - - -%check -# Tests fail when pwd isn't sherlock. Relative pathing need fix upstream. -cd sherlock -%{py3_test_envvars} %{python3} -m unittest tests.all --verbose -cd .. - - -%files -f %{pyproject_files} -%doc README.md -%{_bindir}/sherlock -%{python3_sitelib}/resources -%pycached %{python3_sitelib}/tests/*.py -%{_mandir}/man1/sherlock.1* - - -%changelog -* Tue May 14 2024 Paul Pfeister 0.14.4-1 -- Initial package. diff --git a/sherlock/__init__.py b/sherlock/__init__.py index 219dcaec7..5bf79e243 100644 --- a/sherlock/__init__.py +++ b/sherlock/__init__.py @@ -4,3 +4,7 @@ networks. """ + +__shortname__ = "Sherlock" +__longname__ = "Sherlock: Find Usernames Across Social Networks" +__version__ = "0.14.4" diff --git a/sherlock/__main__.py b/sherlock/__main__.py index b10bd6aef..014d8b353 100644 --- a/sherlock/__main__.py +++ b/sherlock/__main__.py @@ -14,9 +14,9 @@ # Check if the user is using the correct version of Python python_version = sys.version.split()[0] - if sys.version_info < (3, 6): - print(f"Sherlock requires Python 3.6+\nYou are using Python {python_version}, which is not supported by Sherlock.") + if sys.version_info < (3, 8): + print(f"Sherlock requires Python 3.8+\nYou are using Python {python_version}, which is not supported by Sherlock.") sys.exit(1) - import sherlock + from sherlock import sherlock sherlock.main() diff --git a/sherlock/notify.py b/sherlock/notify.py index 4af1ff18e..c198fe620 100644 --- a/sherlock/notify.py +++ b/sherlock/notify.py @@ -3,7 +3,7 @@ This module defines the objects for notifying the caller about the results of queries. """ -from result import QueryStatus +from sherlock.result import QueryStatus from colorama import Fore, Style import webbrowser diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 3f7a93391..e029a59da 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -19,18 +19,26 @@ import requests +# Removing __version__ here will trigger update message for users +# Do not remove until ready to trigger that message +__version__ = "0.14.4" +del __version__ + +from .__init__ import ( + __shortname__, + __longname__, + __version__ +) + from requests_futures.sessions import FuturesSession from torrequest import TorRequest -from result import QueryStatus -from result import QueryResult -from notify import QueryNotifyPrint -from sites import SitesInformation +from sherlock.result import QueryStatus +from sherlock.result import QueryResult +from sherlock.notify import QueryNotifyPrint +from sherlock.sites import SitesInformation from colorama import init from argparse import ArgumentTypeError -module_name = "Sherlock: Find Usernames Across Social Networks" -__version__ = "0.14.4" - class SherlockFuturesSession(FuturesSession): def request(self, method, url, hooks=None, *args, **kwargs): @@ -510,14 +518,14 @@ def handler(signal_received, frame): def main(): version_string = ( - f"%(prog)s {__version__}\n" - + f"{requests.__description__}: {requests.__version__}\n" - + f"Python: {platform.python_version()}" + f"{__shortname__} {__version__}\n" + + f"Requests {requests.__version__}\n" + + f"Python {platform.python_version()}" ) parser = ArgumentParser( formatter_class=RawDescriptionHelpFormatter, - description=f"{module_name} (Version {__version__})", + description=f"{__longname__} (Version {__version__})", ) parser.add_argument( "--version", @@ -671,10 +679,10 @@ def main(): # Check for newer version of Sherlock. If it exists, let the user know about it try: r = requests.get( - "https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock/sherlock.py" + "https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock/__init__.py" ) - remote_version = str(re.findall('__version__ = "(.*)"', r.text)[0]) + remote_version = str(re.findall('__version__ *= *"(.*)"', r.text)[0]) local_version = __version__ if remote_version != local_version: diff --git a/sherlock/tests/__init__.py b/tests/__init__.py similarity index 100% rename from sherlock/tests/__init__.py rename to tests/__init__.py diff --git a/sherlock/tests/all.py b/tests/all.py similarity index 100% rename from sherlock/tests/all.py rename to tests/all.py diff --git a/sherlock/tests/base.py b/tests/base.py similarity index 97% rename from sherlock/tests/base.py rename to tests/base.py index de958b9db..2146b88b2 100644 --- a/sherlock/tests/base.py +++ b/tests/base.py @@ -5,10 +5,10 @@ import os import os.path import unittest -import sherlock -from result import QueryStatus -from notify import QueryNotify -from sites import SitesInformation +from sherlock import sherlock +from sherlock.result import QueryStatus +from sherlock.notify import QueryNotify +from sherlock.sites import SitesInformation import warnings @@ -30,7 +30,7 @@ def setUp(self): warnings.simplefilter("ignore", ResourceWarning) # Create object with all information about sites we are aware of. - sites = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../resources/data.json")) + sites = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock/resources/data.json")) # Create original dictionary from SitesInformation() object. # Eventually, the rest of the code will be updated to use the new object diff --git a/sherlock/tests/test_multiple_usernames.py b/tests/test_multiple_usernames.py similarity index 90% rename from sherlock/tests/test_multiple_usernames.py rename to tests/test_multiple_usernames.py index 418110877..3e8a307ee 100644 --- a/sherlock/tests/test_multiple_usernames.py +++ b/tests/test_multiple_usernames.py @@ -1,8 +1,7 @@ -import importlib import unittest import sys sys.path.append('../') -import sherlock as sh +from sherlock import sherlock as sh checksymbols = [] checksymbols = ["_", "-", "."]