Commit 72ca17d4 by lwilms

clean up

parent 810373d0
......@@ -34,7 +34,7 @@ def move_pdf_report(pdf_path):
shutil.move(str(pdf_path.absolute()), str(Path('/tmp', 'interface', 'pdf', pdf_path.name)))
def main(template_style):
def main(template_style='default'):
analysis, meta_data = get_data()
# if 'exploit_mitigations' in analysis:
# analysis['exploit_mitigations']['count'] = count_mitigations(analysis['exploit_mitigations']['summary'])
......@@ -48,7 +48,7 @@ def main(template_style):
if __name__ == '__main__':
exit(main('new_template'))
exit(main())
# TODO
# order of sections
\ No newline at end of file
......@@ -20,7 +20,7 @@ def execute_latex(tmp_dir):
def copy_fact_image(target):
shutil.copy(str(Path(__file__).parent / 'templates' / 'new_template' / LOGO_FILE), str(Path(target) / LOGO_FILE))
shutil.copy(str(Path(__file__).parent / 'templates' / LOGO_FILE), str(Path(target) / LOGO_FILE))
def render_analysis_templates(engine, analysis):
......@@ -44,12 +44,12 @@ def compile_pdf(meta_data, tmp_dir):
return target_path
def create_templates(analysis, meta_data, tmp_dir, template_style=None):
def create_templates(analysis, meta_data, tmp_dir, template_style='default'):
engine = TemplateEngine(template_folder=template_style, tmp_dir=tmp_dir)
Path(tmp_dir, MAIN_TEMPLATE).write_text(engine.render_main_template(analysis=analysis, meta_data=meta_data))
Path(tmp_dir, META_TEMPLATE).write_text(engine.render_meta_template(meta_data))
if template_style == 'new_template':
if template_style == 'default':
Path(tmp_dir, CUSTOM_TEMPLATE_CLASS).write_text(engine.render_template_class())
else:
for filename, rendered_template in render_analysis_templates(engine=engine, analysis=analysis):
......
\documentclass{article}
% % % % % % % %
% Twenty Seconds Resume/CV
% LaTeX Template
% Version 1.1 (8/1/17)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Carmine Spagnuolo (cspagnuolo@unisa.it) with major modifications by
% Vel (vel@LaTeXTemplates.com)
%
% License:
% The MIT License (see included LICENSE file)
%
% %
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{longtable}
\usepackage{sectsty}
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\allsectionsfont{\sffamily}
\documentclass[letterpaper, icon]{twentysecondcv}
\profilepic{fact.png}
\input{meta.tex}
\begin{document}
\begin{titlepage}
\aboutme{
\BLOCK{if 'crypto_material' in analysis}
\BLOCK{for selected_summary in analysis['crypto_material']['summary']}
\VAR{selected_summary | filter_chars} \\
\BLOCK{endfor}
\BLOCK{endif}
}
\skills{\VAR{ analysis | call_for_mitigations}}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\makeprofile
% ----------------------------------------------------------------------------------------------------------------------
% Binwalk & Entropy Graph
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'binwalk' in analysis}
%\section{Entropy Graph}
\center
\includegraphics[width = \textwidth]{\VAR{analysis['binwalk']['entropy_analysis_graph'] | base64_to_png('entropy_analysis_graph', tmp_dir)}}
\BLOCK{endif}
% ----------------------------------------------------------------------------------------------------------------------
% Software Components
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'software_components' in analysis}
\section{Software}
\includegraphics[width = 13cm]{fact_logo.png}\\[3cm]
\begin{twentyshort}
\BLOCK{for summary in analysis['software_components']['summary'] | sort | x_entires}
\twentyitemshort{\VAR{summary | split_space}}
\BLOCK{endfor}
\BLOCK{if analysis['software_components']['summary'] | elements_count > 10}
\twentyitemshort{}{and \VAR{analysis['software_components']['summary'] | elements_count - 10} others}
\BLOCK{endif}
\end{twentyshort}
\BLOCK{endif}\\
% ----------------------------------------------------------------------------------------------------------------------
% Known Vulnerabilities
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'known_vulnerabilities' in analysis}
\section{Known Vulnerabilities}
\HRule \\[0.4cm]
{\fontfamily{lmss}\selectfont
{\Large \bfseries Firmware Analysis of \VAR{meta_data['hid'] | filter_chars }}\\[0.4cm]
}
\HRule \\[1.5cm]
\begin{twentyshort}
\BLOCK{for known_vullies in analysis['known_vulnerabilities']['summary']}
\twentyitemshort{\VAR{known_vullies | filter_chars}}{}
\BLOCK{endfor}
\end{twentyshort}
\BLOCK{endif}\\
% ----------------------------------------------------------------------------------------------------------------------
% Top 5 File Types
% ----------------------------------------------------------------------------------------------------------------------
\section{Top five occuring file types}
\vspace{3.0cm}
\begin{twentyshort}
\BLOCK{for selected_summary in analysis['file_type']['summary'] | top_five}
\twentyitemshort{\VAR{analysis['file_type']['summary'][selected_summary] | elements_count}}{\VAR{selected_summary | filter_chars}}
\BLOCK{endfor}
\end{twentyshort}\\
% ----------------------------------------------------------------------------------------------------------------------
% IP & URI
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'ip_and_uri_finder' in analysis}
\section{IPs and URIs}
{\fontfamily{lmss}\selectfont
\input{meta.tex}
}
\begin{twentyshort}
\BLOCK{for selected_analysis in analysis['ip_and_uri_finder']['summary'] | triplet}
\twentyitemshort{\VAR{selected_analysis}}
\BLOCK{endfor}
\end{twentyshort}
\BLOCK{endif}
% ----------------------------------------------------------------------------------------------------------------------
% Executables
% ----------------------------------------------------------------------------------------------------------------------
\section{Executables}
\begin{twentyshort}
\BLOCK{for selected_summary in analysis['cpu_architecture']['summary']}
\twentyitemshort{\VAR{analysis['cpu_architecture']['summary'][selected_summary] | elements_count}}{\VAR{selected_summary | filter_chars}}
\BLOCK{endfor}
\end{twentyshort}\\
%----------------------------------------------------------------------------------------
% SECOND PAGE EXAMPLE
%----------------------------------------------------------------------------------------
%\newpage % Start a new page
%\makeprofile % Print the sidebar
% \section{Other information}
% \subsection{Review}
% Alice approaches Wonderland as an anthropologist, but maintains a strong sense of noblesse oblige that comes with her class status. She has confidence in her social position, education, and the Victorian virtue of good manners. Alice has a feeling of entitlement, particularly when comparing herself to Mabel, whom she declares has a ``poky little house," and no toys. Additionally, she flaunts her limited information base with anyone who will listen and becomes increasingly obsessed with the importance of good manners as she deals with the rude creatures of Wonderland. Alice maintains a superior attitude and behaves with solicitous indulgence toward those she believes are less privileged.
% \section{Other information}
% \subsection{Review}
\vfill
\end{titlepage}
% Alice approaches Wonderland as an anthropologist, but maintains a strong sense of noblesse oblige that comes with her class status. She has confidence in her social position, education, and the Victorian virtue of good manners. Alice has a feeling of entitlement, particularly when comparing herself to Mabel, whom she declares has a ``poky little house," and no toys. Additionally, she flaunts her limited information base with anyone who will listen and becomes increasingly obsessed with the importance of good manners as she deals with the rude creatures of Wonderland. Alice maintains a superior attitude and behaves with solicitous indulgence toward those she believes are less privileged.
\BLOCK{for current_analysis in analysis}
\input{\VAR{current_analysis}.tex}
\newpage
\BLOCK{endfor}
%----------------------------------------------------------------------------------------
\end{document}
\end{document}
\begin{tabular}{|p{3cm}|p{11.5cm}|}
\hline
HID & \VAR{meta_data['hid'] | filter_chars}\\
\hline
\cvname{\VAR{meta_data['device_name'] | filter_chars }} % Your name
\cvjobtitle{\VAR{meta_data['device_class'] | filter_chars }} % Job title/career
Device Name & \VAR{meta_data['device_name'] | filter_chars}\\
\hline
\cvdate{\VAR{meta_data['vendor'] | filter_chars }} % Date of birth
\cvaddress{\VAR{meta_data['size'] | number_format}} % Short address/location, use \newline if more than 1 line is required
\cvnumberphone{\VAR{meta_data['version'] | filter_chars}} % Phone number
\cvsite{\VAR{meta_data['release_date']}} % Personal website
\cvmail{} % Email address
Vendor & \VAR{meta_data['vendor'] | filter_chars}\\
\hline
Device Class & \VAR{meta_data['device_class'] | filter_chars}\\
\hline
Version & \VAR{meta_data['version'] | filter_chars}\\
\hline
Release Date & \VAR{meta_data['release_date']}\\
\hline
Size & \VAR{meta_data['size'] | number_format}\\
\hline
\end{tabular}
\ No newline at end of file
% to change the icons: line 142 in twentysecondcv.cls
% all icons possible from: https://github.com/spagnuolocarmine/TwentySecondsCurriculumVitae-LaTex/raw/master/fontawesome.pdf
\ No newline at end of file
\subsection*{\VAR{plugin_name | plugin_name | filter_chars} (v. \VAR{selected_analysis['plugin_version'] | filter_chars})}
{\fontfamily{lmss}\selectfont
\begin{longtable}{|p{3cm}|p{11.5cm}|}
\hline
Time of Analysis & \VAR{selected_analysis['analysis_date'] | nice_unix_time} \\
\hline
Plugin Version & \VAR{selected_analysis['plugin_version']} \\
\hline
\BLOCK{if selected_analysis['summary']}
Summary
\BLOCK{for selected_summary in selected_analysis['summary']}
& \VAR{selected_summary | filter_chars} \\
\BLOCK{endfor}
\hline
\BLOCK{endif}
\end{longtable}
}
\ No newline at end of file
% % % % % % % %
% Twenty Seconds Resume/CV
% LaTeX Template
% Version 1.1 (8/1/17)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Carmine Spagnuolo (cspagnuolo@unisa.it) with major modifications by
% Vel (vel@LaTeXTemplates.com)
%
% License:
% The MIT License (see included LICENSE file)
%
% %
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[letterpaper, icon]{twentysecondcv}
\profilepic{fact.png}
\input{meta.tex}
\begin{document}
\aboutme{
\BLOCK{if 'crypto_material' in analysis}
\BLOCK{for selected_summary in analysis['crypto_material']['summary']}
\VAR{selected_summary | filter_chars} \\
\BLOCK{endfor}
\BLOCK{endif}
}
\skills{\VAR{ analysis | call_for_mitigations}}
\makeprofile
% ----------------------------------------------------------------------------------------------------------------------
% Binwalk & Entropy Graph
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'binwalk' in analysis}
%\section{Entropy Graph}
\includegraphics[width = \textwidth]{\VAR{analysis['binwalk']['entropy_analysis_graph'] | base64_to_png('entropy_analysis_graph', tmp_dir)}}
\BLOCK{endif}
% ----------------------------------------------------------------------------------------------------------------------
% Software Components
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'software_components' in analysis}
\section{Software}
\begin{twentyshort}
\BLOCK{for summary in analysis['software_components']['summary'] | sort | x_entires}
\twentyitemshort{\VAR{summary | split_space}}
\BLOCK{endfor}
\BLOCK{if analysis['software_components']['summary'] | elements_count > 10}
\twentyitemshort{}{and \VAR{analysis['software_components']['summary'] | elements_count - 10} others}
\BLOCK{endif}
\end{twentyshort}
\BLOCK{endif}\\
% ----------------------------------------------------------------------------------------------------------------------
% Known Vulnerabilities
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'known_vulnerabilities' in analysis}
\section{Known Vulnerabilities}
\begin{twentyshort}
\BLOCK{for known_vullies in analysis['known_vulnerabilities']['summary']}
\twentyitemshort{\VAR{known_vullies | filter_chars}}{}
\BLOCK{endfor}
\end{twentyshort}
\BLOCK{endif}\\
% ----------------------------------------------------------------------------------------------------------------------
% Top 5 File Types
% ----------------------------------------------------------------------------------------------------------------------
\section{Top five occuring file types}
\begin{twentyshort}
\BLOCK{for selected_summary in analysis['file_type']['summary'] | top_five}
\twentyitemshort{\VAR{analysis['file_type']['summary'][selected_summary] | elements_count}}{\VAR{selected_summary | filter_chars}}
\BLOCK{endfor}
\end{twentyshort}\\
% ----------------------------------------------------------------------------------------------------------------------
% IP & URI
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'ip_and_uri_finder' in analysis}
\section{IPs and URIs}
\begin{twentyshort}
\BLOCK{for selected_analysis in analysis['ip_and_uri_finder']['summary'] | triplet}
\twentyitemshort{\VAR{selected_analysis}}
\BLOCK{endfor}
\end{twentyshort}
\BLOCK{endif}
% ----------------------------------------------------------------------------------------------------------------------
% Executables
% ----------------------------------------------------------------------------------------------------------------------
\section{Executables}
\begin{twentyshort}
\BLOCK{for selected_summary in analysis['cpu_architecture']['summary']}
\twentyitemshort{\VAR{analysis['cpu_architecture']['summary'][selected_summary] | elements_count}}{\VAR{selected_summary | filter_chars}}
\BLOCK{endfor}
\end{twentyshort}\\
%----------------------------------------------------------------------------------------
% SECOND PAGE EXAMPLE
%----------------------------------------------------------------------------------------
%\newpage % Start a new page
%\makeprofile % Print the sidebar
% \section{Other information}
% \subsection{Review}
% Alice approaches Wonderland as an anthropologist, but maintains a strong sense of noblesse oblige that comes with her class status. She has confidence in her social position, education, and the Victorian virtue of good manners. Alice has a feeling of entitlement, particularly when comparing herself to Mabel, whom she declares has a ``poky little house," and no toys. Additionally, she flaunts her limited information base with anyone who will listen and becomes increasingly obsessed with the importance of good manners as she deals with the rude creatures of Wonderland. Alice maintains a superior attitude and behaves with solicitous indulgence toward those she believes are less privileged.
% \section{Other information}
% \subsection{Review}
% Alice approaches Wonderland as an anthropologist, but maintains a strong sense of noblesse oblige that comes with her class status. She has confidence in her social position, education, and the Victorian virtue of good manners. Alice has a feeling of entitlement, particularly when comparing herself to Mabel, whom she declares has a ``poky little house," and no toys. Additionally, she flaunts her limited information base with anyone who will listen and becomes increasingly obsessed with the importance of good manners as she deals with the rude creatures of Wonderland. Alice maintains a superior attitude and behaves with solicitous indulgence toward those she believes are less privileged.
%----------------------------------------------------------------------------------------
\end{document}
\cvname{\VAR{meta_data['device_name'] | filter_chars }} % Your name
\cvjobtitle{\VAR{meta_data['device_class'] | filter_chars }} % Job title/career
\cvdate{\VAR{meta_data['vendor'] | filter_chars }} % Date of birth
\cvaddress{\VAR{meta_data['size'] | number_format}} % Short address/location, use \newline if more than 1 line is required
\cvnumberphone{\VAR{meta_data['version'] | filter_chars}} % Phone number
\cvsite{\VAR{meta_data['release_date']}} % Personal website
\cvmail{} % Email address
% to change the icons: line 142 in twentysecondcv.cls
% all icons possible from: https://github.com/spagnuolocarmine/TwentySecondsCurriculumVitae-LaTex/raw/master/fontawesome.pdf
\ No newline at end of file
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{longtable}
\usepackage{sectsty}
\allsectionsfont{\sffamily}
\begin{document}
\begin{titlepage}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\center
\includegraphics[width = 13cm]{fact_logo.png}\\[3cm]
\HRule \\[0.4cm]
{\fontfamily{lmss}\selectfont
{\Large \bfseries Firmware Analysis of \VAR{meta_data['hid'] | filter_chars }}\\[0.4cm]
}
\HRule \\[1.5cm]
\vspace{3.0cm}
{\fontfamily{lmss}\selectfont
\input{meta.tex}
}
\vfill
\end{titlepage}
\BLOCK{for current_analysis in analysis}
\input{\VAR{current_analysis}.tex}
\newpage
\BLOCK{endfor}
\end{document}
\begin{tabular}{|p{3cm}|p{11.5cm}|}
\hline
HID & \VAR{meta_data['hid'] | filter_chars}\\
\hline
Device Name & \VAR{meta_data['device_name'] | filter_chars}\\
\hline
Vendor & \VAR{meta_data['vendor'] | filter_chars}\\
\hline
Device Class & \VAR{meta_data['device_class'] | filter_chars}\\
\hline
Version & \VAR{meta_data['version'] | filter_chars}\\
\hline
Release Date & \VAR{meta_data['release_date']}\\
\hline
Size & \VAR{meta_data['size'] | number_format}\\
\hline
\end{tabular}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment