I want to display whether firewall is present or not.. if it is not enabled, the user should get an alert.. can it be done using python code?
In GNU/linux the firewall (netfilter) is part of the kernel, so I think that if linux is on, the firewall is too.
next, you may ask netfilter if it is configured, and if is there any rules. for this you might parse iptables command (such as iptables -L) output.
Determining presence of firewall using python on linux