Logs Script Python To Extract Url Pass From Fresh Log
Here is script. After you download rar log file, you extract rar file then run this script:
Link :
===============CONTENT==============
import os
# Get the path to the directory
path = "/home/yourname/logurl/MAY/2023-5-10-147PCS"
f=open("store.txt","a")
print("Extracting...")
# Get a list of all the sub-directories in the directory
sub_directories = os.listdir(path)
# Print the names of the sub-directories
#for sub_directory in sub_directories:
# print(sub_directory)
url=""
username=''
password=''
for sub_directory in sub_directories:
# Get the path to the sub-directory
sub_directory_path = os.path.join(path, sub_directory)
# Get a list of all the files in the sub-directory
files = os.listdir(sub_directory_path)
# Iterate over the files
for file in files:
# Check if the file is named "Passwords.txt"
if file == "Passwords.txt":
#print(file)
full_path = os.path.join(sub_directory_path,file)
f1=open(full_path,'r')
lines=f1.readlines()
for line in lines:
if "http" in line: url=str(line).rstrip()
if "Username" in line: username=str(line).rstrip()
if "Password" in line: password=str(line)
f.write(url+"|"+username+"|"+password+"\n")
f.close()
#print(full_path)
print("DONE")
====================END==============
Enjoy
Link :
You do not have permission to view link
Log in or register now.
===============CONTENT==============
import os
# Get the path to the directory
path = "/home/yourname/logurl/MAY/2023-5-10-147PCS"
f=open("store.txt","a")
print("Extracting...")
# Get a list of all the sub-directories in the directory
sub_directories = os.listdir(path)
# Print the names of the sub-directories
#for sub_directory in sub_directories:
# print(sub_directory)
url=""
username=''
password=''
for sub_directory in sub_directories:
# Get the path to the sub-directory
sub_directory_path = os.path.join(path, sub_directory)
# Get a list of all the files in the sub-directory
files = os.listdir(sub_directory_path)
# Iterate over the files
for file in files:
# Check if the file is named "Passwords.txt"
if file == "Passwords.txt":
#print(file)
full_path = os.path.join(sub_directory_path,file)
f1=open(full_path,'r')
lines=f1.readlines()
for line in lines:
if "http" in line: url=str(line).rstrip()
if "Username" in line: username=str(line).rstrip()
if "Password" in line: password=str(line)
f.write(url+"|"+username+"|"+password+"\n")
f.close()
#print(full_path)
print("DONE")
====================END==============
Enjoy
Last edited: