<s> from xlwt import Workbook , easyxf <EOL> def output ( csv_data , excel_file , environment ) : <EOL> print "<STR_LIT>" , excel_file , "<STR_LIT:!>" <EOL> book = Workbook ( ) <EOL> sheet = book . add_sheet ( "<STR_LIT>" , cell_overwrite_ok = True ) <EOL> sheet . set_panes_frozen ( True ) <EOL> sheet . set_horz_split_pos ( <NUM_LIT:1> ) <EOL> sheet . set_vert_split_pos ( <NUM_LIT:2> ) <EOL> sheet . set_remove_splits ( True ) <EOL> default_style = easyxf ( "<STR_LIT>" ) <EOL> header_style = easyxf ( "<STR_LIT>" ) <EOL> header = sheet . row ( <NUM_LIT:0> ) <EOL> header . write ( <NUM_LIT:0> , "<STR_LIT>" , header_style ) <EOL> header . write ( <NUM_LIT:1> , "<STR_LIT>" , header_style ) <EOL> vuln_names = map ( lambda x : csv_data . id_to_name [ x ] , csv_data . vuln_to_hosts . keys ( ) ) <EOL> vuln_hosts = csv_data . vuln_to_hosts . values ( ) <EOL> for i in range ( len ( vuln_names ) ) : <EOL> header . write ( i + <NUM_LIT:2> , vuln_names [ i ] , header_style ) <EOL> header . height = <NUM_LIT> <EOL> row_count = <NUM_LIT:1> <EOL> col_count = <NUM_LIT:2> <EOL> sheet . col ( <NUM_LIT:0> ) . width = <NUM_LIT> <EOL> sheet . col ( <NUM_LIT:1> ) . width = <NUM_LIT> <EOL> sheet . col ( <NUM_LIT:2> ) . width = <NUM_LIT> <EOL> for vuln in vuln_names : <EOL> sheet . col ( col_count ) . width = <NUM_LIT> * ( len ( str ( vuln ) ) + <NUM_LIT:2> ) <EOL> col_count += <NUM_LIT:1> <EOL> for host in csv_data . host_to_vulns . keys ( ) : <EOL> row = sheet . row ( row_count ) <EOL> row . write ( <NUM_LIT:0> , host , default_style ) <EOL> row . write ( <NUM_LIT:1> , csv_data . host_to_ip [ host ] , default_style ) <EOL> for i in range ( len ( vuln_names ) ) : <EOL> if host in vuln_hosts [ i ] : <EOL> row . write ( i + <NUM_LIT:2> , "<STR_LIT:U+0020>" , easyxf ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> row . height = <NUM_LIT> <EOL> row_count += <NUM_LIT:1> <EOL> book . save ( excel_file ) </s>
