CheckPointSW/ExportImportPolicyPackage

problem in csv when in comment column several lines or special characters

Opened this issue · 2 comments

pepjm commented

Hi
problem in csv when in comment column several lines or special characters

  • For example
    • if several lines in comments of the rules the CSV is cutted in several lines
    • if several lines in description of the objects the CSV is cutted in several lines
  • check also with host having a space in name ( Checkpoint convert it to special characters ) could be potentiel a issue
    Thank you

Hi @pepjm ,
Could you please upload examples? Are you experiencing any failures due to this?
Regards,
Eden

pepjm commented

This happens in fields
object description
rules comments,
rules additionalfiled1, filed2, field3
Because you can insert several lines .
In the CSV the line is cut in the place of the ‘\n’ . Therefore the csv is cutted

I have done a quick and dirty hack to solve it replacing \n with something here ‘%0d’.
It could be that some other special characters or not UTF-8 conduct to other issues
In utils.py function write_data:
for oneline in res:
for col in oneline:
if '\n' in col:
col=col.replace('\n',' %0d ')

Example

RULE 1:
Accept,false,,any,false,Any,, POC,,false,true,Policy Targets,,5,false,,false,Any,,false,none,false,false,false,None,Any,export_error_CpmiVsClusterNetobj_b2fd6-cc1c-42ca-95f0-2e5df2_fw00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,snmp,snmp-trap,icmp-requests,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Example1 Server,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

RULE 2: cutted in the comment
Accept,false,"Ticket 000937
RFC 0087 (removal)
C0044",any,false,Any,,IM00018,,false,true,Policy Targets,,6,false,,false,Any,,false,none,false,true,false,Log,Any,export_error_checkpoint-host_569732-6860-11d8-8795-c0a0a0_fw02,fw01,export_error_CpmiVsClusterNetobj_b2fdc9d6-cc1c-42ca-95f0-2e5f46227df2_fvfwc7aslb00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FWmanagePorts,ssh,ftp_,https,icmp-requests,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,export_error_checkpoint-host_569dd732-6860-11d8-8795-c0a8c902a0a0_fw02,pcadmin,groupBackup,grouptele,export_error_CpmiVsClusterNetobj_b2fdc-cc1c-42ca-95f0-2e27df2_fw00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
RULE 3:
Accept,false,"needed ND …….. …. … … … … … …