export.py 文件源码

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

项目:SniffAir 作者: Tylous 项目源码 文件源码
def main(workspace, path, name):
    table_name = ['accessPoints', 'ProbeRequests', 'ProbeRequests', 'EAP', 'Hidden_SSID', 'inscope_accessPoints', 'inscope_ProbeRequests', 'inscope_ProbeResponses']
    sheet_name = ['AccessPoints', 'ProbeRequests', 'ProbeRequests', 'EAP', 'Hidden_SSID', 'Inscope_AccessPoints', 'Inscope_ProbeRequests', 'Inscope_ProbeResponses']
    ws = workspace
    q = queries()
    ws1 = q.db_connect(ws)
    writer = dp.ExcelWriter(path+name+'.xlsx', engine='xlsxwriter')
    j = 0
    print "Exporting: "+path+name+'.xlsx'
    for tbn in table_name:
        try:
            td = dp.read_sql('select * from '+tbn+'', ws1)
            if td.empty:
                pass
                j +=1
                print colors.RD + "[-]" + colors.NRM + " Skipping: " + sheet_name[j] + ". No Data in table."
            else:
                td.to_excel(writer, sheet_name=''+sheet_name[j]+'', index=False)
                j +=1
                print colors.GRN + "[+]" + colors.NRM + " Exporting: " + sheet_name[j] + "."
        except ValueError:
            continue
        except pandas.io.sql.DatabaseError:
            continue
    writer.save()
    print "Export Completed"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号