0

I've network sniffer process which runs indefinitely capturing the live traffic and doing some other analysis as well. I want a variable which can turn on and off this analysis at the run-time which I should be able to change from outside the program (from a separate terminal).

sysctl is kind of the best way to do it, but the sysctl package for python is returning gcc error while installing. I don't want to do a complex coding with ctype as my program is already large and complex. Just like in a terminal I give the sysctl command and see the value of a parameter, I want to do that in python too.

One option I do have is make a subprocess.call() with the sysctl variable as parameter and process the stdout. But I'm concerned with the performance impact of this command being called again and again.

But is there any other better approach to achieve this?

RatDon
  • 3,403
  • 8
  • 43
  • 85
  • Sysctl is for kernel configuration, not configuring userspace progams. – jordanm Jan 06 '17 at 05:13
  • If I define a sysctl variable and never use it in kernel, it'd be same as an unused variable in C. But that same sysctl I can use through out. And I find it easy to handle a sysctl variable than an environment variable. Please correct me if I'm wrong. And I asked for an alternative too. – RatDon Jan 06 '17 at 05:19

0 Answers0