Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter import ttk
- import hashlib
- import os
- root = Tk()
- rootDir =['0']
- dirName =['1']
- subdirList =['2']
- fileList =['3']
- hashupdate =['4']
- rootDir = r"C:UsersGhostDocumentsMalwareTest"
- output = []
- for dirName, subdirList, fileList in os.walk(rootDir, topdown=True):
- print('Directory:', dirName)
- for x in fileList:
- hashupdate = hashlib.md5()
- with open(os.path.join(dirName, x), 'rb') as f:
- hashupdate.update(f.read())
- output.append(' {} t {}'.format(x, hashupdate.hexdigest()))
- output = 'n'.join(output)
- print(output)
- info = [ ["rootDir"," ", " "],
- ["subdirList"," ", " "],
- [" ","fileList[3]", "hashupdate[4]"],
- [" ","fileList[3]", "hashupdate[4]"],
- ["For Example:"," ", " "],
- ["C:/Users/Ghost/Documents/MalwareTest"," ", " "],
- ["C:/Users/Ghost/Documents/MalwareTest/New folder"," ", " "],
- [" ","0020.jpg", "45174161873c84172b66ba4a00bf1f09"],
- [" ","2215.jpg", "a26ea006064799dd2a640b5d7edf613a"] ]
- frame = Frame(root)
- frame.pack()
- dataTree = ttk.Treeview(frame, columns = (1,2,3), height = 5, show = "headings")
- dataTree.pack(side = 'left')
- dataTree.heading(1, text="Directory")
- dataTree.heading(2, text="Filename")
- dataTree.heading(3, text="MD5 Hashes")
- dataTree.column(1, width = 300)
- dataTree.column(2, width = 150)
- dataTree.column(3, width = 220)
- xscroll = Scrollbar(frame, orient="horizontal", command=dataTree.xview)
- xscroll.pack(side = 'bottom', fill = 'x')
- yscroll = Scrollbar(frame, orient="vertical", command=dataTree.yview)
- yscroll.pack(side = 'right', fill = 'y')
- dataTree.configure(xscrollcommand=xscroll.set)
- dataTree.configure(yscrollcommand=yscroll.set)
- for val in info:
- dataTree.insert('', 'end', values = (val[0], val[1], val[2]) )
- root.mainloop()
Add Comment
Please, Sign In to add comment