diff --git a/TraceNinja/traceninja.py b/TraceNinja/traceninja.py index 1bf7b5c..f154d1e 100644 --- a/TraceNinja/traceninja.py +++ b/TraceNinja/traceninja.py @@ -4,18 +4,50 @@ from TraceNinja.utils.handler import handler from rich import print as rprint from TraceNinja.modules import crtsh, alienvault, hackertarget, jldc, securitytrails, rapidapi +from importlib_metadata import version as get_installed_version +from packaging.version import Version +import subprocess +import sys +import pkg_resources + +CURRENT_VERSION = pkg_resources.require("TraceNinja")[0].version + +def updater(): + update = input("Do you want to update TraceNinja? (yes/no): ").lower().strip() + + if update == "yes": + try: + subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "TraceNinja"]) + print("TraceNinja has been successfully updated!") + except subprocess.CalledProcessError as e: + print(f"An error occurred while updating: {e}") + except Exception as e: + print(f"An unexpected error occurred: {e}") + elif update == "no": + print("Update cancelled.") + else: + print("Invalid input. Please enter 'yes' or 'no'.") + +installed_version = get_installed_version('TraceNinja') def main(): + domain, output = handler() now = datetime.datetime.now() print("-----------------------------------------------------------------------------") - print("🛠️ Version: Beta") + print("🛠️ Version:", CURRENT_VERSION) print("🎯 Target Domain:" , domain) print("⏰ Starting:", now.strftime("%Y-%m-%d %H:%M:%S")) print("-----------------------------------------------------------------------------") + if Version(CURRENT_VERSION) < Version(installed_version): + print("update your package") + updater() + elif Version(installed_version) == Version(CURRENT_VERSION): + print(f"You are running the latest version of TraceNinja. (Version: {CURRENT_VERSION})") + scripts = [crtsh, alienvault, hackertarget, jldc, securitytrails, rapidapi] rprint("[deep_sky_blue1][INFO]","Starting subdomain enumeration for target: {}".format(domain)) with concurrent.futures.ThreadPoolExecutor() as executor: diff --git a/requirements.txt b/requirements.txt index 33586d2..14bc75c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +importlib_metadata==8.4.0 +packaging==24.1 python-dotenv==1.0.1 Requests==2.32.3 rich==13.8.0 diff --git a/setup.cfg b/setup.cfg index a3f0a26..c4f7060 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = TraceNinja -version = 1.0.2 +version = 1.0.3 author = Mohamed description = TraceNinja is a subdomain enumeration tool for Python that allows you to enumerate domains and gather information about them. And much much more on the future ^_^. It's currently under development. license = MIT diff --git a/setup.py b/setup.py index de99748..ded5351 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -with open("README.md", "r") as fh: +with open("README.md", "r", encoding = "utf-8") as fh: long_description = fh.read() with open("requirements.txt") as f: @@ -8,7 +8,7 @@ setup( name="TraceNinja", - version="1.0.2", + version="1.0.3", description="""TraceNinja is a subdomain enumeration tool for Python that allows you to enumerate domains and gather information about them. And much much more on the future ^_^. It's currently under development.""", long_description=long_description, long_description_content_type="text/markdown",