Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread Dave Angel
On 05/24/2013 12:32 PM, JackM wrote: So Chris, does this version look better? Changed to inFile to with. #!/usr/bin/python import os import time # Input, Output, and TimeStamp logFile = open('/var/www/html/statistics/logs/banList.log','w') stamp = time.asctime(time.localtime()) # Daily Flush

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 2:32 AM, JackM wrote: > So Chris, does this version look better? Changed to inFile to with. > Heh, I didn't know you knew about with :) Since you know how to use it, you probably also know why it's useful. Anyway, the main thing is to see the exact command that's being exe

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread JackM
So Chris, does this version look better? Changed to inFile to with. #!/usr/bin/python import os import time # Input, Output, and TimeStamp logFile = open('/var/www/html/statistics/logs/banList.log','w') stamp = time.asctime(time.localtime()) # Daily Flush of blockList rules before re-applying

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread Chris Angelico
On Fri, May 24, 2013 at 12:44 PM, JackM wrote: > outPut = os.popen( '/sbin/iptables -A INPUT -s' + ' ' + IP + ' ' + > '-j REJECT' ) There's so much about this script that's less than Pythonic, but the one thing I'd really like to see is a log of the exact command being executed. Replace t

RE: Read txt file, add to iptables not working on new host

2013-05-24 Thread Carlos Nepomuceno
tables' have changed. > From: notr...@earthlink.net > Subject: Re: Read txt file, add to iptables not working on new host > Date: Fri, 24 May 2013 09:08:26 -0400 > To: python-list@python.org > > Thanks for answering. Do you mean

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread JackM
Thanks for answering. Do you mean something like this? outPut = os.popen('uname -a' '/sbin/iptables -V INPUT -s' + ' ' + IP + ' ' + '-j REJECT' ) Sorry but like I said, I have no experience with any of this. On 5/23/2013 11:10 PM, Carlos Nepomuceno wrote: Send the output of the following

RE: Read txt file, add to iptables not working on new host

2013-05-23 Thread Carlos Nepomuceno
Send the output of the following commands: uname -a /sbin/iptables -V > From: notr...@earthlink.net > Subject: Read txt file, add to iptables not working on new host > Date: Thu, 23 May 2013 22:44:38 -0400 > To: python-list@python.org > > First, let me sa