"Reid, Rowan (GSP)"
I'm am in the process of writing my own firewall script.
Yes, I went through this as well, as I ought to divide a single C class into many firewalled segments, which is tougher than using one network per segment. Strange decision from the administration, but I had to live with it. Another need was to be able to quickly adjust the firewall when the topology of the network changes, and even moving it between machines.
the only problem is I need a way to extract the inet address assigned my my dialup isp. i'm not an avid script writer. is there an easy way to do this. I am pretty good in perl and can manipulate that to some usable variabe. whats the easiest way to do this ?
I kludged the following in Python. Maybe you could adapt it for Perl? Best would be to drop Perl! :-) It was a fairly difficult move for me, because I had a lot of Perl scripts in operation. I am much happier now, and will not return to Perl without a very serious reason... Of course, if someone has an improvement to suggest to my little code so it becomes neater, by all means, speak up! :-) IFCONFIG = '/sbin/ifconfig' def ethernet_address(interface): """\ Return self Ethernet address on INTERFACE, or None. """ return ifconfig_addresses(interface)[1] def internet_address(interface): """\ Return self Internet address on INTERFACE, or None. """ return ifconfig_addresses(interface)[0] def ifconfig_addresses(wanted_interface, cache = {}): import os, string if not cache: interface = internet = ethernet = None for line in os.popen('%s 2>/dev/null' % IFCONFIG).readlines(): if line[0] == '\n': if interface: cache[interface] = internet, ethernet interface = internet = ethernet = None elif interface and line[0] == ' ': fields = string.split(line) if fields[0] == 'inet' and fields[1][:5] == 'addr:': internet = fields[1][5:] else: fields = string.split(line) interface = fields[0] if len(fields) > 2 and fields[-2] == 'HWaddr': ethernet = fields[-1] if cache.has_key(wanted_interface): return cache[wanted_interface] return None, None -- François Pinard http://www.iro.umontreal.ca/~pinard -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/