Skip to content

Commit

Permalink
v2024.10.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Beercow committed Oct 16, 2024
1 parent f29085d commit 7cfddd2
Show file tree
Hide file tree
Showing 52 changed files with 370 additions and 96 deletions.
Binary file added OneDriveExplorer/Images/colors/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/10_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/11_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/12_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/13_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/14_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/15_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/1_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/2_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/3_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/4_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/5_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/6_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OneDriveExplorer/Images/colors/7_big.png
Binary file added OneDriveExplorer/Images/colors/8.png
Binary file added OneDriveExplorer/Images/colors/8_big.png
Binary file added OneDriveExplorer/Images/colors/9.png
Binary file added OneDriveExplorer/Images/colors/9_big.png
Binary file added OneDriveExplorer/Images/folders/link.png
Binary file added OneDriveExplorer/Images/folders/not_link.png
Binary file added OneDriveExplorer/Images/folders/not_sync.png
Binary file added OneDriveExplorer/Images/folders/sync.png
Binary file added OneDriveExplorer/Images/folders/unknown.png
Binary file added OneDriveExplorer/Images/popup/Icon136.ico
Binary file not shown.
Binary file added OneDriveExplorer/Images/remove/shield_red.png
Binary file modified OneDriveExplorer/Images/search/link_big.png
Binary file modified OneDriveExplorer/Images/search/not_link_big.png
Binary file added OneDriveExplorer/Images/search/unknown.png
Binary file modified OneDriveExplorer/Images/splashv.png
Binary file added OneDriveExplorer/Images/status/always_available.png
6 changes: 4 additions & 2 deletions OneDriveExplorer/OneDriveExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
)

__author__ = "Brian Maloney"
__version__ = "2024.09.20"
__version__ = "2024.10.16"
__email__ = "bmmaloney97@gmail.com"
rbin = []
DATParser = dat_parser.DATParser()
Expand Down Expand Up @@ -350,7 +350,9 @@ def output():
print(f'\n\nParsing {key} OneDrive logs\n')
logs = v
odl = parse_odl(logs[0], key)
log_output = f'{key}_logs.csv'
if not args.csv:
args.csv = '.'
log_output = f'{args.csv}/{key}_logs.csv'
odl.to_csv(log_output, index=False)

sys.exit()
Expand Down
279 changes: 229 additions & 50 deletions OneDriveExplorer/OneDriveExplorer_GUI.py

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion OneDriveExplorer/ode/helpers/schema
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cstruct = {
}
}

# menu_data schema version 1.4
# menu_data schema version 2.1
menu_data = {
'theme': {
'required': True,
Expand Down Expand Up @@ -82,6 +82,10 @@ menu_data = {
'odl': {
'required': True,
'type': 'boolean'
},
'odl_cor': {
'required': True,
'type': 'boolean'
},
'odl_save': {
'required': True,
Expand All @@ -91,5 +95,21 @@ menu_data = {
'required': True,
'nullable': True,
'type': 'string'
},
'create': {
'required': True,
'type': 'boolean'
},
'access': {
'required': True,
'type': 'boolean'
},
'modify': {
'required': True,
'type': 'boolean'
},
'size': {
'required': True,
'type': 'boolean'
}
}
33 changes: 30 additions & 3 deletions OneDriveExplorer/ode/parsers/csv_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def parse_csv(filename):
'folderStatus': 'Int64',
'Path': 'object',
'shortcutVolumeID': 'Int64',
'shortcutItemIndex': 'Int64'
'shortcutItemIndex': 'Int64',
'hydrationCount': 'Int64'
}

try:
Expand All @@ -79,6 +80,10 @@ def parse_csv(filename):
'shortcutVolumeID', 'shortcutItemIndex', 'libraryType']]
columns_to_fill = df_scope.columns.difference(['libraryType'])
df_scope[columns_to_fill] = df_scope[columns_to_fill].fillna('')

if 'remotePath' in df_scope:
df_scope.remotePath.fillna('', inplace=True)

scopeID = df_scope['scopeID'].tolist()

if 'inRecycleBin' in df.columns:
Expand Down Expand Up @@ -107,9 +112,31 @@ def parse_csv(filename):
df_GraphMetadata_Records[json_columns] = df_GraphMetadata_Records[json_columns].map(lambda x: ast.literal_eval(x) if pd.notna(x) and x.strip() else '')
df_GraphMetadata_Records['lastWriteCount'] = df_GraphMetadata_Records['lastWriteCount'].astype('Int64')

df = df.astype(object)
df = df.where(pd.notna(df), None)
if 'fileExtension' in df_GraphMetadata_Records:
df_GraphMetadata_Records.fileExtension.fillna('', inplace=True)

df.drop(columns=columns_to_drop_2, inplace=True)
df.localHashDigest.fillna('', inplace=True)
if 'notificationTime' in df:
df.HydrationTime.fillna('', inplace=True)

if 'firstHydrationTime' in df:
df.lastHydrationType.fillna('', inplace=True)
df.firstHydrationTime.fillna('', inplace=True)
df.lastHydrationTime.fillna('', inplace=True)

if 'diskLastAccessTime' in df:
df.diskLastAccessTime.fillna('', inplace=True)

if 'diskCreationTime' in df:
df.diskCreationTime.fillna('', inplace=True)

if 'lastKnownPinState' in df:
df.lastKnownPinState = df.lastKnownPinState.apply(lambda x: '' if pd.isna(x) else int(x))

if 'remotePath' in df:
df.remotePath.fillna('', inplace=True)

except Exception as e:
print(e)
log.error(f'Not a valid csv. {csv_name}')
Expand Down
9 changes: 4 additions & 5 deletions OneDriveExplorer/ode/parsers/dat.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ def parse_dat(self, usercid, account='Business', gui=False, pb=False, value_labe
block = self.datstruct.DAT_FOLDER_v29_v2c(f.read(chunk))
else:
block = self.datstruct.DAT_FOLDER_v2d_v36(f.read(chunk))
block._values.update([('sharedItem', '')])
print(dict(block._values))

elif ff == '09':
data_type = 'Scope'
Expand Down Expand Up @@ -441,10 +439,10 @@ def parse_dat(self, usercid, account='Business', gui=False, pb=False, value_labe
csvwriter = csv.writer(temp_files, escapechar='\\')
if version <= '2b':
self.merge_dicts(block._values, self.dict_1)
if version >= '2c' and version <= '34':
elif version >= '2c' and version <= '34':
self.merge_dicts(block._values, self.dict_2)
block._values['sharedItem'] = [*block.bitMask][29]
if version >= '35':
elif version >= '35':
self.merge_dicts(block._values, self.dict_3)
block._values['sharedItem'] = [*block.bitMask][29]
if not self.files_header:
Expand All @@ -453,6 +451,7 @@ def parse_dat(self, usercid, account='Business', gui=False, pb=False, value_labe

if data_type == 'Folder':
csvwriter = csv.writer(temp_folders, escapechar='\\')
block._values['sharedItem'] = [*block.bitMask][29]
if not self.folders_header:
csvwriter.writerow(dict(block._values))
self.folders_header = True
Expand All @@ -473,7 +472,7 @@ def parse_dat(self, usercid, account='Business', gui=False, pb=False, value_labe

except Exception as e:
# log.error(e)
return pd.DataFrame(), pd.DataFrame(), pd.DataFrame(), []
return pd.DataFrame(), pd.DataFrame(), pd.DataFrame(), [], 0

if not gui:
print('\n')
Expand Down
30 changes: 17 additions & 13 deletions OneDriveExplorer/ode/parsers/onedrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def find_parent(self, x, id_name_dict, parent_dict):
# Generate scopeID list instead of passing
def parse_onedrive(self, df, df_scope, df_GraphMetadata_Records, scopeID, file_path, rbin_df, account=False, reghive=False, recbin=False, localHashAlgorithm=False, gui=False, pb=False, value_label=False):

allowed_keys = ['scopeID', 'siteID', 'webID', 'listID', 'tenantID', 'webURL', 'remotePath', 'MountPoint', 'spoPermissions', 'shortcutVolumeID', 'shortcutItemIndex']

df_scope['shortcutVolumeID'] = df_scope['shortcutVolumeID'].apply(lambda x: '{:08x}'.format(x) if pd.notna(x) else '')
df_scope['shortcutVolumeID'] = df_scope['shortcutVolumeID'].apply(lambda x: '{}{}{}{}-{}{}{}{}'.format(*x.upper()) if x else '')

Expand Down Expand Up @@ -184,7 +186,6 @@ def parse_onedrive(self, df, df_scope, df_GraphMetadata_Records, scopeID, file_p
df['volumeID'] = df['volumeID'].apply(lambda x: '{}{}{}{}-{}{}{}{}'.format(*x.upper()) if x else '')
df['shortcutVolumeID'] = df['shortcutVolumeID'].apply(lambda x: '{:08x}'.format(x) if pd.notna(x) else '')
df['shortcutVolumeID'] = df['shortcutVolumeID'].apply(lambda x: '{}{}{}{}-{}{}{}{}'.format(*x.upper()) if x else '')


cache = {}
final = []
Expand All @@ -195,21 +196,26 @@ def parse_onedrive(self, df, df_scope, df_GraphMetadata_Records, scopeID, file_p
df_GraphMetadata_Records.set_index('resourceID', inplace=True)

column_len = len(df.columns)

for row in df.sort_values(
by=['Level', 'parentResourceID', 'Type', 'FileSort', 'FolderSort', 'libraryType'],
ascending=[False, False, False, True, False, False]).to_dict('records'):
if row['Type'] == 'File':
try:
if column_len == 32:
file = {key: row[key] for key in ('parentResourceID', 'resourceID', 'eTag', 'Path', 'Name', 'fileStatus', 'spoPermissions', 'volumeID', 'itemIndex', 'lastChange', 'size', 'localHashDigest', 'sharedItem', 'Media')}

if column_len == 33:
file = {key: row[key] for key in ('parentResourceID', 'resourceID', 'eTag', 'Path', 'Name', 'fileStatus', 'spoPermissions', 'volumeID', 'itemIndex', 'lastChange', 'HydrationTime', 'size', 'localHashDigest', 'sharedItem', 'Media')}

if column_len == 36:
if column_len == 39:
file = {key: row[key] for key in ('parentResourceID', 'resourceID', 'eTag', 'Path', 'Name', 'fileStatus', 'lastHydrationType', 'lastKnownPinState','spoPermissions', 'volumeID', 'itemIndex', 'diskLastAccessTime', 'diskCreationTime', 'lastChange', 'firstHydrationTime', 'lastHydrationTime', 'hydrationCount', 'size', 'localHashDigest', 'sharedItem', 'Media')}
if column_len == 37:
file = {key: row[key] for key in ('parentResourceID', 'resourceID', 'eTag', 'Path', 'Name', 'fileStatus', 'lastHydrationType', 'spoPermissions', 'volumeID', 'itemIndex', 'diskLastAccessTime','lastChange', 'firstHydrationTime', 'lastHydrationTime', 'hydrationCount', 'size', 'localHashDigest', 'sharedItem', 'Media')}

elif column_len == 36:
file = {key: row[key] for key in ('parentResourceID', 'resourceID', 'eTag', 'Path', 'Name', 'fileStatus', 'lastHydrationType', 'spoPermissions', 'volumeID', 'itemIndex', 'lastChange', 'firstHydrationTime', 'lastHydrationTime', 'hydrationCount', 'size', 'localHashDigest', 'sharedItem', 'Media')}

elif column_len == 33:
file = {key: row[key] for key in ('parentResourceID', 'resourceID', 'eTag', 'Path', 'Name', 'fileStatus', 'spoPermissions', 'volumeID', 'itemIndex', 'lastChange', 'HydrationTime', 'size', 'localHashDigest', 'sharedItem', 'Media')}

elif column_len == 32:
file = {key: row[key] for key in ('parentResourceID', 'resourceID', 'eTag', 'Path', 'Name', 'fileStatus', 'spoPermissions', 'volumeID', 'itemIndex', 'lastChange', 'size', 'localHashDigest', 'sharedItem', 'Media')}

except Exception as e:
if gui:
log.error(f'Unable to read dataframe. Something went wrong. {e}')
Expand All @@ -234,8 +240,7 @@ def parse_onedrive(self, df, df_scope, df_GraphMetadata_Records, scopeID, file_p
if 'Scope' in row['Type']:
if row['scopeID'] not in scopeID:
continue
scope = {key: row[key] for key in (
'scopeID', 'siteID', 'webID', 'listID', 'tenantID', 'webURL', 'remotePath', 'MountPoint', 'spoPermissions', 'shortcutVolumeID', 'shortcutItemIndex')}
scope = {key: row[key] for key in row if key in allowed_keys}
folder = cache.get(row['scopeID'], {})
temp = {**scope, **folder}
final.insert(0, temp)
Expand All @@ -246,8 +251,7 @@ def parse_onedrive(self, df, df_scope, df_GraphMetadata_Records, scopeID, file_p
if row['resourceID'] in scopeID:
scopeID.remove(row['resourceID'])
for s in df_scope.loc[df_scope['scopeID'] == row['resourceID']].to_dict('records'):
scope = {key: s[key] for key in (
'scopeID', 'siteID', 'webID', 'listID', 'tenantID', 'webURL', 'remotePath')}
scope = {key: s[key] for key in s if key in allowed_keys}
scope['MountPoint'] = row['MountPoint']
scope['spoPermissions'] = s['spoPermissions']
scope['shortcutVolumeID'] = s['shortcutVolumeID']
Expand Down
Loading

0 comments on commit 7cfddd2

Please sign in to comment.