Logs Script Python To Extract Url Pass From Fresh Log

Logs Script Python To Extract Url Pass From Fresh Log

Hihihehe

User
User ID
20789
Jul 13, 2023
17
37
#CR
10
  • Thread starter
  • Thread Author
  • #1
Here is script. After you download rar log file, you extract rar file then run this script:
Link : You must be logged in to see this 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
 
Last edited:
C:\Users\Administrator\Documents>python logs.py File "C:\Users\Administrator\Documents\logs.py", line 34 sub_directory_path = os.path.join(path, sub_directory) ^ IndentationError: expected an indented block after 'for' statement on line 29


what happened with this sir?
 
C:\Users\Administrator\Documents>python logs.py File "C:\Users\Administrator\Documents\logs.py", line 34 sub_directory_path = os.path.join(path, sub_directory) ^ IndentationError: expected an indented block after 'for' statement on line 29


what happened with this sir?
IndentationError: expected an indented block after 'for' statement on line 29
 
  • Thread starter
  • Thread Author
  • #4
C:\Users\Administrator\Documents>python logs.py File "C:\Users\Administrator\Documents\logs.py", line 34 sub_directory_path = os.path.join(path, sub_directory) ^ IndentationError: expected an indented block after 'for' statement on line 29


what happened with this sir?,
Hello, I added link download in post. pls check
 
Back
Top Bottom