def export_all(format, path, datas): """ 将所有结果数据导出到一个文件 :param str format: 导出文件格式 :param str path: 导出文件路径 :param list datas: 待导出的结果数据 """ format = check_format(format, len(datas)) timestamp = get_timestamp() name = f'all_subdomain_result_{timestamp}' path = check_path(path, name, format) logger.log('INFOR', f'所有主域的子域结果 {path}') row_list = list() for row in datas: row.pop('header') row.pop('response') row.pop('module') row.pop('source') row.pop('elapsed') row.pop('count') keys = row.keys() values = row.values() if format in {'xls', 'xlsx'}: values = check_value(values) row_list.append(Record(keys, values)) rows = RecordCollection(iter(row_list)) content = rows.export(format) save_data(path, content)
def export_all_results(path, name, format, datas): path = check_path(path, name, format) logger.log('ALERT', f'The subdomain result for all main domains: {path}') row_list = list() for row in datas: if 'header' in row: row.pop('header') if 'response' in row: row.pop('response') keys = row.keys() values = row.values() if format in {'xls', 'xlsx'}: values = check_value(values) row_list.append(Record(keys, values)) rows = RecordCollection(iter(row_list)) content = rows.export(format) save_data(path, content)
def export_all(format, datas): format = check_format(format, len(datas)) dpath = check_dpath() timestamp = get_timestamp() fpath = dpath.joinpath(f'all_subdomain_{timestamp}.{format}') row_list = list() for row in datas: row.pop('header') row.pop('response') row.pop('module') row.pop('source') row.pop('elapsed') row.pop('count') keys = row.keys() values = row.values() if format in {'xls', 'xlsx'}: values = check_value(values) row_list.append(Record(keys, values)) rows = RecordCollection(iter(row_list)) content = rows.export(format) save_data(fpath, content)