Skip to content

Generating process tree using alternative data source #446

@ianhelle

Description

@ianhelle

Discussed in #439

Originally posted by blueteam0ps June 11, 2022
Hi there,
I got a quick question regarding creating a process tree based on an alternative data source. I understand that this will require me to copy an existing schema and make one for my source data set.

Following is the dataframe which I would like to create a process tree of.
Notebook

I referred to this https://github.com/microsoft/msticpy/blob/c66a03fdd376c86b3ce3af266a91c6cf53c0d3fd/docs/source/visualization/ProcessTree.rst#adapting-the-input-schema-of-your-data to create the following.

Do you think this is the correct way to achieve what I need ?

    from msticpy.sectools.proc_tree_builder import WIN_EVENT_SCH
    from copy import copy
    dfprocs_renamed = dfprocs.rename(columns={'PID': 'process_id', 'PPID': 'parent_id', 'ImageFileName': 'process_name', 'CreateTime': 'time_stamp',  'PPIDName': 'parent_name'})
    procs_rmcolumns = ['TreeDepth', 'Offset(V)','Threads','Handles','SessionId','Wow64','ExitTime']
    dfprocs_renamed.drop(procs_rmcolumns, inplace=True, axis=1)  
    cust_win_schema = copy(WIN_EVENT_SCH)
    cust_win_schema.time_stamp = "time_stamp"
    cust_win_schema.process_name = "process_name"
    cust_win_schema.process_id = "process_id"
    cust_win_schema.parent_name = "parent_name"
    cust_win_schema.parent_id = "parent_id"
    cust_win_schema.logon_id = None
    cust_win_schema.cmd_line = None
    cust_win_schema.user_name = None
    cust_win_schema.path_separator = None
    cust_win_schema.host_name_column = None
    cust_win_schema.event_id_column = None
    cust_win_schema.event_id_identifier = None
    process_tree.plot_process_tree(dfprocs_renamed, schema=cust_win_schema)

Metadata

Metadata

Assignees

Labels

acceptedThe request/issue is accepted for a fixenhancementNew feature or request

Type

No type

Projects

Status

✅ Done

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions