Found a tool on GitHub - https://github.com/pryorda/sonicwallRuleParser
It did not work correctly with Python3.
PS C:\support\fw> python.exe .\parser2.py .\sonicwall-NSA_2600.expFile ".\parser2.py", line 454print ""
^
I found the 2to3.exe tool in the Python tools directory.
C:\Users\"user-name"\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts
Made a copy of the file
.\copy C:\temp\parser2.py C:\temp\parser2-3.py
Ran the tool
.\2to3.exe C:\temp\parser2-3.py -w
After converting with 2to3.exe tool still received a error
python.exe .\parser2-3.py .\sonicwall-NSA_2600.expTraceback (most recent call last):File ".\parser2-3.py", line 14, in <module>decoded_data = decoded_data.split("&")TypeError: a bytes-like object is required, not 'str'
A little research found we needed to convert the byte-like object to string
decoded_data = decoded_data.decode(encoding="utf-8") # Python 3
After the update the parser worked without issue.
python.exe .\parser3.py .\sonicwall-NSA_2600.exp >test.txt
I posted the updated files on GitHub
No comments:
Post a Comment