Unpack thesis sources.
This commit is contained in:
162
thesis/Back/AppendixA.tex
Normal file
162
thesis/Back/AppendixA.tex
Normal file
@@ -0,0 +1,162 @@
|
||||
% !TEX root = ../Thesis.tex
|
||||
\chapter{Appendix A}
|
||||
|
||||
\section{Command Line Examples}\label{example:pre-post}
|
||||
\subsection{Pre and post scripts}
|
||||
In this example, the \verb|--unsafe| option allows not to specify a IP or MAC address.
|
||||
\verb|default| is the device name used and \verb|-c 10| tells \iottb that we only want to capture 10 packets.
|
||||
\begin{minted}{bash}
|
||||
# Command:
|
||||
$ iottb sniff --pre='/usr/bin/echo "pre"' --post='/usr/bin/echo "post"' \
|
||||
default --unsafe -c 10
|
||||
# Stdout:
|
||||
Testbed [Info]
|
||||
Running pre command /usr/bin/echo "pre"
|
||||
pre
|
||||
Using canonical device name default
|
||||
Found device at path /home/seb/iottb.db/default
|
||||
Using filter None
|
||||
Files will be placed in /home/seb/iottb.db/default/sniffs/2024-06-30/cap0002-2101
|
||||
Capture has id dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe
|
||||
Capture setup complete!
|
||||
Capture complete. Saved to default_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.pcap
|
||||
tcpdump took 2.12 seconds.
|
||||
Ensuring correct ownership of created files.
|
||||
Saving metadata.
|
||||
END SNIFF SUBCOMMAND
|
||||
Running post script /usr/bin/echo "post"
|
||||
post
|
||||
\end{minted}
|
||||
|
||||
The contents of the 'sniff' directory for the default device after this capture has completed:
|
||||
\begin{minted}{bash}
|
||||
sniffs/2024-06-30/cap0002-2101
|
||||
$ tree
|
||||
.
|
||||
|-- capture_metadata.json
|
||||
|-- default_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.pcap
|
||||
|-- stderr_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.log
|
||||
L__ stdout_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.log
|
||||
\end{minted}
|
||||
and the metadata file contains (\verb|\| only used for fitting into this document):\\
|
||||
\verb|# capture_metadata.json|\\
|
||||
\begin{minted}{json}
|
||||
{
|
||||
"device": "default",
|
||||
"device_id": "default",
|
||||
"capture_id": "dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe",
|
||||
"capture_date_iso": "2024-06-30T21:01:31.496870",
|
||||
"invoked_command": "sudo tcpdump -# -n -c 10 -w \
|
||||
/home/seb/iottb.db \
|
||||
/default/sniffs/2024-06-30 \
|
||||
/cap0002-2101/default_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.pcap",
|
||||
"capture_duration": 2.117154359817505,
|
||||
"generic_parameters": {
|
||||
"flags": "-# -n",
|
||||
"kwargs": "-c 10",
|
||||
"filter": null
|
||||
},
|
||||
"non_generic_parameters": {
|
||||
"kwargs": "-w \
|
||||
/home/seb/iottb.db/default/sniffs/2024-06-30 \
|
||||
/cap0002-2101 \
|
||||
/default_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.pcap",
|
||||
"filter": null
|
||||
},
|
||||
"features": {
|
||||
"interface": null,
|
||||
"address": null
|
||||
},
|
||||
"resources": {
|
||||
"pcap_file": "default_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.pcap",
|
||||
"stdout_log": "stdout_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.log",
|
||||
"stderr_log": "stderr_dcdf1e0b-6c4d-4f01-ba16-f42a04131fbe.log",
|
||||
"pre": "/usr/bin/echo \"pre\"",
|
||||
"post": "/usr/bin/echo \"post\""
|
||||
},
|
||||
"environment": {
|
||||
"capture_dir": "cap0002-2101",
|
||||
"database": "iottb.db",
|
||||
"capture_base_dir": "/home/seb/iottb.db/default/sniffs/2024-06-30",
|
||||
"capture_dir_abs_path": \
|
||||
"/home/seb/iottb.db/default/sniffs/2024-06-30/cap0002-2101"
|
||||
}
|
||||
}
|
||||
|
||||
\end{minted}
|
||||
|
||||
\section{Canonical Name}
|
||||
\begin{listing}[!ht]
|
||||
\inputminted[firstline=12, lastline=40]{python}{string_processing.py}
|
||||
\caption{Shows how the canonical name is created.}
|
||||
\label{lst:dev-canonical}
|
||||
\end{listing}
|
||||
|
||||
\section{Add Device Example}
|
||||
\subsection{Configuration File}\label{appendixA:add-dev-cfg}
|
||||
\begin{listing}[!ht]
|
||||
\inputminted[linenos, breaklines]{python}{appendixa-after-add-device-dir.txt}
|
||||
\caption{Directory and file contents after adding two devices.}
|
||||
\label{lst:appendix:appendixa:config-file}
|
||||
\end{listing}
|
||||
|
||||
\section{Debug Flag Standard Output}
|
||||
|
||||
\begin{figure}
|
||||
\centering
|
||||
\begin{minted}{bash}
|
||||
❯ iottb -vvv --debug sniff roomba --unsafe -c 10
|
||||
<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
|
||||
INFO - main - cli - 48 - Starting execution.
|
||||
INFO - iottb_config - __init__ - 24 - Initializing Config object
|
||||
WARNING - iottb_config - warn - 21 - DatabaseLocations are DatabaseLocationMap in the class iottb.models.iottb_config
|
||||
INFO - iottb_config - load_config - 57 - Loading configuration file
|
||||
INFO - iottb_config - load_config - 62 - Config file exists, opening.
|
||||
DEBUG - main - cli - 52 - Verbosity: 3
|
||||
DEBUG - main - cli - 54 - Debug: True
|
||||
INFO - sniff - validate_sniff - 37 - Validating sniff...
|
||||
INFO - sniff - sniff - 91 - sniff command invoked
|
||||
DEBUG - sniff - sniff - 98 - Config loaded: <iottb.models.iottb_config.IottbConfig object at 0x7f16197d5e50>
|
||||
DEBUG - sniff - sniff - 104 - Full db path is /home/seb/showcase
|
||||
INFO - string_processing - make_canonical_name - 20 - Normalizing name roomba
|
||||
DEBUG - string_processing - make_canonical_name - 38 - Canonical name: roomba
|
||||
DEBUG - string_processing - make_canonical_name - 39 - Aliases: ['roomba']
|
||||
Testbed [I]
|
||||
Using canonical device name roomba
|
||||
Found device at path /home/seb/showcase/roomba
|
||||
INFO - sniff - sniff - 152 - Generic filter None
|
||||
Using filter None
|
||||
DEBUG - sniff - sniff - 160 - Previous captures <generator object Path.glob at 0x7f16194ec590>
|
||||
DEBUG - sniff - sniff - 162 - Capture count is 4
|
||||
DEBUG - sniff - sniff - 165 - capture_dir: cap0004-0310
|
||||
Files will be placed in /home/seb/showcase/roomba/sniffs/2024-07-01/cap0004-0310
|
||||
DEBUG - sniff - sniff - 172 - successfully created capture directory
|
||||
Capture has id 59153b53-c49d-44de-99d2-b5a3490df29a
|
||||
DEBUG - sniff - sniff - 185 - Full pcap file path is /home/seb/showcase/roomba/sniffs/2024-07-01/cap0004-0310/roomba_59153b53-c49d-44de-99d2-b5a3490df29a.pcap
|
||||
INFO - sniff - sniff - 186 - pcap file name is roomba_59153b53-c49d-44de-99d2-b5a3490df29a.pcap
|
||||
INFO - sniff - sniff - 187 - stdout log file is stdout_59153b53-c49d-44de-99d2-b5a3490df29a.log
|
||||
INFO - sniff - sniff - 188 - stderr log file is stderr_59153b53-c49d-44de-99d2-b5a3490df29a.log
|
||||
DEBUG - sniff - sniff - 191 - pgid 260696
|
||||
DEBUG - sniff - sniff - 192 - ppid 12862
|
||||
DEBUG - sniff - sniff - 193 - (real, effective, saved) user id: (1000, 1000, 1000)
|
||||
DEBUG - sniff - sniff - 194 - (real, effective, saved) group id: (1000, 1000, 1000)
|
||||
DEBUG - sniff - sniff - 209 - Flags: -# -n
|
||||
DEBUG - sniff - sniff - 217 - verbosity string to pass to tcpdump: -vvv
|
||||
DEBUG - sniff - sniff - 228 - KW args: -c 10
|
||||
DEBUG - sniff - sniff - 237 - Non transferable (special) kw args: -w /home/seb/showcase/roomba/sniffs/2024-07-01/cap0004-0310/roomba_59153b53-c49d-44de-99d2-b5a3490df29a.pcap
|
||||
INFO - sniff - sniff - 246 - tcpdump command: sudo tcpdump -# -n -vvv -c 10 -w /home/seb/showcase/roomba/sniffs/2024-07-01/cap0004-0310/roomba_59153b53-c49d-44de-99d2-b5a3490df29a.pcap
|
||||
Capture setup complete!
|
||||
DEBUG - sniff - sniff - 259 -
|
||||
stdout: <_io.TextIOWrapper name='/home/seb/showcase/roomba/sniffs/2024-07-01/cap0004-0310/stdout_59153b53-c49d-44de-99d2-b5a3490df29a.log' mode='w' encoding='UTF-8'>.
|
||||
stderr: <_io.TextIOWrapper name='/home/seb/showcase/roomba/sniffs/2024-07-01/cap0004-0310/stderr_59153b53-c49d-44de-99d2-b5a3490df29a.log' mode='w' encoding='UTF-8'>.
|
||||
|
||||
Capture complete. Saved to roomba_59153b53-c49d-44de-99d2-b5a3490df29a.pcap
|
||||
tcpdump took 1.11 seconds.
|
||||
Ensuring correct ownership of created files.
|
||||
Saving metadata.
|
||||
END SNIFF SUBCOMMAND
|
||||
|
||||
\end{minted}
|
||||
\caption{Output with max verbosity and debug flag set.}
|
||||
\label{fig:example-debug-output}
|
||||
\end{figure}
|
||||
16
thesis/Back/AppendixB.tex
Normal file
16
thesis/Back/AppendixB.tex
Normal file
@@ -0,0 +1,16 @@
|
||||
\chapter{Appendix B}
|
||||
\section{Software Requirements}\label{sec:software-req}
|
||||
\iottbsc was developed on the \textit{Linux}\footnote{\url{kernel.org}} operating system \textit{Fedora 40}\footnote{\url{https://fedoraproject.org/workstation/}}. It has not been tested on any other platform.
|
||||
\iottbsc is implemented in a Python\footnote{\url{python.org}} package \iottb, which has been developed with Python version 3.12.
|
||||
|
||||
\subsection{Runtime Dependencies}
|
||||
\begin{itemize}
|
||||
\item Poetry\footnote{\url{https://python-poetry.org/}}, version 1.8.3. Used for packaging and dependency management.
|
||||
\item Click\footnote{\url{https://click.palletsprojects.com/en/8.1.x/}}, version 8.1, is a library which enables parameter handling through decorated functions.
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Testing Dependencies}
|
||||
\begin{itemize}
|
||||
\item Pytest\footnote{\url{https://docs.pytest.org/en/8.2.x/}}, versions 8.2. Although not many exist.
|
||||
|
||||
\end{itemize}
|
||||
145
thesis/Back/CommandRef.tex
Normal file
145
thesis/Back/CommandRef.tex
Normal file
@@ -0,0 +1,145 @@
|
||||
\chapter{Appendix D}\label{appendix:cmdref}
|
||||
|
||||
\section{\iottb}\label{cmdref:iottb}
|
||||
\begin{verbatim}
|
||||
Usage: iottb [OPTIONS] COMMAND [ARGS]...
|
||||
|
||||
Options:
|
||||
-v, --verbosity Set verbosity [default: 0; 0<=x<=3]
|
||||
-d, --debug Enable debug mode
|
||||
--dry-run [default: True]
|
||||
--cfg-file PATH Path to iottb config file [default:
|
||||
$HOME/.config/iottb/iottb.cfg]
|
||||
--help Show this message and exit.
|
||||
|
||||
Commands:
|
||||
add-device Add a device to a database
|
||||
init-db
|
||||
rm-cfg Removes the cfg file from the filesystem.
|
||||
rm-dbs Removes ALL(!) databases from the filesystem if...
|
||||
set-key-in-table-to Edit config or metadata files.
|
||||
show-all Show everything: configuration, databases, and...
|
||||
show-cfg Show the current configuration context
|
||||
sniff Sniff packets with tcpdump
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{Initialize Database}\label{cmdref:init-db}
|
||||
\begin{verbatim}
|
||||
Usage: iottb init-db [OPTIONS]
|
||||
|
||||
Options:
|
||||
-d, --dest PATH Location to put (new) iottb database
|
||||
-n, --name TEXT Name of new database. [default: iottb.db]
|
||||
--update-default / --no-update-default
|
||||
If new db should be set as the new default
|
||||
[default: update-default]
|
||||
--help Show this message and exit.
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{Add device}\label{cmdref:add-device}
|
||||
\begin{verbatim}
|
||||
Usage: iottb add-device [OPTIONS]
|
||||
|
||||
Add a device to a database
|
||||
|
||||
Options:
|
||||
--dev, --device-name TEXT The name of the device to be added. If this
|
||||
string contains spaces or other special
|
||||
characters normalization is
|
||||
performed to derive a canonical name [required]
|
||||
--db, --database DIRECTORY Database in which to add this device. If not
|
||||
specified use default from config. [env var:
|
||||
IOTTB_DB]
|
||||
--guided Add device interactively [env var:
|
||||
IOTTB_GUIDED_ADD]
|
||||
--help Show this message and exit.
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{Capture traffic with \textit{tcpdump}}\label{cmdref:sniff}
|
||||
\begin{verbatim}
|
||||
Usage: iottb sniff [OPTIONS] [TCPDUMP-ARGS] [DEVICE]
|
||||
|
||||
Sniff packets with tcpdump
|
||||
|
||||
Options:
|
||||
Testbed sources:
|
||||
--db, --database TEXT Database of device. Only needed if not current
|
||||
default. [env var: IOTTB_DB]
|
||||
--app TEXT Companion app being used during capture
|
||||
Runtime behaviour:
|
||||
--unsafe Disable checks for otherwise required options.
|
||||
[env var: IOTTB_UNSAFE]
|
||||
--guided [env var: IOTTB_GUIDED]
|
||||
--pre TEXT Script to be executed before main command is
|
||||
started.
|
||||
--post TEXT Script to be executed upon completion of main
|
||||
command.
|
||||
Tcpdump options:
|
||||
-i, --interface TEXT Network interface to capture on.If not specified
|
||||
tcpdump tries to find and appropriate one.
|
||||
[env var: IOTTB_CAPTURE_INTERFACE]
|
||||
-a, --address TEXT IP or MAC address to filter packets by.
|
||||
[env var: IOTTB_CAPTURE_ADDRESS]
|
||||
-I, --monitor-mode Put interface into monitor mode.
|
||||
--ff TEXT tcpdump filter as string or file path.
|
||||
[env var: IOTTB_CAPTURE_FILTER]
|
||||
-#, --print-pacno Print packet number at beginning of line. True by
|
||||
default. [default: True]
|
||||
-e, --print-ll Print link layer headers. True by default.
|
||||
-c, --count INTEGER Number of packets to capture. [default: 1000]
|
||||
--help Show this message and exit.
|
||||
\end{verbatim}
|
||||
|
||||
\section{Utility commands}\label{cmdref:sec:utils}
|
||||
Utility Commands mostly for development and have not yet been integrated into the standard workflow.
|
||||
\subsection{Remove Configuration}\label{cmdref:rm-cfg}
|
||||
\begin{verbatim}
|
||||
Usage: iottb rm-cfg [OPTIONS]
|
||||
|
||||
Removes the cfg file from the filesystem.
|
||||
|
||||
This is mostly a utility during development. Once non-standard database
|
||||
locations are implemented, deleting this would lead to iottb not being able
|
||||
to find them anymore.
|
||||
|
||||
Options:
|
||||
--yes Confirm the action without prompting.
|
||||
--help Show this message and exit.
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{Remove Database}\label{cmdref:rm-dbs}
|
||||
\begin{verbatim}
|
||||
Usage: iottb rm-dbs [OPTIONS]
|
||||
|
||||
Removes ALL(!) databases from the filesystem if they're empty.
|
||||
|
||||
Development utility currently unfit for use.
|
||||
|
||||
Options:
|
||||
--yes Confirm the action without prompting.
|
||||
--help Show this message and exit.
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{Display Configuration File}\label{cmdref:show-cfg}
|
||||
\begin{verbatim}
|
||||
Usage: iottb show-cfg [OPTIONS]
|
||||
|
||||
Show the current configuration context
|
||||
|
||||
Options:
|
||||
--cfg-file PATH Path to the config file [default:
|
||||
/home/seb/.config/iottb/iottb.cfg]
|
||||
-pp Pretty Print
|
||||
--help Show this message and exit
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{"Show All"}\label{cmdref:show-all}
|
||||
\begin{verbatim}
|
||||
Usage: iottb show-all [OPTIONS]
|
||||
|
||||
Show everything: configuration, databases, and device metadata
|
||||
|
||||
Options:
|
||||
--help Show this message and exit.
|
||||
\end{verbatim}
|
||||
|
||||
BIN
thesis/Back/wissensch_Redlichkeit_D_09-2023.pdf
Normal file
BIN
thesis/Back/wissensch_Redlichkeit_D_09-2023.pdf
Normal file
Binary file not shown.
BIN
thesis/Back/wissensch_Redlichkeit_E_09-2023.pdf
Normal file
BIN
thesis/Back/wissensch_Redlichkeit_E_09-2023.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user