Is it possible to write every line, I receive from this script, into a mysql table ? I want to have 2 columns: The ip-adress I need for the command (ipAdresse) and a part of the output of the command itself (I want to split some content of the output).. I do not want to ask for any code but I just want to know whether it's even possible to keep this code as it is and add some stuff to it or I have to rewrite it to get the results I want :) Now I just write the output of the command into a text file.
#!/usr/bin/python import subprocess import commands
import subprocess
ipAdresse_4 = 0
datei = open("pointerRecord.txt", "w")
while (ipAdresse_4 < 255):
ipAdresse_4 = ipAdresse_4 + 1
ipAdresse = '82.198.205.%d' % (ipAdresse_4,)
subprocess.Popen("host %s" % ipAdresse, stdout=datei, shell=True)