While executing below code in a console:
int ret = system("iptables -t filter -L"); ret will get value 1 and there will be a list of rules displayed in the console. The problem is that I also want to get the list of rules inside my program. I am doing this with the below solution:
int ret = system("iptables -t filter -L >> filter-table.txt"); /* read filter-table.txt file to get the list */ Is there anyway else to get the list?
system()?system()is primarily useful for writing shell scripts in languages other than the shell and proof-of-concept security exploits.