hello
i want to knw the ipaddress of my computer.
/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
this command gives the ipaddress of my computer and print result on console but i want it in a varible sothat i can use it in my C program. How can i do that.
I am developing a firewall for Linux as my project. I am able to capture packets and to block them. I am using IPTABLES.
How can I use variables with sprintf instead of hardcoded values?
sprintf(comm, "iptables -A INPUT -s $str -j DROP")
// inplace of:
sprintf(comm, "iptables -A INPUT -s 192.168.0.43 -j DROP")