commit a6baa9c2a09db9017a2f9cf0b48f0adbf6adda69 Author: godax84 Date: Mon Feb 3 03:22:24 2025 -0800 Carregar ficheiros para "/" diff --git a/ICON.ico b/ICON.ico new file mode 100644 index 0000000..2505cb9 Binary files /dev/null and b/ICON.ico differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..7e9b114 --- /dev/null +++ b/main.py @@ -0,0 +1,88 @@ +import tkinter as tk +from tkinter import filedialog, ttk, scrolledtext +import re + +class PatternFinderGUI: + def __init__(self, root): + self.root = root + self.root.title("PSA EDC17 PIN Finder") + self.root.geometry("600x300") + + # File Selection Frame + file_frame = ttk.LabelFrame(root, text="File Selection", padding=10) + file_frame.pack(fill=tk.X, padx=5, pady=5) + + self.file_path = tk.StringVar() + ttk.Entry(file_frame, textvariable=self.file_path, width=60).pack(side=tk.LEFT, padx=5) + ttk.Button(file_frame, text="Browse", command=self.browse_file).pack(side=tk.LEFT, padx=5) + ttk.Button(file_frame, text="Search PIN", command=self.search_patterns).pack(side=tk.RIGHT) + + # Results Frame + results_frame = ttk.LabelFrame(root, text="Results", padding=10) + results_frame.pack(fill=tk.BOTH, expand=True, padx=5, pady=5) + + self.results_text = scrolledtext.ScrolledText(results_frame, width=80, height=10) + self.results_text.pack(fill=tk.BOTH, expand=True) + + def find_repeated_patterns(self, filepath): + try: + target_content = "" + bytes_per_line = 16 + start_offset = 0x3000 # Hex offset for line 3000 + end_offset = 0x4000 # Hex offset for line 4000 + + with open(filepath, 'rb') as file: + file.seek(start_offset) + data = file.read(end_offset - start_offset) + + for i in range(0, len(data), bytes_per_line): + line = data[i:i + bytes_per_line] + ascii_line = ''.join(chr(b) if 32 <= b <= 126 else '.' for b in line) + target_content += ascii_line.upper() + + pattern = r'[A-Z0-9]{4}' + matches = re.findall(pattern, target_content) + + results = {} + for match in matches: + count = target_content.count(match) + if count == 2: + results[match] = count + + return results + + except Exception as e: + print(f"Error: {e}") + return None + + def browse_file(self): + filepath = filedialog.askopenfilename( + title="Select file", + filetypes=[("Binary files", "*.bin"), ("All files", "*.*")] + ) + if filepath: + self.file_path.set(filepath) + + def search_patterns(self): + filepath = self.file_path.get() + if not filepath: + self.results_text.insert(tk.END, "Please select a file first\n") + return + + results = self.find_repeated_patterns(filepath) + self.results_text.delete(1.0, tk.END) + + if results: + self.results_text.insert(tk.END, "Found PIN that appear exactly twice:\n\n") + for pattern, count in results.items(): + self.results_text.insert(tk.END, f"Pattern: {pattern}\n") + else: + self.results_text.insert(tk.END, "No matching PIN found or error occurred\n") + +def main(): + root = tk.Tk() + app = PatternFinderGUI(root) + root.mainloop() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/version_info.txt b/version_info.txt new file mode 100644 index 0000000..5f3179a --- /dev/null +++ b/version_info.txt @@ -0,0 +1,28 @@ +VSVersionInfo( + ffi=FixedFileInfo( + filevers=(1, 0, 0, 0), + prodvers=(1, 0, 0, 0), + mask=0x3f, + flags=0x0, + OS=0x40004, + fileType=0x1, + subtype=0x0, + date=(0, 0) + ), + kids=[ + StringFileInfo( + [ + StringTable( + u'040904B0', + [StringStruct(u'CompanyName', u'Bruno Ferreira'), + StringStruct(u'FileDescription', u'PSA EDC17 PIN Decoder'), + StringStruct(u'FileVersion', u'1.0.0'), + StringStruct(u'InternalName', u'pin_decoder'), + StringStruct(u'LegalCopyright', u'Copyright (c) 2025'), + StringStruct(u'OriginalFilename', u'pin_decoder.exe'), + StringStruct(u'ProductName', u'PIN Decoder'), + StringStruct(u'ProductVersion', u'1.0.0')]) + ]), + VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) + ] +) \ No newline at end of file