Skip to content

Commit

Permalink
doc: use packet.exe example in User Manual
Browse files Browse the repository at this point in the history
  • Loading branch information
thebendavis committed Jul 10, 2024
1 parent ed40d0d commit 0976272
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
12 changes: 8 additions & 4 deletions docs/user-manual/binary-ninja-ui.tex
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ \subsection{Installation}

\subsection{Usage}

In Section~\ref{sec:terminal-ui} we examined the \texttt{packet.exe} example using the \pate{} terminal UI.
In this section, we describe analyzing the same example using the \pate{} Binary Ninja plugin.

\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{pate-binja-overview.png}
Expand All @@ -57,7 +60,7 @@ \subsection{Usage}
\item[\texttt{args}] a list additional arguments to pass to \pate{}
\end{description}

For example:
For example, the file \texttt{tests/integration/packet/packet.run-config.json} contains:

\begin{verbatim}
{
Expand All @@ -69,11 +72,12 @@ \subsection{Usage}
}
\end{verbatim}

After selecting a run configuration file, the \pate{} plugin will open three Binary Ninja tabs: one for each of the original and patched binaries, and a third \emph{\pate{} analysis} tab.
After selecting the run configuration file, the \pate{} plugin will open three Binary Ninja tabs: one for each of the original and patched binaries, and a third \emph{\pate{} analysis} tab.

As shown in Figure~\ref{fig:overview}, the \pate{} analysis tab is composed of two primary regions.
The bottom portion is an interactive text view that corresponds to the terminal user interface described in Section~\ref{sec:terminal-ui}.
The bottom portion is an interactive text view that corresponds to the terminal user interface.
The user interacts with this region through the text input field at the bottom of the window.
In the \texttt{packet.exe} example, the user enters the same commands described in Section~\ref{sec:terminal-ui} through the \texttt{Finish and view final result} step, at which point results will be rendered in the interactive Binary Ninja view.

The top portion of the \pate{} analysis tab is a graph view showing the current state of the \pate{} analysis.
When \pate{} analysis is complete (via interaction in the bottom portion), the \pate{} graph shows rectangles for each slice of the program analyzed by \pate{}.
Expand Down Expand Up @@ -102,7 +106,7 @@ \subsection{Usage}

Right clicking on a rectangle in the \pate{} analysis graph and selecting ``Show Instruction Trees'' will open a new window showing basic blocks from the original program on the left and corresponding basic blocks from the patched program on the right.
At the bottom will be a linearized representation of the instruction trees in the original and patched program, with colorized diff view.
Instructions conditionally reachable through control flow edges are prefixed by \texttt{+} or \texttt{-} to differentiate instructions in distinct branches.
Instructions conditionally reachable through conditional control flow edges (if any) are prefixed by \texttt{+} or \texttt{-} to differentiate instructions in distinct branches.

\subsection{Replays}

Expand Down
7 changes: 4 additions & 3 deletions docs/user-manual/build.tex
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ \subsection{Recommended: Docker Container Image}
\begin{verbatim}
docker run --rm -it \
--platform linux/amd64 \
-v "$(pwd)"/tests:/tests \
-v "$(pwd)"/tests/integration/packet/exe:/target \
pate \
--original /tests/aarch32/const-args.original.exe \
--patched /tests/aarch32/const-args.patched.exe
--original /target/packet.exe \
--patched /target/packet.patched.exe \
-s parse_packet
\end{verbatim}

Please see later sections for detailed usage information.
Expand Down
Binary file modified docs/user-manual/images/pate-binja-equiv-cond.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user-manual/images/pate-binja-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion docs/user-manual/terminal-ui.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ \section{The \pate{} Terminal UI}

\subsection{Example Usage}

After first starting \pate{}, the user is presented with a list of entry points and makes a selection:
Launch \pate{} on the binaries in the \texttt{tests/integration/packet/exe/} directory with:

\begin{verbatim}
docker run --rm -it \
--platform linux/amd64 \
-v "$(pwd)"/tests/integration/packet/exe:/target \
pate \
--original /target/packet.exe \
--patched /target/packet.patched.exe \
-s parse_packet
\end{verbatim}

Once launched, \pate{} presents the user is presented with a list of entry points and makes a selection:
\begin{lstlisting}
Choose Entry Point
0: Function Entry "_start" (segment1+0x435)
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/packet/packet.exp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# ./tests/integration/packet/packet.exp
#
# Note that expected strings must be escaped: double-quotes (\") and brackets (\\\[)
#
# Also note this example is mentioned in the README.rst and used in the User Manual.
# Major changes here likely warrant an update of the corresponding User Manual content.

spawn ./pate.sh --original tests/integration/packet/exe/packet.exe --patched tests/integration/packet/exe/packet.patched.exe -s parse_packet

Expand Down

0 comments on commit 0976272

Please sign in to comment.