0

I have to write a Python3 program which counts every process on a virtual machine that's using seccomp. It should use the proc filesystem to identify these processes but I don't know how to do it. In general I would go through every folder in this filesystem, open the file and search for the string 'seccomp'. If it occurs, I would increment a counter. That's just theoretical because I don't know how to implement it. That's one attempt that lists every process and add it to a list but it doesn't get access to the processes

#!/usr/bin/env python3

import os

os.system("pip install psutil")
import psutil

processes = []
for proc in psutil.process_iter():
    processName = proc.name()
    processes.append(processName)
    
for i in range(len(processes)-1):
    print(processes.count("seccomp")
bfg
  • 13
  • 5

1 Answers1

1

Task 4 :),

So my idea was to look into the /proc/[pid]/status file. In there is a flag if seccomp is active or not.

https://man7.org/linux/man-pages/man5/proc.5.html under /proc/[pid]/status you can read about this

JoWohln
  • 21
  • 2