Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Beercow committed Jul 5, 2023
1 parent 421cdd1 commit b62891b
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 200 deletions.
7 changes: 7 additions & 0 deletions Docs/OneDriveExplorerManual.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ A user registry hive can be supplied with the `-r` argument. This will resolve s
# Creating CStructs

# Version changes
## v2023.07.05
### Fixed
#### GUI
* Help dialog
#### GUI/commandline
* SQL is now read-only (fixes errors and is more forensically sound)
* Code clean up
## v2023.05.05
### Added
#### commandline/GUI
Expand Down
Binary file modified OneDriveExplorer/Images/splashv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion OneDriveExplorer/OneDriveExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)

__author__ = "Brian Maloney"
__version__ = "2023.05.05"
__version__ = "2023.07.05"
__email__ = "[email protected]"
rbin = []

Expand Down
178 changes: 58 additions & 120 deletions OneDriveExplorer/OneDriveExplorer_GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from ode.helpers import pandastablepatch
from ode.helpers import ScrollableNotebookpatch
from ode.utils import schema
from ode.helpers.AnimatedGif import *
from ode.helpers.AnimatedGif import AnimatedGif
warnings.filterwarnings("ignore", category=UserWarning)

# Per monitor DPI aware. This app checks for the DPI when it is
Expand Down Expand Up @@ -68,7 +68,7 @@
)

__author__ = "Brian Maloney"
__version__ = "2023.05.05"
__version__ = "2023.07.05"
__email__ = "[email protected]"
rbin = []
found = []
Expand Down Expand Up @@ -1079,8 +1079,8 @@ def __init__(self, root):
self.frame.grid(row=0, column=0)
self.label1.grid(row=0, column=0, padx=(10, 30), pady=(5, 0), sticky='w')
self.label2.grid(row=1, column=0, padx=(10, 30), sticky='w')
self.label3.grid(row=1, column=0, padx=(10, 30), sticky='w')
self.label4.grid(row=2, column=0, padx=(10, 30), pady=(0, 20), sticky='w')
self.label3.grid(row=2, column=0, padx=(10, 30), sticky='w')
self.label4.grid(row=3, column=0, padx=(10, 30), pady=(0, 20), sticky='w')
self.sync_windows()

def sync_windows(self, event=None):
Expand Down Expand Up @@ -1728,126 +1728,56 @@ def ff_count(f, folder_count=0, file_count=0):

def parent_child(d, parent_id=None):
if parent_id is None:
# This line is only for the first call of the function
parent_id = tv.insert("",
"end",
image=root_drive_img,
text=d['Name'],
values=('',
'',
d['ParentId'],
d['DriveItemId'],
d['eTag'],
d['Name'],
d['Type'],
d['Size'],
d['Hash'],
len(d['Children']),
d['Path']))
parent_values = (
'',
'',
d['ParentId'],
d['DriveItemId'],
d['eTag'],
d['Name'],
d['Type'],
d['Size'],
d['Hash'],
len(d['Children']),
d['Path']
)
parent_id = tv.insert("", "end", image=root_drive_img, text=d['Name'], values=parent_values)

for c in d['Children']:
# Here we create a new row object in the TreeView and pass its return value for recursion
# The return value will be used as the argument for the first parameter of this same line of code after recursion
if c['Type'] == 'Folder':
if c['Type'] in type_mapping:
img, *values, tags, insert = type_mapping[c['Type']]
folder_count, file_count = ff_count(c['Children'])
parent_child(c, tv.insert(parent_id,
0,
image=folder_img,
text=c['Name'],
values=(folder_count,
file_count,
c['ParentId'],
c['DriveItemId'],
c['eTag'],
c['Name'],
c['Type'],
c['Size'],
c['Hash'],
len(c['Children']),
c['Path'])))
elif c['Type'] == 'Root Default':
parent_child(c, tv.insert(parent_id,
0,
image=default_img,
text=c['Name'],
values=('',
'',
c['ParentId'],
c['DriveItemId'],
c['eTag'],
c['Name'],
c['Type'],
c['Size'],
c['Hash'],
len(c['Children']),
c['Path'])))
elif c['Type'] == 'Root Shared':
parent_child(c, tv.insert(parent_id,
"end",
image=shared_img,
text=c['Name'],
values=('',
'',
c['ParentId'],
c['DriveItemId'],
c['eTag'],
c['Name'],
c['Type'],
c['Size'],
c['Hash'],
len(c['Children']),
c['Path'])))
elif c['Type'] == 'Root Deleted':
parent_child(c, tv.insert(parent_id,
"end",
image=del_img,
text=c['Name'],
values=('',
'',
c['ParentId'],
c['DriveItemId'],
c['eTag'],
c['Name'],
c['Type'],
c['Size'],
c['Hash'],
len(c['Children']),
c['Path']),
tags='red'))
elif c['Type'] == 'File - deleted':
parent_child(c, tv.insert(parent_id,
"end",
image=file_img,
text=c['Name'],
values=('',
'',
c['ParentId'],
c['DriveItemId'],
c['eTag'],
c['Name'],
c['Type'],
c['Size'],
c['Hash'],
len(c['Children']),
c['Path'],
c['DeleteTimeStamp']),
tags='red'))
values = (
folder_count,
file_count,
c['ParentId'],
c['DriveItemId'],
c['eTag'],
c['Name'],
c['Type'],
c['Size'],
c['Hash'],
len(c['Children']),
c['Path'],
*values
)
parent_child(c, tv.insert(parent_id, insert, image=img, text=c['Name'], values=values, tags=tags))
else:
parent_child(c, tv.insert(parent_id,
"end",
image=file_img,
text=c['Name'],
values=('',
'',
c['ParentId'],
c['DriveItemId'],
c['eTag'],
c['Name'],
c['Type'],
c['Size'],
c['Hash'],
len(c['Children']),
c['Path'])))
values = (
'',
'',
c['ParentId'],
c['DriveItemId'],
c['eTag'],
c['Name'],
c['Type'],
c['Size'],
c['Hash'],
len(c['Children']),
c['Path']
)
parent_child(c, tv.insert(parent_id, "end", image=file_img, text=c['Name'], values=values))

root.update_idletasks()


Expand Down Expand Up @@ -3043,6 +2973,14 @@ def sync():
pandastablepatch.asc_img = asc_img
pandastablepatch.desc_img = desc_img

type_mapping = {
'Folder': (folder_img, '', '', '', '', '', '', '', '', 0),
'Root Default': (default_img, '', '', '', '', '', '', '', '', 0),
'Root Shared': (shared_img, '', '', '', '', '', '', '', '', 'end'),
'Root Deleted': (del_img, '', '', '', '', '', '', '', 'red', 'end'),
'File - deleted': (file_img, '', '', '', '', '', '', '', 'red', 'end'),
}

root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)

Expand Down
7 changes: 2 additions & 5 deletions OneDriveExplorer/ode/helpers/AnimatedGif.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
"""
import sys
import time
try:
import Tkinter as tk # for Python2
except ImportError:
import tkinter as tk # for Python3
from tkinter import ttk
import tkinter as tk # for Python3
from tkinter import ttk


class AnimatedGif(tk.Label):
Expand Down
11 changes: 2 additions & 9 deletions OneDriveExplorer/ode/parsers/onedrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

import logging
import pandas as pd
from Registry import Registry
import ode.parsers.recbin as find_deleted
from ode.utils import find_parent
from ode.utils import find_parent, parse_reg

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -58,13 +57,7 @@ def parse_onedrive(df, account=False, reghive=False, recbin=False, gui=False, pb

if reghive:
try:
reg_handle = Registry.Registry(reghive)
int_keys = reg_handle.open('SOFTWARE\\SyncEngines\\Providers\\OneDrive')

od_keys = reg_handle.open(f'SOFTWARE\\Microsoft\\OneDrive\\Accounts\\{account}\\Tenants')

for providers in int_keys.subkeys():
df.loc[(df.DriveItemId == providers.name().split('+')[0]), ['Name']] = [x.value() for x in list(providers.values()) if x.name() == 'MountPoint'][0]
df, od_keys = parse_reg(reghive, account, df)

if recbin:
rbin = find_deleted.find_deleted(recbin, od_keys, account,
Expand Down
Loading

0 comments on commit b62891b

Please sign in to comment.