From 7f6f600fed31d5de9bfe0089a12c5cff6fd0d1a5 Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Mon, 24 Jun 2024 16:26:07 -0400 Subject: [PATCH 1/4] Update homepage --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fafa9f8..7f5a896 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ classifiers = [ "Programming Language :: Python :: 3", "Topic :: Security" ] -homepage = "https://sherlock-project.github.io/" +homepage = "https://sherlockproject.xyz/" repository = "https://github.com/sherlock-project/sherlock" From ca781a3c3be60d244a524b8dd5c8dc3460631ceb Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Mon, 24 Jun 2024 16:40:03 -0400 Subject: [PATCH 2/4] Rename importable module --- docs/{pyproj => pyproject}/README.md | 0 pyproject.toml | 6 +++--- {sherlock => sherlock_project}/__init__.py | 0 {sherlock => sherlock_project}/__main__.py | 2 +- {sherlock => sherlock_project}/notify.py | 2 +- {sherlock => sherlock_project}/resources/data.json | 0 .../resources/data.schema.json | 0 {sherlock => sherlock_project}/result.py | 0 {sherlock => sherlock_project}/sherlock.py | 12 ++++++------ {sherlock => sherlock_project}/sites.py | 0 tests/conftest.py | 2 +- tests/few_test_basic.py | 4 ++-- tests/test_probes.py | 6 +++--- tests/test_ux.py | 2 +- tests/test_version.py | 4 ++-- 15 files changed, 20 insertions(+), 20 deletions(-) rename docs/{pyproj => pyproject}/README.md (100%) rename {sherlock => sherlock_project}/__init__.py (100%) rename {sherlock => sherlock_project}/__main__.py (92%) rename {sherlock => sherlock_project}/notify.py (99%) rename {sherlock => sherlock_project}/resources/data.json (100%) rename {sherlock => sherlock_project}/resources/data.schema.json (100%) rename {sherlock => sherlock_project}/result.py (100%) rename {sherlock => sherlock_project}/sherlock.py (98%) rename {sherlock => sherlock_project}/sites.py (100%) diff --git a/docs/pyproj/README.md b/docs/pyproject/README.md similarity index 100% rename from docs/pyproj/README.md rename to docs/pyproject/README.md diff --git a/pyproject.toml b/pyproject.toml index 7f5a896..0cfc927 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,8 +20,8 @@ maintainers = [ "Matheus Felipe ", "Sondre Karlsen Dyrnes " ] -readme = "docs/pyproj/README.md" -packages = [ { include = "sherlock"} ] +readme = "docs/pyproject/README.md" +packages = [ { include = "sherlock_project"} ] keywords = [ "osint", "reconnaissance", "information gathering" ] classifiers = [ "Development Status :: 5 - Production/Stable", @@ -56,4 +56,4 @@ openpyxl = "^3.0.10" jsonschema = "^4.0.0" [tool.poetry.scripts] -sherlock = 'sherlock.sherlock:main' +sherlock = 'sherlock_project.sherlock:main' diff --git a/sherlock/__init__.py b/sherlock_project/__init__.py similarity index 100% rename from sherlock/__init__.py rename to sherlock_project/__init__.py diff --git a/sherlock/__main__.py b/sherlock_project/__main__.py similarity index 92% rename from sherlock/__main__.py rename to sherlock_project/__main__.py index 014d8b3..3193831 100644 --- a/sherlock/__main__.py +++ b/sherlock_project/__main__.py @@ -18,5 +18,5 @@ if __name__ == "__main__": print(f"Sherlock requires Python 3.8+\nYou are using Python {python_version}, which is not supported by Sherlock.") sys.exit(1) - from sherlock import sherlock + from sherlock_project import sherlock sherlock.main() diff --git a/sherlock/notify.py b/sherlock_project/notify.py similarity index 99% rename from sherlock/notify.py rename to sherlock_project/notify.py index c198fe6..f6c785d 100644 --- a/sherlock/notify.py +++ b/sherlock_project/notify.py @@ -3,7 +3,7 @@ This module defines the objects for notifying the caller about the results of queries. """ -from sherlock.result import QueryStatus +from sherlock_project.result import QueryStatus from colorama import Fore, Style import webbrowser diff --git a/sherlock/resources/data.json b/sherlock_project/resources/data.json similarity index 100% rename from sherlock/resources/data.json rename to sherlock_project/resources/data.json diff --git a/sherlock/resources/data.schema.json b/sherlock_project/resources/data.schema.json similarity index 100% rename from sherlock/resources/data.schema.json rename to sherlock_project/resources/data.schema.json diff --git a/sherlock/result.py b/sherlock_project/result.py similarity index 100% rename from sherlock/result.py rename to sherlock_project/result.py diff --git a/sherlock/sherlock.py b/sherlock_project/sherlock.py similarity index 98% rename from sherlock/sherlock.py rename to sherlock_project/sherlock.py index db8e9c2..4497d44 100644 --- a/sherlock/sherlock.py +++ b/sherlock_project/sherlock.py @@ -24,18 +24,18 @@ import requests __version__ = "0.14.4" del __version__ -from .__init__ import ( # noqa: E402 +from sherlock_project.__init__ import ( # noqa: E402 __longname__, __version__ ) from requests_futures.sessions import FuturesSession # noqa: E402 from torrequest import TorRequest # noqa: E402 -from sherlock.result import QueryStatus # noqa: E402 -from sherlock.result import QueryResult # noqa: E402 -from sherlock.notify import QueryNotify # noqa: E402 -from sherlock.notify import QueryNotifyPrint # noqa: E402 -from sherlock.sites import SitesInformation # noqa: E402 +from sherlock_project.result import QueryStatus # noqa: E402 +from sherlock_project.result import QueryResult # noqa: E402 +from sherlock_project.notify import QueryNotify # noqa: E402 +from sherlock_project.notify import QueryNotifyPrint # noqa: E402 +from sherlock_project.sites import SitesInformation # noqa: E402 from colorama import init # noqa: E402 from argparse import ArgumentTypeError # noqa: E402 diff --git a/sherlock/sites.py b/sherlock_project/sites.py similarity index 100% rename from sherlock/sites.py rename to sherlock_project/sites.py diff --git a/tests/conftest.py b/tests/conftest.py index a13388b..2dcf784 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,7 +2,7 @@ import os import json import urllib import pytest -from sherlock.sites import SitesInformation +from sherlock_project.sites import SitesInformation @pytest.fixture() def sites_obj(): diff --git a/tests/few_test_basic.py b/tests/few_test_basic.py index 7ec81ac..f704032 100644 --- a/tests/few_test_basic.py +++ b/tests/few_test_basic.py @@ -1,7 +1,7 @@ -import sherlock +import sherlock_project #from sherlock.sites import SitesInformation #local_manifest = data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock/resources/data.json") def test_username_via_message(): - sherlock.__main__("--version") + sherlock_project.__main__("--version") diff --git a/tests/test_probes.py b/tests/test_probes.py index 06f8e3c..21bbe1d 100644 --- a/tests/test_probes.py +++ b/tests/test_probes.py @@ -2,9 +2,9 @@ import pytest import random import string import re -from sherlock.sherlock import sherlock -from sherlock.notify import QueryNotify -from sherlock.result import QueryStatus +from sherlock_project.sherlock import sherlock +from sherlock_project.notify import QueryNotify +from sherlock_project.result import QueryStatus #from sherlock_interactives import Interactives diff --git a/tests/test_ux.py b/tests/test_ux.py index c14035f..3c62463 100644 --- a/tests/test_ux.py +++ b/tests/test_ux.py @@ -1,5 +1,5 @@ import pytest -from sherlock import sherlock +from sherlock_project import sherlock from sherlock_interactives import Interactives from sherlock_interactives import InteractivesSubprocessError diff --git a/tests/test_version.py b/tests/test_version.py index 68119c9..c4fd00d 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,10 +1,10 @@ import os from sherlock_interactives import Interactives -import sherlock +import sherlock_project def test_versioning() -> None: # Ensure __version__ matches version presented to the user - assert sherlock.__version__ in Interactives.run_cli("--version") + assert sherlock_project.__version__ in Interactives.run_cli("--version") # Ensure __init__ is single source of truth for __version__ in package # Temporarily allows sherlock.py so as to not trigger early upgrades found:list = Interactives.walk_sherlock_for_files_with(r'__version__ *= *') From 267e5a6979567a028bc81063b52bddd1f58d5ff1 Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Mon, 24 Jun 2024 17:04:50 -0400 Subject: [PATCH 3/4] Adjust ci paths --- tests/conftest.py | 6 +++--- tests/sherlock_interactives.py | 2 +- tests/test_manifest.py | 6 +++--- tests/test_version.py | 4 ++-- tox.ini | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2dcf784..51c9081 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,18 +6,18 @@ from sherlock_project.sites import SitesInformation @pytest.fixture() def sites_obj(): - sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock/resources/data.json")) + sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json")) yield sites_obj @pytest.fixture(scope="session") def sites_info(): - sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock/resources/data.json")) + sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json")) sites_iterable = {site.name: site.information for site in sites_obj} yield sites_iterable @pytest.fixture(scope="session") def remote_schema(): - schema_url: str = 'https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock/resources/data.schema.json' + schema_url: str = 'https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock_project/resources/data.schema.json' with urllib.request.urlopen(schema_url) as remoteschema: schemadat = json.load(remoteschema) yield schemadat diff --git a/tests/sherlock_interactives.py b/tests/sherlock_interactives.py index d0424af..2c9d9d9 100644 --- a/tests/sherlock_interactives.py +++ b/tests/sherlock_interactives.py @@ -25,7 +25,7 @@ class Interactives: """Check all files within the Sherlock package for matching patterns""" pattern:re.Pattern = re.compile(pattern) matching_files:list[str] = [] - for root, dirs, files in os.walk("sherlock"): + for root, dirs, files in os.walk("sherlock_project"): for file in files: file_path = os.path.join(root,file) if "__pycache__" in file_path: diff --git a/tests/test_manifest.py b/tests/test_manifest.py index 177af21..5c47fbb 100644 --- a/tests/test_manifest.py +++ b/tests/test_manifest.py @@ -5,8 +5,8 @@ from jsonschema import validate def test_validate_manifest_against_local_schema(): """Ensures that the manifest matches the local schema, for situations where the schema is being changed.""" - json_relative: str = '../sherlock/resources/data.json' - schema_relative: str = '../sherlock/resources/data.schema.json' + json_relative: str = '../sherlock_project/resources/data.json' + schema_relative: str = '../sherlock_project/resources/data.schema.json' json_path: str = os.path.join(os.path.dirname(__file__), json_relative) schema_path: str = os.path.join(os.path.dirname(__file__), schema_relative) @@ -22,7 +22,7 @@ def test_validate_manifest_against_local_schema(): @pytest.mark.online def test_validate_manifest_against_remote_schema(remote_schema): """Ensures that the manifest matches the remote schema, so as to not unexpectedly break clients.""" - json_relative: str = '../sherlock/resources/data.json' + json_relative: str = '../sherlock_project/resources/data.json' json_path: str = os.path.join(os.path.dirname(__file__), json_relative) with open(json_path, 'r') as f: diff --git a/tests/test_version.py b/tests/test_version.py index c4fd00d..9184222 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -10,8 +10,8 @@ def test_versioning() -> None: found:list = Interactives.walk_sherlock_for_files_with(r'__version__ *= *') expected:list = [ # Normalization is REQUIRED for Windows ( / vs \ ) - os.path.normpath("sherlock/__init__.py"), - os.path.normpath("sherlock/sherlock.py"), + os.path.normpath("sherlock_project/__init__.py"), + os.path.normpath("sherlock_project/sherlock.py"), ] # Sorting is REQUIRED for Mac assert sorted(found) == sorted(expected) diff --git a/tox.ini b/tox.ini index 0c30941..933b6a3 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ deps = pytest allowlist_externals = coverage commands = - coverage run --source=sherlock --module pytest -v + coverage run --source=sherlock_project --module pytest -v coverage report --show-missing [testenv:offline] From cf7032dd9973ff30d83ea9ac446dfcc6910387cc Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Mon, 8 Jul 2024 04:20:58 -0400 Subject: [PATCH 4/4] Symlink to new manifest location Clients that aren't yet updated will still rely on this location after the move, and will fail unexpectedly. Symlink allows existing clients to function as otherwise expected until they finally update. --- sherlock/resources/data.json | 1 + sherlock/resources/data.schema.json | 1 + 2 files changed, 2 insertions(+) create mode 120000 sherlock/resources/data.json create mode 120000 sherlock/resources/data.schema.json diff --git a/sherlock/resources/data.json b/sherlock/resources/data.json new file mode 120000 index 0000000..8977d83 --- /dev/null +++ b/sherlock/resources/data.json @@ -0,0 +1 @@ +sherlock_project/resources/data.json \ No newline at end of file diff --git a/sherlock/resources/data.schema.json b/sherlock/resources/data.schema.json new file mode 120000 index 0000000..fc5b117 --- /dev/null +++ b/sherlock/resources/data.schema.json @@ -0,0 +1 @@ +sherlock_project/resources/data.schema.json \ No newline at end of file