def write_to_csv(timestamp, target):
try:
x = [" "] * len(flist.split(","))
for i, v in target.items():
if type(v) == list:
v = ' | '.join(v)
if i.lower() in flist.lower().split(', '): # matching up the columns with our values
x[flist.lower().split(", ").index(i.lower())] = re.sub('[\n\r,]', '', safe_string(v).replace('"', '"'))
except Exception, ex:
output.put("\n %s[!]%s Unable to parse host record:\n\t%s\n" % (TC.YELLOW, TC.END, str(ex)))
try:
if not os.path.isfile("3_Enumeration/rawr_%s_serverinfo.csv" % timestamp):
try: os.mkdirs("3_Enumeration")
except: pass
open("3_Enumeration/rawr_%s_serverinfo.csv" % timestamp, 'w').write(flist)
open("3_Enumeration/rawr_%s_serverinfo.csv" % timestamp, 'a').write('\n"%s"' % (str('","'.join(x))))
except Exception, ex:
output.put("\n %s[!]%s Unable to write .csv:\n\t%s\n" % (TC.YELLOW, TC.END, str(ex)))
评论列表
文章目录