Shahar Lahav Shahar Lahav - 1 year ago 92
Linux Question

Python process contest with root privileges

So, I am participating in this python process competition where every candidate writes a script that should "kill" the others.
The winner is the one that the last message in

dmesg
(the kernel ring buffer) contains his name.
We will run all with root privileges.
There are no actual rules, in fact you can reboot the system and so on.
All the processes will be running at the same time on a Linux machine.
I'll appreciate some advises and ideas, Thanks !!

Answer Source

It appears you would like to write a python script that can

  1. Catch signals
  2. Write to the kernel ring buffer.

    1. Can be handled with the signal module.
    2. Can be handled with a C program to call the printk() function and a python function to call that C program. Another alternative may be to use /dev/kmsg.

If you get these pieces working, try writing to the kernel ring buffer when you catch signal(s).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download