Crash report

Refactored the crash report into a class, removed duplicated code and added test cases. I do tested it in a pfsense image.