Skip to content

Commit

Permalink
nikto download on user request
Browse files Browse the repository at this point in the history
  • Loading branch information
Antu7 committed Jan 13, 2025
1 parent c52f1b6 commit 419663d
Show file tree
Hide file tree
Showing 105 changed files with 54 additions and 36,206 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ web_modules/
custom_profiles/

# Security tools
/tools/security/arachni/*
/tools/security/*
7 changes: 7 additions & 0 deletions Framework/Built_In_Automation/Security/BuiltInFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from arachni_download import check_and_install_arachni
from nikto_download import check_and_download_nikto
from arachni_run import run_arachni_scan, generate_report_from_afr
from helper import extract_target, check_perl_installed, display_table, save_report_to_file
from Framework.Built_In_Automation.Shared_Resources import BuiltInFunctionSharedResources as sr
Expand Down Expand Up @@ -116,6 +117,12 @@ def server_scaning_nikto(data_set: list) -> str:
"""
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.abspath(os.path.join(CURRENT_DIR, "../../.."))

# Ensure Nikto is downloaded and ready
if not check_and_download_nikto():
return "zeuz_failed"

# Define NIKTO_DIR only after ensuring Nikto exists
NIKTO_DIR = os.path.join(BASE_DIR, "tools", "security", "nikto", "program")
NIKTO_SCRIPT_PATH = os.path.join(NIKTO_DIR, "nikto.pl")
nikto_target = next(item[2] for item in data_set if item[0] == 'nikto')
Expand Down
42 changes: 42 additions & 0 deletions Framework/Built_In_Automation/Security/nikto_download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import requests
from pathlib import Path
import shutil
import zipfile
import io

CURRENT_DIR = Path(__file__).resolve().parent
BASE_DIR = CURRENT_DIR.parents[2]
NIKTO_DIR = BASE_DIR / "tools" / "security" / "nikto"


def check_and_download_nikto():
# GitHub URL for Nikto
NIKTO_REPO_URL = "https://github.com/sullo/nikto/archive/refs/heads/master.zip"

# Check if the Nikto directory exists
if not NIKTO_DIR.exists():
print("Nikto directory not found. Downloading from GitHub...")
try:
response = requests.get(NIKTO_REPO_URL)
response.raise_for_status()

NIKTO_DIR.parent.mkdir(parents=True, exist_ok=True)

# Extract the zip file into the NIKTO_DIR
with zipfile.ZipFile(io.BytesIO(response.content)) as zip_file:
# Extract all files to a temporary folder
temp_dir = NIKTO_DIR.parent / "temp_nikto"
zip_file.extractall(temp_dir)
# Move the extracted content to the target directory
extracted_folder = temp_dir / "nikto-master"
shutil.move(str(extracted_folder), str(NIKTO_DIR))
# Remove the temporary folder
shutil.rmtree(temp_dir)
print(f"Nikto successfully downloaded and extracted to {NIKTO_DIR}")
return True
except Exception as e:
print(f"Failed to download or extract Nikto: {e}")
return False
else:
return True

8 changes: 4 additions & 4 deletions Framework/settings.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Authentication]
username = admin
api-key = 412557ad-e5de-4a73-ae84-d0da5e14a64d
server_address = http://localhost
username = antu
api-key = 3b011e1a-01f9-42ea-9099-b003497a2692
server_address = https://zeuz.zeuz.ai

[Advanced Options]
module_update_interval = 30
Expand All @@ -10,7 +10,7 @@ element_wait = 10
available_to_all_project = False
_file = temp_config.ini
_file_upload_path = TestExecutionLog
last_module_update_date = 2024-12-11
last_module_update_date = 2025-01-13
last_log_delete_date = 2023-09-19
stop_live_log = False

Expand Down
9 changes: 0 additions & 9 deletions tools/security/nikto/.dockerignore

This file was deleted.

15 changes: 0 additions & 15 deletions tools/security/nikto/.editorconfig

This file was deleted.

1 change: 0 additions & 1 deletion tools/security/nikto/.gitattributes

This file was deleted.

1 change: 0 additions & 1 deletion tools/security/nikto/.github/FUNDING.yml

This file was deleted.

12 changes: 0 additions & 12 deletions tools/security/nikto/.github/ISSUE_TEMPLATE/FeatureRequest.md

This file was deleted.

16 changes: 0 additions & 16 deletions tools/security/nikto/.github/ISSUE_TEMPLATE/TestRequest.md

This file was deleted.

32 changes: 0 additions & 32 deletions tools/security/nikto/.github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

1 change: 0 additions & 1 deletion tools/security/nikto/.github/ISSUE_TEMPLATE/config.yml

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions tools/security/nikto/.gitignore

This file was deleted.

Loading

0 comments on commit 419663d

Please sign in to comment.