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
epomuceno wrote: 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, le

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 >

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

2013-05-23 Thread JackM
First, let me say that I have no knowledge of or experience with Python or Linux/Unix. I have a script which was written by a host tech person that ran via cron on my old server. It was designed to read IP addresses from a text file and add them to be blocked on iptables. That way, we could add