I'm working on a plugin that parses the console_mp.log for bad rcon's from unidentified ips (not on white list) and then issues an operating system level command to ban them quite permanently by ip. I've run into quite the snag though because we're on Win2k3 server. The command that I've been building my template on is
ip = '192.168.200.200'
o = sys.platform
listbancommand = (r'netsh ipsec dynamic show qmfilter all srcaddr = %s' % ip) // This is loaded from xml for flexibility
p = subprocess.Popen(listbancommand, stdout=subprocess.PIPE, close_fds=False, stderr=subprocess.PIPE, shell=(o), stdin=subprocess.PIPE)
text = p.stdout
for line in text print line:
output is
', mode 'rU' at 0x00.....
First off, I'm hating python 2.6 at the moment because popen2 was depreciated and subprocess.popen while it seems to do the same thing, isn't returning the results which I need. My first thought is to pipe the command to a temp.log file and then read and parse the output, do what I need to with it and then discard the file. It seems a redneck fix but for all intents and purposes, it should work, provided nothing gets out of line and tries to close the file before the parse is done and the file hangs, preventing new files from being created.
The results should be a listing of all services blocked for which the ip's can be re.compile'd out, not a byte level memory location

I'm not a programmer by trade but this should be a simple process according to most stories I've read. (looking into winprocess.py as well but that's a lot of overhead if I'm to share this plugin)
current version can be seen at
http://github.com/Rhidalin-Bytes/BadrconRhidalin Bytes
- py·thon - p?-?thän - any of various large constricting snakes however lacking opposable thumbs, are unable to open windows efficiently - ME