Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
cbb16114
Commit
cbb16114
authored
Apr 09, 2018
by
yonghong-song
Committed by
GitHub
Apr 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1672 from brtmr/master
Added -q option to execsnoop to quote individual arguments.
parents
18d3814c
059ff55d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
man/man8/execsnoop.8
man/man8/execsnoop.8
+8
-0
tools/execsnoop.py
tools/execsnoop.py
+9
-0
No files found.
man/man8/execsnoop.8
View file @
cbb16114
...
...
@@ -30,6 +30,10 @@ Include a timestamp column.
\-x
Include failed exec()s
.TP
\-q
Add "quotemarks" around arguments. Escape quotemarks in arguments with a
backslash. For tracing empty arguments or arguments that contain whitespace.
.TP
\-n NAME
Only print command lines matching this name (regex)
.TP
...
...
@@ -52,6 +56,10 @@ Include failed exec()s:
#
.B execsnoop \-x
.TP
Put quotemarks around arguments.
#
.B execsnoop \-q
.TP
Only trace exec()s where the filename contains "mount":
#
.B execsnoop \-n mount
...
...
tools/execsnoop.py
View file @
cbb16114
...
...
@@ -31,6 +31,7 @@ examples = """examples:
./execsnoop # trace all exec() syscalls
./execsnoop -x # include failed exec()s
./execsnoop -t # include timestamps
./execsnoop -q # add "quotemarks" around arguments
./execsnoop -n main # only print command lines containing "main"
./execsnoop -l tpkg # only print command where arguments contains "tpkg"
"""
...
...
@@ -42,6 +43,9 @@ parser.add_argument("-t", "--timestamp", action="store_true",
help
=
"include timestamp on output"
)
parser
.
add_argument
(
"-x"
,
"--fails"
,
action
=
"store_true"
,
help
=
"include failed exec()s"
)
parser
.
add_argument
(
"-q"
,
"--quote"
,
action
=
"store_true"
,
help
=
"Add quotemarks (
\
"
) around arguments."
)
parser
.
add_argument
(
"-n"
,
"--name"
,
type
=
ArgString
,
help
=
"only print commands matching this name (regex), any arg"
)
...
...
@@ -195,6 +199,11 @@ def print_event(cpu, data, size):
if
args
.
line
and
not
re
.
search
(
bytes
(
args
.
line
),
b' '
.
join
(
argv
[
event
.
pid
])):
skip
=
True
if
args
.
quote
:
argv
[
event
.
pid
]
=
[
"
\
"
"
+
arg
.
replace
(
"
\
"
"
,
"
\
\
\
"
"
)
+
"
\
"
"
for
arg
in
argv
[
event
.
pid
]
]
if
not
skip
:
if
args
.
timestamp
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment