functions.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:rawr 作者: al14s 项目源码 文件源码
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)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号