xlsx.py 文件源码

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

项目:recon-ng 作者: Hehe-Zhc 项目源码 文件源码
def module_run(self):
        filename = self.options['filename']
        # create an new xlsx file
        with xlsxwriter.Workbook(filename, {'strings_to_urls': False}) as workbook:
            tables = self.get_tables()
            # loop through all tables in the database
            for table in tables:
                # create a worksheet for the table
                worksheet = workbook.add_worksheet(table)
                # build the data set
                rows = [tuple([x[0] for x in self.get_columns(table)])]
                rows.extend(self.query('SELECT * FROM "%s"' % (table)))
                # write the rows of data to the xlsx file
                for r in range(0, len(rows)):
                    for c in range(0, len(rows[r])):
                        worksheet.write(r, c, rows[r][c])
        self.output('All data written to \'%s\'.' % (filename))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号