0

I am creating a GUI application which can load a disk image (i.e. output of linux dd command) and list down all its files and directories along with extensions and date created/modified etc.

I have been using tkinter previously to load drives in GUI, however I didn't get success loading disk image files.

Below is code for loading drive

def browseFiles():
file = filedialog.askopenfile(initialdir = "/",
                                      title = "Select a File",
                                      filetypes = (("Text files",
                                                    "*.txt*"),
                                                   ("all files",
                                                    "*.*")))
  
# Change label contents
filepath = os.path.abspath(file.name)
label_file_explorer.configure(text="File Opened: "+filepath)
metadata = subprocess.run(['ls', '-la', 'grep', filepath], capture_output=True, text=True, shell=True)
label_file_metadata.configure(text=metadata)

How can I modify to load disk images?

aneela
  • 1,457
  • 3
  • 24
  • 45
  • Do you mean it should create a disk image? Or load one created by the user in advance? What extension do you expect the user might choose? Btw, parsing the output of `ls` is extremely undesirable - use `stat` instead https://www.tutorialspoint.com/python/os_stat.htm – Mark Setchell Nov 04 '21 at 08:24
  • The disk image file is a binary file, so what do you want to do with the disk image? – acw1668 Nov 04 '21 at 08:32
  • @Mark The disk image has already been created (.dd, .aff, .001, .E01 and .S01 file extensions are expected). I need to load this image just like a drive and get its file tree in GUI. – aneela Nov 04 '21 at 08:39
  • @acw1668 I understand. I am creating a python application (GUI based) to analyze the disk image and first step is to load its files/folders. I hope I am able to convey the purpose. – aneela Nov 04 '21 at 08:42
  • I don't think that you can treat the disk images as a file system before mounting it. – acw1668 Nov 04 '21 at 09:19
  • @acw1668 thats the problem I am facing, how can I go about it? – aneela Nov 04 '21 at 09:30

1 Answers1

0

I have used diskimage library to read disk images and then from the response populate Listbox of tkinter to create a minimal GUI.

aneela
  • 1,457
  • 3
  • 24
  • 45