library for reading ftrace data
Project description
Python ftrace Library
ftrace is a python library to read ftrace data from the Linux Kernel.
At this time it is only compatible with Kernel Version <=4!
Installation
pip install ftrace
Example
When a new process is created the name, pid and parent pid will be printed.
import ftrace
def main():
processes = {}
ftrace = ftrace.FTrace()
ftrace.tracer = ftrace.tracers.NopTracer()
ftrace.reset()
ftrace.setup()
ftrace.tracer.syscalls = [
ftrace.syscalls.Sys_Execve(),
ftrace.syscalls.Sched_Process_Fork()
]
print("pid ppid: name")
try:
for data in ftrace.get_output():
if (data is not None and data["kname"] == "sys_execve_kprobe"):
print("{} {}: {}".format(data["caller_pid"], processes[data["caller_pid"]] if (data["caller_pid"] in processes) else "----", data["filename"]))
elif (data["kname"] == "sched_process_fork"):
processes[data["called_pid"]] = data["caller_pid"]
except KeyboardInterrupt:
print("\nstopping...")
ftrace.reset()
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ftrace-0.0.1.tar.gz
(12.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ftrace-0.0.1-py3-none-any.whl
(17.4 kB
view details)
File details
Details for the file ftrace-0.0.1.tar.gz.
File metadata
- Download URL: ftrace-0.0.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
246875c6474bd49f4248b324b81821e7033d4cebcda1bee1a20115ceb332799b
|
|
| MD5 |
45ac6eacecc9020a3808fb89c10b06ca
|
|
| BLAKE2b-256 |
37ad963cd50e44f5da3f663d45f65b441c1038362ab03bd625816a66f6b5e85b
|
File details
Details for the file ftrace-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ftrace-0.0.1-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9527c05ed85b899b8483d11dcd04131972304007bd2d8f7b59507303e88214f0
|
|
| MD5 |
6369360f9905bd5975077bace1610d2a
|
|
| BLAKE2b-256 |
b90cb784c2430652efa6347694f60297dfa08cc024fa27395fccb2f99074186e
|