Commit 1bd1b06e by Peter Weidenbach

tests added

parent 1292b373
\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}
\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
\multicolumn{2}{|p{14.5cm}|}{Signature Analysis:} \\
\multicolumn{2}{|p{14.5cm}|}{} \\
\multicolumn{2}{|p{14.5cm}|}{\VAR{selected_analysis['signature_analysis'] | filter_chars}} \\
\hline
Entropy Graph & \includegraphics[scale = 0.7]{\VAR{selected_analysis['entropy_analysis_graph'] | base64_to_png('entropy_analysis_graph')}} \\
\hline
\BLOCK{if selected_analysis['summary']}
\multicolumn{2}{|p{14.5cm}|}{Summary:} \\
\multicolumn{2}{|p{14.5cm}|}{} \\
\BLOCK{for data in selected_analysis['summary']}
\multicolumn{2}{|p{14.5cm}|}{\VAR{data | filter_chars}} \\
\BLOCK{endfor}
\hline
\BLOCK{endif}
\end{longtable}
\ No newline at end of file
\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}
\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}
\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
\begin{tabular}{|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
imphash & \VAR{selected_analysis['imphash']}\\
\hline
md5 & \VAR{selected_analysis['md5']}\\
\hline
ripemd160 & \VAR{selected_analysis['ripemd160']}\\
\hline
sha1 & \VAR{selected_analysis['sha1']}\\
\hline
sha256 & \VAR{selected_analysis['sha256']}\\
\hline
sha512 & \VAR{selected_analysis['sha512'] | split_hash}\\
\hline
ssdeep & \VAR{selected_analysis['ssdeep'] | split_hash}\\
\hline
whirpool & \VAR{selected_analysis['whirlpool'] | split_hash}\\
\hline
\end{tabular}
\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
File Type & \VAR{selected_analysis['full'] | filter_chars} \\
\hline
MIME & \VAR{selected_analysis['mime'] | filter_chars} \\
\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
\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}
\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
IPs v4
\BLOCK{for ip in selected_analysis['ips_v4'] | check_list}
& \VAR{ip} \\
\BLOCK{endfor}
\hline
IPs v6
\BLOCK{for ip in selected_analysis['ips_v6'] | check_list}
& \VAR{ip} \\
\BLOCK{endfor}
\hline
URIs
\BLOCK{for uri in selected_analysis['uris'] | check_list}
& \VAR{uri} \\
\BLOCK{endfor}
\hline
\BLOCK{if selected_analysis['summary']}
\multicolumn{2}{|p{14.5cm}|}{Summary:} \\
\multicolumn{2}{|p{14.5cm}|}{} \\
\BLOCK{for data in selected_analysis['summary']}
\multicolumn{2}{|p{14.5cm}|}{\VAR{data | filter_chars}} \\
\BLOCK{endfor}
\hline
\BLOCK{endif}
\end{longtable}
\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']}}\\[0.4cm]
}
\HRule \\[1.5cm]
\vfill
\end{titlepage}
\section*{Meta Data}
{\fontfamily{lmss}\selectfont
\input{meta.tex}
}
\section*{Analyses}
\BLOCK{if "base64_decoder" in analysis}
\subsection*{base64 decoder}
{\fontfamily{lmss}\selectfont
\input{base64_decoder.tex}
}
\BLOCK{endif}
\BLOCK{if "binwalk" in analysis}
\subsection*{binwalk}
{\fontfamily{lmss}\selectfont
\input{binwalk.tex}
}
\BLOCK{endif}
\BLOCK{if "cpu_architcture" in analysis}
\subsection*{cpu architecture}
{\fontfamily{lmss}\selectfont
\input{cpu_architecture.tex}
}
\BLOCK{endif}
\BLOCK{if "crypto_material" in analysis}
\subsection*{crypto material}
{\fontfamily{lmss}\selectfont
\input{crypto_material.tex}
}
\BLOCK{endif}
\BLOCK{if "exploit_mitigations" in analysis}
\subsection*{exploit mitigations}
{\fontfamily{lmss}\selectfont
\input{exploit_mitigations.tex}
}
\BLOCK{endif}
\BLOCK{if "file_hashes" in analysis}
\subsection*{file hashes}
{\fontfamily{lmss}\selectfont
\input{file_hashes.tex}
}
\BLOCK{endif}
\BLOCK{if "file_type" in analysis}
\subsection*{file type}
{\fontfamily{lmss}\selectfont
\input{file_type.tex}
}
\BLOCK{endif}
\BLOCK{if "init_systems" in analysis}
\subsection*{init systems}
{\fontfamily{lmss}\selectfont
\input{init_systems.tex}
}
\BLOCK{endif}
\BLOCK{if "ip_and_uri_finder" in analysis}
\subsection*{ip and uri finder}
{\fontfamily{lmss}\selectfont
\input{ip_and_uri_finder.tex}
}
\BLOCK{endif}
\BLOCK{if "software_components" in analysis}
\subsection*{software components}
{\fontfamily{lmss}\selectfont
\input{software_components.tex}
}
\BLOCK{endif}
\BLOCK{if "printable_strings" in analysis}
\subsection*{printable strings}
{\fontfamily{lmss}\selectfont
\input{printable_strings.tex}
}
\BLOCK{endif}
\BLOCK{if "users_and_passwords" in analysis}
\subsection*{users and passwords}
{\fontfamily{lmss}\selectfont
\input{users_and_passwords.tex}
}
\BLOCK{endif}
\BLOCK{if "string_evaluator" in analysis}
\subsection*{string evaluator}
{\fontfamily{lmss}\selectfont
\input{string_evaluator.tex}
}
\BLOCK{endif}
\BLOCK{if "unpacker" in analysis}
\subsection*{unpacker}
{\fontfamily{lmss}\selectfont
\input{unpacker.tex}
}
\BLOCK{endif}
\BLOCK{if "malware_scanner" in analysis}
\subsection*{malware scanner}
{\fontfamily{lmss}\selectfont
\input{malware_scanner.tex}
}
\BLOCK{endif}
\end{document}
\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
MD5 & \VAR{selected_analysis['md5']} \\
\hline
System Version & \VAR{selected_analysis['system_version']} \\
\hline
Scanners Number & \VAR{selected_analysis['number_of_scanners']} \\
\hline
Positives & \VAR{selected_analysis['positives']} \\
\hline
Scanners
\BLOCK{for scanner in selected_analysis['scanners']}
& \VAR{scanner} \\
\BLOCK{endfor}
\hline
Scanns
\BLOCK{for scan in selected_analysis['scans']}
\BLOCK{for value in selected_analysis['scans'][scan]}
& \VAR{scan} :: \VAR{value}:\VAR{selected_analysis['scans'][scan][value]} \\
\BLOCK{endfor}
\BLOCK{endfor}
\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}
\begin{tabular}{|p{3cm}|p{11.5cm}|}
\hline
HID & \VAR{meta_data['hid']}\\
\hline
Device Name & \VAR{meta_data['device_name']}\\
\hline
Vendor & \VAR{meta_data['vendor']}\\
\hline
Device Class & \VAR{meta_data['device_class']}\\
\hline
Version & \VAR{meta_data['version']}\\
\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
\begin{tabular}{|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
String Count & \VAR{selected_analysis['strings'] | elements_count}\\
\hline
\end{tabular}
\ No newline at end of file
\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
\begin{tabular}{|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
String Count & \VAR{selected_analysis['string_eval'] | elements_count}\\
\hline
\end{tabular}
\ No newline at end of file
\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
Plugin & \VAR{selected_analysis['plugin_used']} \\
\hline
Extracted & \VAR{selected_analysis['number_of_unpacked_files']} \\
\hline
\BLOCK{if selected_analysis['output']}
\multicolumn{2}{|p{14.5cm}|}{Output:}\\
\multicolumn{2}{|p{14.5cm}|}{}\\
\multicolumn{2}{|p{14.5cm}|}{\VAR{selected_analysis['output'] | split_output_lines | filter_chars }} \\
\hline
\BLOCK{endif}
Size Packed -\textgreater{} Unpacked & \VAR{selected_analysis['size packed -> unpacked'] | filter_chars} \\
\hline
Entropy & \VAR{selected_analysis['entropy'] | nice_number} \\
\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
\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
from common_helper_process.fail_safe_subprocess import execute_shell_command_get_return_code from common_helper_process.fail_safe_subprocess import execute_shell_command_get_return_code
import os import os
import pytest
SRC_DIR = os.path.dirname(os.path.abspath(__file__)) + '/../../pdf_generator.py' SRC_DIR = os.path.dirname(os.path.abspath(__file__)) + '/../../pdf_generator.py'
def test_main_program(): @pytest.mark.parametrize('arguments, expected_output, expected_return_code', [
command_line = SRC_DIR + ' -V' ('-V', 'FACT', 0),
('-h', 'usag', 0)
])
def test_main_program(arguments, expected_output, expected_return_code):
command_line = SRC_DIR + ' ' + arguments
output, return_code = execute_shell_command_get_return_code(command_line) output, return_code = execute_shell_command_get_return_code(command_line)
print(output) assert output[0:4] == expected_output
assert return_code == 0 assert return_code == expected_return_code
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