Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions App/ProcessMonitor/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ BOOL prettyPrint = NO;

//'parseEnv' flag to capture environment variable information
BOOL parseEnv = NO;

//'hideForks' flag
BOOL hideForks = NO;

//'hideExecs' flag
BOOL hideExecs = NO;

//'hideExits' flag
BOOL hideExits = NO;

/* FUNCTIONS */

Expand Down
33 changes: 31 additions & 2 deletions App/ProcessMonitor/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ BOOL processArgs(NSArray* arguments)

//init 'parseEnv' flag
parseEnv = [arguments containsObject:@"-parseEnv"];

//init 'hideForks' flag
hideForks = [arguments containsObject:@"-hideForks"];

//init 'hideExecs' flag
hideExecs = [arguments containsObject:@"-hideExecs"];

//init 'hideExits' flag
hideExits = [arguments containsObject:@"-hideExits"];

//extract value for 'filterBy'
index = [arguments indexOfObject:@"-filter"];
Expand Down Expand Up @@ -138,8 +147,11 @@ void usage()
printf(" -pretty JSON output is 'pretty-printed'\n");
printf(" -skipApple ignore Apple (platform) processes \n");
printf(" -parseEnv parse environment variable information\n");
printf(" -filter <name> show events matching process name\n\n");

printf(" -filter <name> show events matching process name\n");
printf(" -hideForks don't show process fork events\n");
printf(" -hideExecs don't show process exec events\n");
printf(" -hideExits don't show process exit events\n\n");

return;
}

Expand Down Expand Up @@ -167,6 +179,23 @@ BOOL monitor()
//ignore
return;
}

switch (process.event) {
case ES_EVENT_TYPE_NOTIFY_FORK:
if(hideForks)
return;
break;
case ES_EVENT_TYPE_NOTIFY_EXEC:
if(hideExecs)
return;
break;
case ES_EVENT_TYPE_NOTIFY_EXIT:
if (hideExits)
return;
break;
default:
break;
}

//filter
// and no match? skip
Expand Down