Untitled
unknown
plain_text
a year ago
1.4 kB
10
Indexable
#Seems that we are having fun with the .log file.
#I got some information hidden there, you will need to cherry pick the information somehow....
#We got some code fragment to help us out, now we just gotta find all of the info and print it out :)
#I will need mac, maceth, sn, name, firmware version(2lines to be exact), [USB DEVICES] (5 lines to be exact)
#GOOOOOOD LUCK!
#BONUS: read out the max_attempt_count value, most likely ChatGPT or Perplexity might help us with that one...
extract_info_sysinfo = []
sysinfo_log_path = "C:/Users/dexde/Downloads/troubleshoot-RUTM52-2024-12-06.tar_extracted/troubleshoot/betkas.log"
print(f"Contents of {sysinfo_log_path}:")
takeInfo = ["name:"]
takeInfoNextLine = ["[Firmware version]", "[Uptime]"]
with open(sysinfo_log_path, 'r') as log_file:
log_file = log_file.readlines()
for line in log_file:
for word in takeInfo:
if word in line:
extract_info_sysinfo.append(line)
break
# Search for the "[Firmware version] and uptime" line and print the one after it
for i, line in enumerate(log_file):
for word in takeInfoNextLine:
if word in line:
# Check if the next line exists
if i + 1 < len(log_file):
extract_info_sysinfo.append(word +" "+ log_file[i + 1].strip())
break # Stop searching after finding the line
print(extract_info_sysinfo)Editor is loading...
Leave a Comment