<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LPutz</id>
	<title>Elvis Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LPutz"/>
	<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php/Special:Contributions/LPutz"/>
	<updated>2026-09-10T15:31:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.5</generator>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Heapusage&amp;diff=13958</id>
		<title>Heapusage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Heapusage&amp;diff=13958"/>
		<updated>2024-01-17T15:33:11Z</updated>

		<summary type="html">&lt;p&gt;LPutz: fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation describes the usage of heapusage developed by Kristofer Berggren (d99kris) (https://github.com/d99kris/heapusage).&lt;br /&gt;
With practical examples it is shown how this tool can be used to find memory leaks, double free, use after free and overflows.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
According to the GitHub documentation, heapusage can be used on Linux and macOS and has been tested on these operating systems:&lt;br /&gt;
* macOS Big Sur 11.0&lt;br /&gt;
* Ubuntu 20.04 LTS&lt;br /&gt;
&lt;br /&gt;
During creation of this documentation it was also successfully tested on:&lt;br /&gt;
* Ubuntu 22.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
== Alternatives ==&lt;br /&gt;
* AddressSanitizer (https://github.com/google/sanitizers/wiki/AddressSanitizer)&lt;br /&gt;
* Electric Fence (https://linux.die.net/man/3/efence)&lt;br /&gt;
* mtrace (https://man7.org/linux/man-pages/man3/mtrace.3.html)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Pre-requisites ===&lt;br /&gt;
&lt;br /&gt;
To use heapusage on Ubuntu, the following pre-requisites need to be installed:&lt;br /&gt;
 sudo apt install git cmake build-essential&lt;br /&gt;
&lt;br /&gt;
To show the source filenames and line-numbers in the call stacks, another pre-requisite can be installed optionally:&lt;br /&gt;
 sudo apt install binutils-dev&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Installing heapusage ===&lt;br /&gt;
&lt;br /&gt;
To install heapusage simply clone the GitHub repository and build it:&lt;br /&gt;
 git clone https://github.com/d99kris/heapusage&lt;br /&gt;
 cd heapusage&lt;br /&gt;
 mkdir -p build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make -s&lt;br /&gt;
&lt;br /&gt;
Optionally, you can install it in the system:&lt;br /&gt;
 sudo make install&lt;br /&gt;
If it is installed in the system, you can simply run it using &amp;lt;code&amp;gt;heapusage&amp;lt;/code&amp;gt;. More information about using heapusage can be found in the [[#Usage|Usage]] section.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
Heapusage can be used as follows:&lt;br /&gt;
 heapusage [-d] [-m minsize] [-n] [-o path] [-t tools] PROG [ARGS..]&lt;br /&gt;
This parameters can be used:&lt;br /&gt;
* &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; (optional) enables the debug mode.&lt;br /&gt;
* &amp;lt;code&amp;gt;-m &amp;lt;minsize&amp;gt;&amp;lt;/code&amp;gt; (optional) sets the minimum allocation size heapusage is enabled for. For example, using &amp;lt;code&amp;gt;heapusage -t leak -m 50./app&amp;lt;/code&amp;gt; only shows memory leaks larger than or equal to 50 bytes.&lt;br /&gt;
* &amp;lt;code&amp;gt;-n&amp;lt;/code&amp;gt; (optional) disables symbol lookup. This leads to a faster execution time, however less information is shown in the output. You can still see for example how many bytes are leaked, but no longer in which file/function.&lt;br /&gt;
* &amp;lt;code&amp;gt;-o &amp;lt;path&amp;gt;&amp;lt;/code&amp;gt; (optional) sets an output file to write the output to, instead of stderr.&lt;br /&gt;
* &amp;lt;code&amp;gt;-t &amp;lt;tools&amp;gt;&amp;lt;/code&amp;gt; (optional) sets which tools should be used for the analysis. If not specified, the tool &amp;lt;code&amp;gt;leak&amp;lt;/code&amp;gt; is used per default. The possible tools can be found below.&lt;br /&gt;
* &amp;lt;code&amp;gt;PROG&amp;lt;/code&amp;gt; sets the program to be analysed.&lt;br /&gt;
* &amp;lt;code&amp;gt;ARGS...&amp;lt;/code&amp;gt; (optional) are the parameters for the analysed program (PROG).&lt;br /&gt;
&lt;br /&gt;
Furthermore, heapusage can be run using&lt;br /&gt;
 heapusage --help&lt;br /&gt;
 heapusage --version&lt;br /&gt;
to show an overview of the usage or the installed version.&lt;br /&gt;
&lt;br /&gt;
=== Tools ===&lt;br /&gt;
As mentioned above, using the &amp;lt;code&amp;gt;-t &amp;lt;tools&amp;gt;&amp;lt;/code&amp;gt; parameters, the tools to be used can be specified.&lt;br /&gt;
The following tools can be used:&lt;br /&gt;
* &amp;lt;code&amp;gt;leak&amp;lt;/code&amp;gt; (default) detects memory allocations which are never free&#039;d.&lt;br /&gt;
* &amp;lt;code&amp;gt;double-free&amp;lt;/code&amp;gt; detects when an already free&#039;d buffer is free&#039;d again.&lt;br /&gt;
* &amp;lt;code&amp;gt;use-after-free&amp;lt;/code&amp;gt; detects when an already free&#039;d buffer is used afterwards.&lt;br /&gt;
* &amp;lt;code&amp;gt;overflow&amp;lt;/code&amp;gt; detects buffer overflows, like when an address beyond the allocated memory is accessed.&lt;br /&gt;
* &amp;lt;code&amp;gt;all&amp;lt;/code&amp;gt; enables all tools.&lt;br /&gt;
&lt;br /&gt;
Multiple tools can be combined by separating them with a comma, like &amp;lt;code&amp;gt;-t leak,double-free&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-t all&amp;lt;/code&amp;gt; is therefore the same as &amp;lt;code&amp;gt;-t leak,double-free,use-after-free,overflow&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
In the following, a simple example for each of the tools is shown. Each of these examples is saved as &amp;lt;code&amp;gt;.c&amp;lt;/code&amp;gt;-file and compiled using &amp;lt;code&amp;gt;gcc &amp;lt;filename&amp;gt;.c -o &amp;lt;output-filename&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== leak ===&lt;br /&gt;
ex1-leak.c:&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 void* getPointer(int size) {&lt;br /&gt;
     return malloc(size);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
     void* p = getPointer(1337);&lt;br /&gt;
     p = getPointer(42);&lt;br /&gt;
     free(p);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
After compiling this code it is executed using heapusage: &amp;lt;code&amp;gt;heapusage -t leak ./ex1&amp;lt;/code&amp;gt;&lt;br /&gt;
This leads to the following output:&lt;br /&gt;
 ==6367== Heapusage - https://github.com/d99kris/heapusage&lt;br /&gt;
 ==6367== &lt;br /&gt;
 ==6367== HEAP SUMMARY:&lt;br /&gt;
 ==6367==     in use at exit: 1337 bytes in 1 blocks&lt;br /&gt;
 ==6367==   total heap usage: 2 allocs, 79 frees, 1379 bytes allocated&lt;br /&gt;
 ==6367==    peak heap usage: 1379 bytes allocated&lt;br /&gt;
 ==6367== &lt;br /&gt;
 ==6367== 1337 bytes in 1 block(s) are lost, originally allocated at:&lt;br /&gt;
 ==6367==    at 0x00007fc5942aee5c: malloc (humain.cpp:175)&lt;br /&gt;
 ==6367==    at 0x000055c4d3b9d185: getPointer&lt;br /&gt;
 ==6367==    at 0x000055c4d3b9d19d: main&lt;br /&gt;
 ==6367==    at 0x00007fc594029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6367==    at 0x00007fc594029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6367==    at 0x000055c4d3b9d0a5: _start&lt;br /&gt;
 ==6367== &lt;br /&gt;
 ==6367== LEAK SUMMARY:&lt;br /&gt;
 ==6367==    definitely lost: 1337 bytes in 1 blocks&lt;br /&gt;
 ==6367==&lt;br /&gt;
&lt;br /&gt;
It can be seen, that the second pointer initialization of 42 bytes which is free&#039;d again is not shown here, whereas the 1337 bytes are shown as memory leak, since the are allocated and never free&#039;d.&lt;br /&gt;
&lt;br /&gt;
=== double-free ===&lt;br /&gt;
ex2-doubleFree.c:&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 void* getPointer(int size) {&lt;br /&gt;
      return malloc(size);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void free1(void* p) {&lt;br /&gt;
      free(p);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void free2(void* p) {&lt;br /&gt;
      free(p);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
     void* p = getPointer(1337);&lt;br /&gt;
     free1(p);&lt;br /&gt;
     free2(p);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
The similar functions &amp;lt;code&amp;gt;free1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;free2&amp;lt;/code&amp;gt; are used for a better demonstration of the heapusage output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;heapusage -t double-free ./ex2&amp;lt;/code&amp;gt;:&lt;br /&gt;
 ==6438== Heapusage - https://github.com/d99kris/heapusage&lt;br /&gt;
 ==6438== &lt;br /&gt;
 ==6438== Invalid deallocation at:&lt;br /&gt;
 ==6438==    at 0x00007f16a3399f4f: free (humain.cpp:188)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1c2: free2&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1f7: main&lt;br /&gt;
 ==6438==    at 0x00007f16a3029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6438==    at 0x00007f16a3029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f0a5: _start&lt;br /&gt;
 ==6438==  Address 0x5648c0f6a190 is a block of size 1337 free&#039;d at:&lt;br /&gt;
 ==6438==    at 0x00007f16a3399f4f: free (humain.cpp:188)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1a3: free1&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1eb: main&lt;br /&gt;
 ==6438==    at 0x00007f16a3029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6438==    at 0x00007f16a3029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f0a5: _start&lt;br /&gt;
 ==6438==  Block was alloc&#039;d at:&lt;br /&gt;
 ==6438==    at 0x00007f16a3399e5c: malloc (humain.cpp:175)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f185: getPointer&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1db: main&lt;br /&gt;
 ==6438==    at 0x00007f16a3029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6438==    at 0x00007f16a3029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f0a5: _start&lt;br /&gt;
 ==6438== &lt;br /&gt;
 ==6438== HEAP SUMMARY:&lt;br /&gt;
 ==6438==     in use at exit: 0 bytes in 0 blocks&lt;br /&gt;
 ==6438==   total heap usage: 1 allocs, 80 frees, 1337 bytes allocated&lt;br /&gt;
 ==6438==    peak heap usage: 1337 bytes allocated&lt;br /&gt;
 ==6438== &lt;br /&gt;
 ==6438== LEAK SUMMARY:&lt;br /&gt;
 ==6438==    definitely lost: 0 bytes in 0 blocks&lt;br /&gt;
 ==6438== &lt;br /&gt;
&lt;br /&gt;
Here it shows an invalid deallocation in the &amp;lt;code&amp;gt;free2&amp;lt;/code&amp;gt; function and the reason for that, because the block was already free&#039;d in the &amp;lt;code&amp;gt;free1&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
=== use-after-free ===&lt;br /&gt;
ex3-useAfterFree.c:&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 int* getIntPointer() {&lt;br /&gt;
     return (int*)malloc(sizeof(int));&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void free1(int* p) {&lt;br /&gt;
     free(p);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void setPointerValue(int* p, int value){&lt;br /&gt;
     *p = value;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
     int *p = getIntPointer();&lt;br /&gt;
     free1(p);&lt;br /&gt;
     setPointerValue(p, 42);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;heapusage -t use-after-free ./ex3&amp;lt;/code&amp;gt;:&lt;br /&gt;
 ==6458== Heapusage - https://github.com/d99kris/heapusage&lt;br /&gt;
 ==6458== &lt;br /&gt;
 ==6458== Invalid memory access at:&lt;br /&gt;
 ==6458==    at 0x00007fe4fb042520: __restore_rt (libc_sigaction.c:0)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc71b2: setPointerValue&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc71ee: main&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc70a5: _start&lt;br /&gt;
 ==6458==  Address 0x559a8d19b000 is 0 bytes inside a block of size 4 free&#039;d at:&lt;br /&gt;
 ==6458==    at 0x00007fe4fb3e9f4f: free (humain.cpp:188)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc7199: free1&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc71dd: main&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc70a5: _start&lt;br /&gt;
 ==6458==  Block was alloc&#039;d at:&lt;br /&gt;
 ==6458==    at 0x00007fe4fb3e9e5c: malloc (humain.cpp:175)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc717b: getIntPointer&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc71cd: main&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc70a5: _start&lt;br /&gt;
 ==6458== &lt;br /&gt;
 ==6458== HEAP SUMMARY:&lt;br /&gt;
 ==6458==     in use at exit: 0 bytes in 0 blocks&lt;br /&gt;
 ==6458==   total heap usage: 1 allocs, 79 frees, 4 bytes allocated&lt;br /&gt;
 ==6458==    peak heap usage: 4 bytes allocated&lt;br /&gt;
 ==6458== &lt;br /&gt;
 ==6458== LEAK SUMMARY:&lt;br /&gt;
 ==6458==    definitely lost: 0 bytes in 0 blocks&lt;br /&gt;
 ==6458==&lt;br /&gt;
&lt;br /&gt;
The output looks similar to that of double-free, however in this case it now shows an invalid memory access instead of invalid deallocation. As before, it still shows where the block was free&#039;d before and where it was allocated in the first place.&lt;br /&gt;
&lt;br /&gt;
=== overflow ===&lt;br /&gt;
ex4-overflow.c:&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;string.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 char* getCharBuf(int size) {&lt;br /&gt;
     return (char*)malloc(size);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void setBufferText(char* buf, char* text) {&lt;br /&gt;
     strcpy(buf, text);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
     char* buf = getCharBuf(16);&lt;br /&gt;
     setBufferText(buf, &amp;quot;0123456789ABCDEF0123456789&amp;quot;);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;heapusage -t overflow ./ex4&amp;lt;/code&amp;gt;:&lt;br /&gt;
 ==6519== Heapusage - https://github.com/d99kris/heapusage&lt;br /&gt;
 ==6519== &lt;br /&gt;
 ==6519== Invalid memory access at:&lt;br /&gt;
 ==6519==    at 0x00007f978f842520: __restore_rt (libc_sigaction.c:0)&lt;br /&gt;
 ==6519==    at 0x00007f978f98b423: __strcpy_ssse3 (strcpy-ssse3.S:2568)&lt;br /&gt;
 ==6519==    at 0x000055717f4101ae: setBufferText&lt;br /&gt;
 ==6519==    at 0x000055717f4101e1: main&lt;br /&gt;
 ==6519==    at 0x00007f978f829d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6519==    at 0x00007f978f829e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6519==    at 0x000055717f4100a5: _start&lt;br /&gt;
 ==6519==  Address 0x55717fb4c000 is 0 bytes after a block of size 16 alloc&#039;d at:&lt;br /&gt;
 ==6519==    at 0x00007f978fb7ee5c: malloc (humain.cpp:175)&lt;br /&gt;
 ==6519==    at 0x000055717f410185: getCharBuf&lt;br /&gt;
 ==6519==    at 0x000055717f4101c7: main&lt;br /&gt;
 ==6519==    at 0x00007f978f829d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6519==    at 0x00007f978f829e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6519==    at 0x000055717f4100a5: _start&lt;br /&gt;
 ==6519== &lt;br /&gt;
 ==6519== HEAP SUMMARY:&lt;br /&gt;
 ==6519==     in use at exit: 16 bytes in 1 blocks&lt;br /&gt;
 ==6519==   total heap usage: 1 allocs, 78 frees, 16 bytes allocated&lt;br /&gt;
 ==6519==    peak heap usage: 16 bytes allocated&lt;br /&gt;
 ==6519== &lt;br /&gt;
 ==6519== LEAK SUMMARY:&lt;br /&gt;
 ==6519==    definitely lost: 16 bytes in 1 blocks&lt;br /&gt;
 ==6519==&lt;br /&gt;
&lt;br /&gt;
This output shows an invalid memory access, however, as opposed to before, this time it shows the error because &amp;lt;code&amp;gt;is 0 bytes after a block of size 16&amp;lt;/code&amp;gt;. Meaning the code tries to access the memory outside of the allocated memory range.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/d99kris/heapusage&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Heapusage&amp;diff=13870</id>
		<title>Heapusage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Heapusage&amp;diff=13870"/>
		<updated>2024-01-14T13:26:03Z</updated>

		<summary type="html">&lt;p&gt;LPutz: Created page with &amp;quot;== Summary ==   This documentation describes the usage of heapusage developed by Kristofer Berggren (d99kris) (https://github.com/d99kris/heapusage). With practical examples it is shown how this tool can be used to find memory leaks, double free, use after free and overflows.  == Requirements ==  According to the GitHub documentation, heapusage can be used on Linux and macOS and has been tested on these operating systems: * macOS Big Sur 11.0 * Ubuntu 20.04 LTS  During c...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation describes the usage of heapusage developed by Kristofer Berggren (d99kris) (https://github.com/d99kris/heapusage).&lt;br /&gt;
With practical examples it is shown how this tool can be used to find memory leaks, double free, use after free and overflows.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
According to the GitHub documentation, heapusage can be used on Linux and macOS and has been tested on these operating systems:&lt;br /&gt;
* macOS Big Sur 11.0&lt;br /&gt;
* Ubuntu 20.04 LTS&lt;br /&gt;
&lt;br /&gt;
During creation of this documentation it was also successfully tested on:&lt;br /&gt;
* Ubuntu 22.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Pre-requisites ===&lt;br /&gt;
&lt;br /&gt;
To use heapusage on Ubuntu, the following pre-requisites need to be installed:&lt;br /&gt;
 sudo apt install git cmake build-essential&lt;br /&gt;
&lt;br /&gt;
To show the source filenames and line-numbers in the call stacks, another pre-requisite can be installed optionally:&lt;br /&gt;
 sudo apt install binutils-dev&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Installing heapusage ===&lt;br /&gt;
&lt;br /&gt;
To install heapusage simply clone the GitHub repository and build it:&lt;br /&gt;
 git clone https://github.com/d99kris/heapusage&lt;br /&gt;
 cd heapusage&lt;br /&gt;
 mkdir -p build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make -s&lt;br /&gt;
&lt;br /&gt;
Optionally, you can install it in the system:&lt;br /&gt;
 sudo make install&lt;br /&gt;
If it is installed in the system, you can simply run it using &amp;lt;code&amp;gt;heapusage&amp;lt;/code&amp;gt;. More information about using heapusage can be found in the [[#Usage|Usage]] section.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
Heapusage can be used as follows:&lt;br /&gt;
 heapusage [-d] [-m minsize] [-n] [-o path] [-t tools] PROG [ARGS..]&lt;br /&gt;
This parameters can be used:&lt;br /&gt;
* &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; (optional) enables the debug mode.&lt;br /&gt;
* &amp;lt;code&amp;gt;-m &amp;lt;minsize&amp;gt;&amp;lt;/code&amp;gt; (optional) sets the minimum allocation size heapusage is enabled for. For example, using &amp;lt;code&amp;gt;heapusage -t leak -m 50./app&amp;lt;/code&amp;gt; only shows memory leaks larger than or equal to 50 bytes.&lt;br /&gt;
* &amp;lt;code&amp;gt;-n&amp;lt;/code&amp;gt; (optional) disables symbol lookup. This leads to a faster execution time, however less information is shown in the output. You can still see for example how many bytes are leaked, but no longer in which file/function.&lt;br /&gt;
* &amp;lt;code&amp;gt;-o &amp;lt;path&amp;gt;&amp;lt;/code&amp;gt; (optional) sets an output file to write the output to, instead of stderr.&lt;br /&gt;
* &amp;lt;code&amp;gt;-t &amp;lt;tools&amp;gt;&amp;lt;/code&amp;gt; (optional) sets which tools should be used for the analysis. If not specified, the tool &amp;lt;code&amp;gt;leak&amp;lt;/code&amp;gt; is used per default. The possible tools can be found below.&lt;br /&gt;
* &amp;lt;code&amp;gt;PROG&amp;lt;/code&amp;gt; sets the program to be analysed.&lt;br /&gt;
* &amp;lt;code&amp;gt;ARGS...&amp;lt;/code&amp;gt; (optional) are the parameters for the analysed program (PROG).&lt;br /&gt;
&lt;br /&gt;
Furthermore, heapusage can be run using&lt;br /&gt;
 heapusage --help&lt;br /&gt;
 heapusage --version&lt;br /&gt;
to show an overview of the usage or the installed version.&lt;br /&gt;
&lt;br /&gt;
=== Tools ===&lt;br /&gt;
As mentioned above, using the &amp;lt;code&amp;gt;-t &amp;lt;tools&amp;gt;&amp;lt;/code&amp;gt; parameters, the tools to be used can be specified.&lt;br /&gt;
The following tools can be used:&lt;br /&gt;
* &amp;lt;code&amp;gt;leak&amp;lt;/code&amp;gt; (default) detects memory allocations which are never free&#039;d.&lt;br /&gt;
* &amp;lt;code&amp;gt;double-free&amp;lt;/code&amp;gt; detects when an already free&#039;d buffer is free&#039;d again.&lt;br /&gt;
* &amp;lt;code&amp;gt;use-after-free&amp;lt;/code&amp;gt; detects when an already free&#039;d buffer is used afterwards.&lt;br /&gt;
* &amp;lt;code&amp;gt;overflow&amp;lt;/code&amp;gt; detects buffer overflows, like when an address beyond the allocated memory is accessed.&lt;br /&gt;
* &amp;lt;code&amp;gt;all&amp;lt;/code&amp;gt; enables all tools.&lt;br /&gt;
&lt;br /&gt;
Multiple tools can be combined by separating them with a comma, like &amp;lt;code&amp;gt;-t leak,double-free&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-t all&amp;lt;/code&amp;gt; is therefore the same as &amp;lt;code&amp;gt;-t leak,double-free,use-after-free,overflow&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
In the following, a simple example for each of the tools is shown. Each of these examples is saved as &amp;lt;code&amp;gt;.c&amp;lt;/code&amp;gt;-file and compiled using &amp;lt;code&amp;gt;gcc &amp;lt;filename&amp;gt;.c -o &amp;lt;output-filename&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== leak ===&lt;br /&gt;
ex1-leak.c:&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 void* getPointer(int size) {&lt;br /&gt;
     return malloc(size);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
     void* p = getPointer(1337);&lt;br /&gt;
     p = getPointer(42);&lt;br /&gt;
     free(p);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
After compiling this code it is executed using heapusage: &amp;lt;code&amp;gt;heapusage -t leak ./ex1&amp;lt;/code&amp;gt;&lt;br /&gt;
This leads to the following output:&lt;br /&gt;
 ==6367== Heapusage - https://github.com/d99kris/heapusage&lt;br /&gt;
 ==6367== &lt;br /&gt;
 ==6367== HEAP SUMMARY:&lt;br /&gt;
 ==6367==     in use at exit: 1337 bytes in 1 blocks&lt;br /&gt;
 ==6367==   total heap usage: 2 allocs, 79 frees, 1379 bytes allocated&lt;br /&gt;
 ==6367==    peak heap usage: 1379 bytes allocated&lt;br /&gt;
 ==6367== &lt;br /&gt;
 ==6367== 1337 bytes in 1 block(s) are lost, originally allocated at:&lt;br /&gt;
 ==6367==    at 0x00007fc5942aee5c: malloc (humain.cpp:175)&lt;br /&gt;
 ==6367==    at 0x000055c4d3b9d185: getPointer&lt;br /&gt;
 ==6367==    at 0x000055c4d3b9d19d: main&lt;br /&gt;
 ==6367==    at 0x00007fc594029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6367==    at 0x00007fc594029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6367==    at 0x000055c4d3b9d0a5: _start&lt;br /&gt;
 ==6367== &lt;br /&gt;
 ==6367== LEAK SUMMARY:&lt;br /&gt;
 ==6367==    definitely lost: 1337 bytes in 1 blocks&lt;br /&gt;
 ==6367==&lt;br /&gt;
&lt;br /&gt;
It can be seen, that the second pointer initialization of 42 bytes which is free&#039;d again is not shown here, whereas the 1337 bytes are shown as memory leak, since the are allocated and never free&#039;d.&lt;br /&gt;
&lt;br /&gt;
=== double-free ===&lt;br /&gt;
ex2-doubleFree.c:&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 void* getPointer(int size) {&lt;br /&gt;
      return malloc(size);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void free1(void* p) {&lt;br /&gt;
      free(p);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void free2(void* p) {&lt;br /&gt;
      free(p);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
     void* p = getPointer(1337);&lt;br /&gt;
     free1(p);&lt;br /&gt;
     free2(p);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
The similar functions &amp;lt;code&amp;gt;free1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;free2&amp;lt;/code&amp;gt; are used for a better demonstration of the heapusage output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;heapusage -t double-free ./ex2&amp;lt;/code&amp;gt;:&lt;br /&gt;
 ==6438== Heapusage - https://github.com/d99kris/heapusage&lt;br /&gt;
 ==6438== &lt;br /&gt;
 ==6438== Invalid deallocation at:&lt;br /&gt;
 ==6438==    at 0x00007f16a3399f4f: free (humain.cpp:188)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1c2: free2&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1f7: main&lt;br /&gt;
 ==6438==    at 0x00007f16a3029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6438==    at 0x00007f16a3029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f0a5: _start&lt;br /&gt;
 ==6438==  Address 0x5648c0f6a190 is a block of size 1337 free&#039;d at:&lt;br /&gt;
 ==6438==    at 0x00007f16a3399f4f: free (humain.cpp:188)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1a3: free1&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1eb: main&lt;br /&gt;
 ==6438==    at 0x00007f16a3029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6438==    at 0x00007f16a3029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f0a5: _start&lt;br /&gt;
 ==6438==  Block was alloc&#039;d at:&lt;br /&gt;
 ==6438==    at 0x00007f16a3399e5c: malloc (humain.cpp:175)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f185: getPointer&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f1db: main&lt;br /&gt;
 ==6438==    at 0x00007f16a3029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6438==    at 0x00007f16a3029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6438==    at 0x00005648bfc3f0a5: _start&lt;br /&gt;
 ==6438== &lt;br /&gt;
 ==6438== HEAP SUMMARY:&lt;br /&gt;
 ==6438==     in use at exit: 0 bytes in 0 blocks&lt;br /&gt;
 ==6438==   total heap usage: 1 allocs, 80 frees, 1337 bytes allocated&lt;br /&gt;
 ==6438==    peak heap usage: 1337 bytes allocated&lt;br /&gt;
 ==6438== &lt;br /&gt;
 ==6438== LEAK SUMMARY:&lt;br /&gt;
 ==6438==    definitely lost: 0 bytes in 0 blocks&lt;br /&gt;
 ==6438== &lt;br /&gt;
&lt;br /&gt;
Here it shows an invalid deallocation in the &amp;lt;code&amp;gt;free2&amp;lt;/code&amp;gt; function and the reason for that, because the block was already free&#039;d in the &amp;lt;code&amp;gt;free1&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
=== use-after-free ===&lt;br /&gt;
ex3-userAfterFree.c:&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 int* getIntPointer() {&lt;br /&gt;
     return (int*)malloc(sizeof(int));&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void free1(int* p) {&lt;br /&gt;
     free(p);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void setPointerValue(int* p, int value){&lt;br /&gt;
     *p = value;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
     int *p = getIntPointer();&lt;br /&gt;
     free1(p);&lt;br /&gt;
     setPointerValue(p, 42);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;heapusage -t use-after-free ./ex3&amp;lt;/code&amp;gt;:&lt;br /&gt;
 ==6458== Heapusage - https://github.com/d99kris/heapusage&lt;br /&gt;
 ==6458== &lt;br /&gt;
 ==6458== Invalid memory access at:&lt;br /&gt;
 ==6458==    at 0x00007fe4fb042520: __restore_rt (libc_sigaction.c:0)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc71b2: setPointerValue&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc71ee: main&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc70a5: _start&lt;br /&gt;
 ==6458==  Address 0x559a8d19b000 is 0 bytes inside a block of size 4 free&#039;d at:&lt;br /&gt;
 ==6458==    at 0x00007fe4fb3e9f4f: free (humain.cpp:188)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc7199: free1&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc71dd: main&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc70a5: _start&lt;br /&gt;
 ==6458==  Block was alloc&#039;d at:&lt;br /&gt;
 ==6458==    at 0x00007fe4fb3e9e5c: malloc (humain.cpp:175)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc717b: getIntPointer&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc71cd: main&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6458==    at 0x00007fe4fb029e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6458==    at 0x0000559a8cbc70a5: _start&lt;br /&gt;
 ==6458== &lt;br /&gt;
 ==6458== HEAP SUMMARY:&lt;br /&gt;
 ==6458==     in use at exit: 0 bytes in 0 blocks&lt;br /&gt;
 ==6458==   total heap usage: 1 allocs, 79 frees, 4 bytes allocated&lt;br /&gt;
 ==6458==    peak heap usage: 4 bytes allocated&lt;br /&gt;
 ==6458== &lt;br /&gt;
 ==6458== LEAK SUMMARY:&lt;br /&gt;
 ==6458==    definitely lost: 0 bytes in 0 blocks&lt;br /&gt;
 ==6458==&lt;br /&gt;
&lt;br /&gt;
The output looks similar to that of double-free, however in this case it now shows an invalid memory access instead of invalid deallocation. As before, it still shows where the block was free&#039;d before and where it was allocated in the first place.&lt;br /&gt;
&lt;br /&gt;
=== overflow ===&lt;br /&gt;
ex4-overflow.c:&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;string.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 char* getCharBuf(int size) {&lt;br /&gt;
     return (char*)malloc(size);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void setBufferText(char* buf, char* text) {&lt;br /&gt;
     strcpy(buf, text);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
     char* buf = getCharBuf(16);&lt;br /&gt;
     setBufferText(buf, &amp;quot;0123456789ABCDEF0123456789&amp;quot;);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;heapusage -t overflow ./ex4&amp;lt;/code&amp;gt;:&lt;br /&gt;
 ==6519== Heapusage - https://github.com/d99kris/heapusage&lt;br /&gt;
 ==6519== &lt;br /&gt;
 ==6519== Invalid memory access at:&lt;br /&gt;
 ==6519==    at 0x00007f978f842520: __restore_rt (libc_sigaction.c:0)&lt;br /&gt;
 ==6519==    at 0x00007f978f98b423: __strcpy_ssse3 (strcpy-ssse3.S:2568)&lt;br /&gt;
 ==6519==    at 0x000055717f4101ae: setBufferText&lt;br /&gt;
 ==6519==    at 0x000055717f4101e1: main&lt;br /&gt;
 ==6519==    at 0x00007f978f829d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6519==    at 0x00007f978f829e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6519==    at 0x000055717f4100a5: _start&lt;br /&gt;
 ==6519==  Address 0x55717fb4c000 is 0 bytes after a block of size 16 alloc&#039;d at:&lt;br /&gt;
 ==6519==    at 0x00007f978fb7ee5c: malloc (humain.cpp:175)&lt;br /&gt;
 ==6519==    at 0x000055717f410185: getCharBuf&lt;br /&gt;
 ==6519==    at 0x000055717f4101c7: main&lt;br /&gt;
 ==6519==    at 0x00007f978f829d90: __libc_start_call_main (libc_start_call_main.h:58)&lt;br /&gt;
 ==6519==    at 0x00007f978f829e40: __libc_start_main (libc-start.c:128)&lt;br /&gt;
 ==6519==    at 0x000055717f4100a5: _start&lt;br /&gt;
 ==6519== &lt;br /&gt;
 ==6519== HEAP SUMMARY:&lt;br /&gt;
 ==6519==     in use at exit: 16 bytes in 1 blocks&lt;br /&gt;
 ==6519==   total heap usage: 1 allocs, 78 frees, 16 bytes allocated&lt;br /&gt;
 ==6519==    peak heap usage: 16 bytes allocated&lt;br /&gt;
 ==6519== &lt;br /&gt;
 ==6519== LEAK SUMMARY:&lt;br /&gt;
 ==6519==    definitely lost: 16 bytes in 1 blocks&lt;br /&gt;
 ==6519==&lt;br /&gt;
&lt;br /&gt;
This output shows an invalid memory access, however, as opposed to before, this time it shows the error because &amp;lt;code&amp;gt;is 0 bytes after a block of size 16&amp;lt;/code&amp;gt;. Meaning the code tries to access the memory outside of the allocated memory range.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/d99kris/heapusage&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Hak5_Plunder_Bug&amp;diff=11735</id>
		<title>Hak5 Plunder Bug</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Hak5_Plunder_Bug&amp;diff=11735"/>
		<updated>2023-08-17T09:04:55Z</updated>

		<summary type="html">&lt;p&gt;LPutz: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:PlunderBug.jpg |thumb|right|600px||Plunder Bug]]&lt;br /&gt;
== Summary == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--This device is an Pocket sized LAN tap. This device can be used for passive eavesdropping and is small enough to be placed everywhere without being recognized.--&amp;gt;&lt;br /&gt;
The Plunder Bug by Hak5 is a LAN Tap device enabling interception and eavesdropping of data communicated through an Ethernet link. Its use cases are diverse, as it could be used as a diagnostic tool supporting troubleshooting in a network. If used for malicious purposes, such as sniffing attacks, it might prove itself effective because of its small form factor and therefore increasing the likelihood of being recognized. It is very easy to use and works out-of-the-box but offers only limited configurability. &lt;br /&gt;
== Description ==&lt;br /&gt;
[[File:PlunderBugTapping.jpg |thumb|right|600px||Plunder Bug Network Deployment]]&lt;br /&gt;
The Plunder Bug can be viewed as a simpler version of a [[Hak5 Packet Squirrel]]. It allows the user to tap network traffic and to access it for network scanning. &lt;br /&gt;
&lt;br /&gt;
=== Device ===&lt;br /&gt;
The device offers two Ethernet ports, each for one of the devices sharing a communication link that we want to sniff the traffic. A USB-C device is used for the attacker. Traffic coming through either of the Ethernet ports will get mirrored to the attacker.&lt;br /&gt;
&lt;br /&gt;
=== Deployment ===&lt;br /&gt;
&lt;br /&gt;
# Connect the Ethernet port of the victim machine with one of the two Ethernet Ports of the Plunder Bug with an short Ethernet cable.&lt;br /&gt;
# Connect the other  Ethernet port with the with the Ethernet cable which was previously plugged in the victim device.&lt;br /&gt;
# Power up the Plunder Bug by Connecting the USB-C female to USB-A male cable with an device which is under your control (preferably a raspberry pi with an battery shield).&lt;br /&gt;
&lt;br /&gt;
==== Plunder Bug Modes ====&lt;br /&gt;
[[File:Plunderbug_mute_unmute_process.png |thumb|right|600px||Plunder Bug Mute/Unmute Output]]&lt;br /&gt;
The only configurable parameter for the Plunder Bug is to run it either in a &amp;quot;muted&amp;quot; and &amp;quot;unmuted&amp;quot; mode. The Plunder Bug mirrors all network traffic and sends it to the USB-C port when operating in the muted mode. The unmuted mode gives extra capabilities compared to the muted mode. In addition to passively listening to traffic, the USB-C port is used for sending frames out on the link, effectively making it a small portable switch. This mode would also allow one to perform network scans from the attacking device. According to specification in [https://docs.hak5.org/hc/en-us/articles/360018810834-About-Mode-Switching-on-the-Plunder-Bug], the device is set to unmuted mode by default.&lt;br /&gt;
&lt;br /&gt;
To change between the Plunder Bug modes downlaod the shell script from [https://downloads.hak5.org/bug downloads.hak5.org]:&lt;br /&gt;
&lt;br /&gt;
Shell script usage:&lt;br /&gt;
* make it executable with &amp;lt;code&amp;gt; chmod +x ./plunderbug.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
* run the script as root or superuser:&lt;br /&gt;
&lt;br /&gt;
 ./plunderbug.sh [options]&lt;br /&gt;
 &lt;br /&gt;
 Options:&lt;br /&gt;
      --mute                 to use mute mode&lt;br /&gt;
      --unmute               to use unmuted mode&lt;br /&gt;
&lt;br /&gt;
=== Sniffing Data ===&lt;br /&gt;
The following will describe the necessary steps that are needed to sniff data from an Ethernet link.&lt;br /&gt;
==== Local Access ====&lt;br /&gt;
&lt;br /&gt;
If you can access the tapping device locally, open Wireshark and select the Ethernet interface from the Plunder Bug that is connected via the USB cable.&lt;br /&gt;
&lt;br /&gt;
==== Remote Access ====  &lt;br /&gt;
&#039;&#039;&#039;Sniffing Node&#039;&#039;&#039;&lt;br /&gt;
# Make sure that tcpdump and ssh-server is installed &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wireshark Machine&#039;&#039;&#039;&lt;br /&gt;
# Configure the SSH Remote capture Interface&lt;br /&gt;
# Server Tab:&lt;br /&gt;
## Enter IP&lt;br /&gt;
## Enter Port (usually 22)&lt;br /&gt;
# Server Tab:&lt;br /&gt;
## Enter Username &amp;amp; Password  &lt;br /&gt;
# Capture Tab:&lt;br /&gt;
## Enter Capturing Interface into Remote Interface&lt;br /&gt;
&lt;br /&gt;
==== Save TCP dumps ====&lt;br /&gt;
#Make sure tcpdump is installed&lt;br /&gt;
# Run tcpdump and log it into a file&lt;br /&gt;
 sudo tcpdump &amp;gt; tcplog.pcap&lt;br /&gt;
&lt;br /&gt;
=== Plunder Bug Usage Example ===&lt;br /&gt;
For this example, we placed the Plunder Bug in a test LAN Network as shown in the network schematic. &lt;br /&gt;
&lt;br /&gt;
[[File:PlunderBugExampleTypology.jpg |700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this example, we first perform a network scan with Nmap and then Sniffing data with wire shark.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Performing an Network scan&#039;&#039;&#039;&lt;br /&gt;
  sudo nmap -sP 192.168.1.0/24 -e eth1&lt;br /&gt;
&lt;br /&gt;
-sP option tries to resolve the hostname&lt;br /&gt;
&lt;br /&gt;
-e eth1 defines the Plunder Bug as operating Interface &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
  Starting Nmap 7.70 ( https://nmap.org ) at 2020-06-03 11:57 CEST&lt;br /&gt;
  Nmap scan report for 192.168.1.1&lt;br /&gt;
  Host is up (0.0035s latency).&lt;br /&gt;
  MAC Address: 00:18:4D:8F:53:0E (Netgear)&lt;br /&gt;
  Nmap scan report for 192.168.1.10&lt;br /&gt;
  Host is up (0.00022s latency).&lt;br /&gt;
  MAC Address: DC:A6:32:7D:13:C7 (Unknown)&lt;br /&gt;
  Nmap scan report for 192.168.1.11&lt;br /&gt;
  Host is up (0.00028s latency).&lt;br /&gt;
  MAC Address: DC:A6:32:7D:0C:17 (Unknown)&lt;br /&gt;
  Nmap done: 256 IP addresses (3 hosts up) scanned in 20.53 seconds&lt;br /&gt;
The output shows that 3 Hosts are online:&lt;br /&gt;
* 192.168.1.1 The Netgear Router&lt;br /&gt;
* 192.168.1.10 Raspberry Pi 1&lt;br /&gt;
* 192.168.1.11 Raspberry Pi 2&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. Sniff with Wireshark&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Wireshark gives us the following output if we sniff at the Plunder Bug Ethernet interface&lt;br /&gt;
&lt;br /&gt;
[[File:PlunderBugSniffing.png |600px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3. Plunder Bug as a Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The Plunder Bug has two Ethernet ports and one USB-C port. One of the Ethernet port and the USB-C port can be used as ordinary ethernet ports, as long as the second Ethernet port has access to the Internet. &lt;br /&gt;
&lt;br /&gt;
[[File:Plunderbug_Switch.png |600px||Plunder Bug as a Switch]]&lt;br /&gt;
&lt;br /&gt;
The only requirement for using the Plunder Bug as a Switch is to have the device in unmuted-mode, meaning the device connected via USB-C has the possibility to send packets through the Plunder Bug.&lt;br /&gt;
&lt;br /&gt;
=== Prevent Packet Sniffing ===&lt;br /&gt;
&lt;br /&gt;
It is nearly impossible to prevent sending mirrored packets to the attackers, but taking the ability away to read and understand the mirrored packets may achieve a more secure environment.&lt;br /&gt;
&lt;br /&gt;
[[File:Plunderbug_http_post_capture.png |600px]] &lt;br /&gt;
&lt;br /&gt;
Above, an packet with HTTP got captured with the Plunder Bug. Now, the Attacker has the possibilty to read the account credentials for the &amp;quot;testphp.vulweb.com&amp;quot; website, since an insecure protocol was used: HTTP. HTTP does not encrypt the payload, but instead it sends out the Form in plain text. This can be prevented by using HTTPS, which encryptes the data, as on the picture below. &lt;br /&gt;
&lt;br /&gt;
[[File:Plunderbug_https_tls_post.png |600px]] &lt;br /&gt;
&lt;br /&gt;
Also, the user has the possibility to use VPN to protect itself against packet sniffing, since every sent-out packet will be encrypted, therefore taking away the attacker&#039;s ability to read and understand the captured packages.&lt;br /&gt;
&lt;br /&gt;
== Plunder Bug Android App ==&lt;br /&gt;
&lt;br /&gt;
As an attacker, to be more inconspicuous, it is possible to connect and sniff packets via an android mobile phone. The App &amp;quot;Plunder Bug - Smart LAN Tap&amp;quot; needs to be installed to fullfil this requirement, which can be found on the Google Play Store. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&lt;br /&gt;
# Have an Android Phone&lt;br /&gt;
# Android Phone needs to be rooted (since root permissions are needed)&lt;br /&gt;
# Install the Application &amp;quot;Plunder Bug&amp;quot;&lt;br /&gt;
# USB-C to USB-C Cable (since newest Android Phones have USB-C Ports)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Steps to sniff packets&#039;&#039;&#039;&lt;br /&gt;
# Setup the Environment&lt;br /&gt;
&lt;br /&gt;
Setup the Environment for the Plunder Bug: Connect the Ethernet Port of the victim&#039;s machine with one of the Ethernet port of the Plunder Bug and use the previous plugged Ethernet cable to connect with the other Ethernet port of the Plunder Bug. Now, get the USB-C to USB-C cable and connect to the Android device.&lt;br /&gt;
&lt;br /&gt;
# Start the App and record packets&lt;br /&gt;
&lt;br /&gt;
The app should recognize the plugged-in Plunder Bug and should give you the opportunity to start recording packets.&lt;br /&gt;
&lt;br /&gt;
[[File:Plunderbug_app_start_recording.png |200px]]&lt;br /&gt;
&lt;br /&gt;
Start capturing the packets by clicking on the turquoise button below.&lt;br /&gt;
&lt;br /&gt;
[[File:Plunderbug_app_recording.png |200px]]&lt;br /&gt;
&lt;br /&gt;
On the screen, some statistics can be found. It displayes the numbers of packets the Plunder Bug has captured and the time ellapsed since the packet recording has started. To stop recording the packets, press on the right button below to save the recored packets in a pcap file. The saved files can be found under the register &amp;quot;Files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:Plunderbug_app_files_overview.png |200px]] &lt;br /&gt;
&lt;br /&gt;
After clicking on the pcap file, the statistics can be found once again and the user has the opportunity to share the file. Normally, the user saves the pcap file to later view the captured packages on Wireshark (or on any other Application, which has the possibility to read pcap files). &lt;br /&gt;
&lt;br /&gt;
[[File:Plunderbug_app_pcap_statistics.png |200px]] &lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Plunder Bug]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://docs.hak5.org/hc/en-us/categories/360001482953-Plunder-Bug&lt;br /&gt;
* S. Ansari, S. G. Rajeev and H. S. Chandrashekar, &amp;quot;Packet sniffing: a brief introduction,&amp;quot; in IEEE Potentials, vol. 21, no. 5, pp. 17-19, Dec. 2002-Jan. 2003, doi: 10.1109/MP.2002.1166620.&lt;br /&gt;
[[Category:Pentesting]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Throwing_Star_LAN_Tap&amp;diff=11732</id>
		<title>Throwing Star LAN Tap</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Throwing_Star_LAN_Tap&amp;diff=11732"/>
		<updated>2023-08-17T08:51:05Z</updated>

		<summary type="html">&lt;p&gt;LPutz: /* Device - Editions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This description shows what the [https://greatscottgadgets.com/throwingstar/ Throwing Star LAN Tap] device is and how it can be used. Further information is given when the thorough explanation requires it.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
To use this device for traffic sniffing, the following things are needed:&lt;br /&gt;
* Throwing Star LAN Tap Kit (assembled) or Pro edition&lt;br /&gt;
* Wired LAN network, where the LAN sniffing device can be installed&lt;br /&gt;
* Device with RJ45 Ethernet port as monitoring device&lt;br /&gt;
* Wireshark running on the monitoring device for capturing the traffic&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
[[File:Throwingstarlantapkit1.png|thumb|500px|frame|Throwing Star LAN Tap Kit with highlighted connectors for assembling]]&lt;br /&gt;
&lt;br /&gt;
[[File:Throwingstarlantappro.jpeg|thumb|500px|frame|Throwing Star LAN Tap Pro]]&lt;br /&gt;
&lt;br /&gt;
LAN Taps are integrated in the existing network and are used to monitor the network, because all traffic/packets coming into and going out of the network can be inspected using sniffing programs such as [https://www.wireshark.org/ WireShark].&lt;br /&gt;
The Throwing Star LAN Tap is a passive Ethernet tap that needs no power for working. &lt;br /&gt;
&lt;br /&gt;
=== Device - Editions ===&lt;br /&gt;
&lt;br /&gt;
There are two editions: the Kit ([[Throwing Star LAN Tap Kit]]), which you must assemble yourself and solder to work, and the Pro Edition ([[Throwing Star LAN Tap Pro]]). The device itself is the same.&lt;br /&gt;
* The Kit is a circuit board printed as star shaped with four RJ-45 (Ethernet) connectors and two 220pF capacitors that must be placed on the board.&lt;br /&gt;
* The Pro Edition is the second option, where the electrical components are already soldered and prepared for easier usage and the device fully assembled.&lt;br /&gt;
&lt;br /&gt;
==== Assembly of the Throwing Star LAN Tap Kit ====&lt;br /&gt;
&lt;br /&gt;
To assemble the Throwing Star LAN Tap Kit, the following steps must be taken:&lt;br /&gt;
* The four modular RJ-45 connectors are inserted into the circuit board at J1 - J4.&lt;br /&gt;
* The two capacitors are inserted into the C1 and C2 slots at the J3 and J4 monitoring ports.&lt;br /&gt;
* If the assembly is done permanently, the eight leads of each connector and both leads of each capacitor must be soldered carefully.&lt;br /&gt;
* After the assembly is done, the Throwing Star LAN Tap is connected by Ethernet cables in line with the target network at J1 and J2.&lt;br /&gt;
* One or both of the monitoring ports J3 and J4 are connected with Ethernet cables to one or two monitoring devices.&lt;br /&gt;
* To capture the network traffic, a software such as WireShark or tcptump is used on the monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Installation of the device in the LAN network ===&lt;br /&gt;
&lt;br /&gt;
The following figure shows how the LAN traffic sniffing device can be implemented into the existing LAN network. From here on out, it does not matter whether the Kit or Pro edition is used - both work the same.&lt;br /&gt;
The sniffing device, in this example, is placed between the switch and the target computer. The traffic runs through the device (ports J1 and J2). The monitoring notebook is connected to the monitoring port J4 of the Throwing Star LAN Tap Pro.&lt;br /&gt;
&lt;br /&gt;
[[File:Networkthrowingstar.png|none|100px|frame|Network, where the Throwing Star LAN Tap is installed]]&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Performing different tasks on the target computer ===&lt;br /&gt;
&lt;br /&gt;
For capturing various packets, several different kinds of programs and usages were performed on the target computer, which are listed in the following points:&lt;br /&gt;
* Browser Usage with HTTP-websites&lt;br /&gt;
* Browser Usage with HTTPS-websites&lt;br /&gt;
* VPN Connection&lt;br /&gt;
* Checking emails with Outlook in the browser&lt;br /&gt;
* Watching videos in the browser (https-websites)&lt;br /&gt;
* Printing PDFs on the connected printer in the network&lt;br /&gt;
* Listening to music with Spotify&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Analyse results in Wireshark on the monitoring device ===&lt;br /&gt;
&lt;br /&gt;
==== Introduction ====&lt;br /&gt;
&lt;br /&gt;
Nowadays, every secure website uses HTTPS for communication over a computer network. It is also called HTTP over TLS, because the communication protocol is encrypted using TLS (Transport Layer Security). The packets&lt;br /&gt;
that are captured in Wireshark need to be inspected properly and in detail, because packet analysis is more complex since most internet traffic is encrypted and applications commonly use encryption based on TLS as well. Only if the HTTP-protocol is used, the information can be sniffed easier. &lt;br /&gt;
As an example, data/information that is shown in the Wireshark captures for TCP communication with HTTPS on top. These are one of the most important protocols for the mentioned use-cases described in Step 2.&lt;br /&gt;
&lt;br /&gt;
* Source IP and Destination IP&lt;br /&gt;
* Source Port and Destination Port&lt;br /&gt;
* Source MAC and Destination MAC&lt;br /&gt;
* Round Trip Time (RTT) between client and server&lt;br /&gt;
* Time to live (TTL) - which indicates the hops between client and server&lt;br /&gt;
* TCP windows and flags&lt;br /&gt;
* Sessions&lt;br /&gt;
* Packets, Data, Payload&lt;br /&gt;
* Retransmissions&lt;br /&gt;
&lt;br /&gt;
Getting this basic metadata, which actually provides information about other data, with the Throwing Star LAN Tap is really powerful, because today, data is everything. Algorithms and systems can be used to extract insights and knowledge from this unstructured and structured data. Implementing the sniffing device (Throwing Star LAN Tap Kit or Pro edition) in corporate networks provides powerful information about companies, their whereabouts, knowledge, views and a lot more. Extracting useful information from the data is very important for data mining, which can give companies competitive advantages through statistics and predictions on basis of the given data.&lt;br /&gt;
&lt;br /&gt;
==== Example Results ====&lt;br /&gt;
&lt;br /&gt;
The following figures show examples of which kind of information can be sniffed with the Throwing Star LAN Tap. The target computer has the IP-address 192.168.0.122. The screenshots are taken from the Wireshark capture of the monitoring device. The first example shows what kind of things are possible to see, if the HTTP-protocol is used. The login data can be read in cleartext, which is marked together with the host with a yellow rectangle.&lt;br /&gt;
&lt;br /&gt;
[[File:throwingstarlansniff1.png|none|200px|frame|Wireshark capture using the Throwing Star LAN Tap - Login to a HTTP-Website]]&lt;br /&gt;
&lt;br /&gt;
The second packet capture example of Wireshark in the following figure shows that a document was printed on the printer, which is available in the Local Area Network (LAN). The document name can be seen in cleartext in the Wireshark packet capture, highlighted with a yellow rectangle.&lt;br /&gt;
&lt;br /&gt;
[[File:throwingstarlansniff2.png|none|200px|frame|Wireshark capture using the Throwing Star LAN Tap Pro - Document printed on the LAN printer]]&lt;br /&gt;
&lt;br /&gt;
==== Summary of the important aspects ====&lt;br /&gt;
&lt;br /&gt;
All captured packets in Wireshark provide data like the listed points given in step 2 above for TCP with HTTPS on top. It is important to mention that the most data can be seen during connection/3-way-handshake or at the beginning&lt;br /&gt;
of a session or transaction. After the initiation process and data starts flowing, only the payload can be seen, which does not provide more than encrypted payload packets with source and destination, length/size and the used protocol. As an example, for a network administrator it is possible to use data such as Source/Destination IP, Source/Destination MAC and the protocols to easily comprehend what the devices or users in the target network are up to and with whom they are communicating. It is important to remember that nowadays several protocols in use ensure security for the packets sent over a network. Therefore, traffic sniffing by using a device such as the Throwing Star LAN Tap becomes more difficult with Wireshark, but it is still possible to see loads of information and metadata. These can be used to inspect and learn a lot about the target network and are really powerful to a network administrator&lt;br /&gt;
or for illegally obtained access to the network from a hacker. With a high number of IoT devices connected to a Local Area Network via Ethernet, the Throwing Star LAN Tap can be used very successfully by installing it in the&lt;br /&gt;
right place in the network, for example between the switch and router. If all IoT devices are directly connected to the switch, all traffic that is sent to the router can be sniffed on the monitoring port, without any of the IoT devices knowing about this. For network administrators this can be a very powerful tool to find flaws and problems or inspect the network in detail.&lt;br /&gt;
&lt;br /&gt;
== Important Take-Aways ==&lt;br /&gt;
&lt;br /&gt;
* The Throwing Star LAN Tap is a device for passive LAN traffic sniffing and is a really powerful tool for network administrators. &lt;br /&gt;
&lt;br /&gt;
* Nowadays, several protocols in use ensure security for the packets sent over a network. Traffic sniffing therefore becomes more difficult with Wireshark, but it is still possible to see loads of information and metadata. Stealing confidential data is not the primary goal nowadays. &lt;br /&gt;
&lt;br /&gt;
* Algorithms and systems can be used to extract insights and knowledge from these unstructured and structured data. Extracting useful information from this data is very important for data mining, which can give companies competitive advantages through statistics and predictions on basis of the given data.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Throwing Star LAN Tap Kit]]&lt;br /&gt;
&lt;br /&gt;
[[Throwing Star LAN Tap Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://greatscottgadgets.com/throwingstar/&lt;br /&gt;
&lt;br /&gt;
* https://www.wireshark.org/&lt;br /&gt;
&lt;br /&gt;
* https://greatscottgadgets.com/throwingstar/throwing-star-instructions.pdf&lt;br /&gt;
&lt;br /&gt;
* https://github.com/greatscottgadgets/throwing-star-lan-tap&lt;br /&gt;
&lt;br /&gt;
* https://schwartzdaniel.com/5-useful-tips-for-analyzing-wireshark-packet-captures/&lt;br /&gt;
&lt;br /&gt;
* https://accedian.com/blog/how-to-decrypt-an-https-exchange-with-wireshark/&lt;br /&gt;
&lt;br /&gt;
* https://www.youtube.com/watch?v=3zUsJm3bwGY&amp;amp;ab_channel=Hak5&lt;br /&gt;
&lt;br /&gt;
* Hessel Schut, Mark Scanlon, Jason Farina, and Nhien-An Le-Khac. Towards the Forensic Identification and Investigation of Cloud Hosted Servers through Non-Invasive Wiretaps. 08/2015&lt;br /&gt;
&lt;br /&gt;
* V. Ribeiro, A. Rocha, R. Peixoto, F. Portela, and M. F. Santos. Importance of statistics for data mining and data science. In 2017. 5th International Conference on Future Internet of Things and Cloud Workshops (FiCloudW), pages 156-163, 2017.&lt;br /&gt;
&lt;br /&gt;
[[Category:Pentesting]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Segger_J-Link:_JTAG_Usage&amp;diff=11605</id>
		<title>Segger J-Link: JTAG Usage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Segger_J-Link:_JTAG_Usage&amp;diff=11605"/>
		<updated>2023-04-20T12:45:14Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation describes the steps necessary to use the [[Segger J-Link V8]] to connect to a device using JTAG. In this example, a BeagleBoard® https://www.beagleboard.org/boards/beagleboard is used.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Target JTAG Device (e.g. BeagleBoard®)&lt;br /&gt;
* Compatible cable to connect the target&#039;s JTAG pins to the J-Link&lt;br /&gt;
** J-Link uses a standard 20-Pin connector compatible to ARM&#039;s Multi-ICE.&lt;br /&gt;
* Software: J-Link Software and Documentation pack https://www.segger.com/downloads/jlink/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Connect J-Link to PC ===&lt;br /&gt;
&lt;br /&gt;
Connect the Segger J-Link to the PC using the included cable and start the J-Link Commander.&lt;br /&gt;
Upon successful detection of the J-Link, a message like the following is shown:&lt;br /&gt;
&lt;br /&gt;
 SEGGER J-Link Commander V7.86f (Compiled Mar 29 2023 16:41:57)&lt;br /&gt;
 DLL version V7.86f, compiled Mar 29 2023 16:39:17&lt;br /&gt;
 &lt;br /&gt;
 Connecting to J-Link via USB...O.K.&lt;br /&gt;
 Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46&lt;br /&gt;
 Hardware version: V8.00&lt;br /&gt;
 J-Link uptime (since boot): N/A (Not supported by this model)&lt;br /&gt;
 S/N: 788529685&lt;br /&gt;
 License(s): RDI,FlashDL,FlashBP,JFlash,GDB&lt;br /&gt;
 VTref=3.313V&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Type &amp;quot;connect&amp;quot; to establish a target connection, &#039;?&#039; for help&lt;br /&gt;
 J-Link&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Connect J-Link to target device ===&lt;br /&gt;
&lt;br /&gt;
Connect the J-Link to the target device&#039;s JTAG pins using an appropriate cable.&lt;br /&gt;
&lt;br /&gt;
In this example, such a cable to connect to the BeagleBoard was not available. Therefore, the pins have been connected manually in the following way:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|- style=&amp;quot;font-weight:bold;&amp;quot;&lt;br /&gt;
! BeagleBoard&lt;br /&gt;
! J-Link&lt;br /&gt;
|-&lt;br /&gt;
| 1 - TMS&lt;br /&gt;
| 7 - TMS&lt;br /&gt;
|-&lt;br /&gt;
| 2 - nTRST&lt;br /&gt;
| 3 - nTRST&lt;br /&gt;
|-&lt;br /&gt;
| 3 - TDI&lt;br /&gt;
| 5 - TDI&lt;br /&gt;
|-&lt;br /&gt;
| 4 - GND&lt;br /&gt;
| 4 - GND&lt;br /&gt;
|-&lt;br /&gt;
| 5 - VIO&lt;br /&gt;
| 1 - VTref&lt;br /&gt;
|-&lt;br /&gt;
| 7 - TDO&lt;br /&gt;
| 13 - TDO&lt;br /&gt;
|-&lt;br /&gt;
| 9 - RTCK&lt;br /&gt;
| 11 - RTCK&lt;br /&gt;
|-&lt;br /&gt;
| 11 - TCK&lt;br /&gt;
| 9 - TCK&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The other pins were not connected.&lt;br /&gt;
&lt;br /&gt;
See https://beagleboard.org/static/BBSRM_latest.pdf (Page 112) for more information about the BeagleBoard&#039;s JTAG connector.&lt;br /&gt;
&lt;br /&gt;
Information about the J-Link&#039;s pins can be found here: https://www.segger.com/products/debug-probes/j-link/technology/interface-description&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Connect using J-Link Commander ===&lt;br /&gt;
&lt;br /&gt;
J-Link supports many different devices/CPUs already. The BeagleBoard however requires a custom configuration script which can be found here: https://github.com/nullsub/sidplayer/blob/master/jlinkserver/Samples/JLink/Scripts/ScriptBeagleBoard_OMAP3530.JLinkScript&lt;br /&gt;
&lt;br /&gt;
This script requires a little modification before it can be used. Some variables are declared as type &amp;lt;code&amp;gt;__int64&amp;lt;/code&amp;gt;. This type was only available up to version 6.16 of the J-Link Software. For the usage in newer version it can be replaced with &amp;lt;code&amp;gt;U32&amp;lt;/code&amp;gt;. Although the name &amp;lt;code&amp;gt;__int64&amp;lt;/code&amp;gt; might suggest that it stores 64-bit values, according to https://forum.segger.com/index.php/Thread/4189-SOLVED-JLinkScript-and-int64/?postID=15018#post15018 it was internally handled as 32-bit, so these changes should have no effect on the script.&lt;br /&gt;
&lt;br /&gt;
The modified script has to be saved in the installation directory as &amp;lt;code&amp;gt;Default.JLinkScript&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Power the target device and connect the J-Link to the PC (if not already connected) and start the J-Link Commander. An output similar to the one shown in Step 1 should be shown again. Type &amp;lt;code&amp;gt;connect&amp;lt;/code&amp;gt; and then specify the target device / core. For the BeagleBoard type &amp;lt;code&amp;gt;CORTEX-A8&amp;lt;/code&amp;gt;. For the other settings keep the default values. After connecting it is possible to run commands like &amp;lt;code&amp;gt;halt&amp;lt;/code&amp;gt; to halt the cpu, &amp;lt;code&amp;gt;go&amp;lt;/code&amp;gt; to resume, etc. A list of commands can be found by typing &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Segger J-Link V8]]&lt;br /&gt;
* BeagleBoard® https://www.beagleboard.org/boards/beagleboard&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* https://beagleboard.org/static/BBSRM_latest.pdf&lt;br /&gt;
* https://www.segger.com/products/debug-probes/j-link/technology/interface-description/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Segger_J-Link:_JTAG_Usage&amp;diff=11604</id>
		<title>Segger J-Link: JTAG Usage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Segger_J-Link:_JTAG_Usage&amp;diff=11604"/>
		<updated>2023-04-20T12:44:20Z</updated>

		<summary type="html">&lt;p&gt;LPutz: /* Step 3 - Connect using J-Link Commander */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation describes the steps necessary to use the [[Segger J-Link V8]] to connect to a device using JTAG. In this example, a BeagleBoard® https://www.beagleboard.org/boards/beagleboard is used.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Target JTAG Device (e.g. BeagleBoard®)&lt;br /&gt;
* Compatible cable to connect the target&#039;s JTAG pins to the J-Link&lt;br /&gt;
** J-Link uses a standard 20-Pin connector compatible to ARM&#039;s Multi-ICE.&lt;br /&gt;
* Software: J-Link Software and Documentation pack https://www.segger.com/downloads/jlink/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Connect J-Link to PC ===&lt;br /&gt;
&lt;br /&gt;
Connect the Segger J-Link to the PC using the included cable and start the J-Link Commander.&lt;br /&gt;
Upon successful detection of the J-Link, a message like the following is shown:&lt;br /&gt;
&lt;br /&gt;
SEGGER J-Link Commander V7.86f (Compiled Mar 29 2023 16:41:57)&lt;br /&gt;
DLL version V7.86f, compiled Mar 29 2023 16:39:17&lt;br /&gt;
&lt;br /&gt;
 Connecting to J-Link via USB...O.K.&lt;br /&gt;
 Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46&lt;br /&gt;
 Hardware version: V8.00&lt;br /&gt;
 J-Link uptime (since boot): N/A (Not supported by this model)&lt;br /&gt;
 S/N: 788529685&lt;br /&gt;
 License(s): RDI,FlashDL,FlashBP,JFlash,GDB&lt;br /&gt;
 VTref=3.313V&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Type &amp;quot;connect&amp;quot; to establish a target connection, &#039;?&#039; for help&lt;br /&gt;
 J-Link&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Connect J-Link to target device ===&lt;br /&gt;
&lt;br /&gt;
Connect the J-Link to the target device&#039;s JTAG pins using an appropriate cable.&lt;br /&gt;
&lt;br /&gt;
In this example, such a cable to connect to the BeagleBoard was not available. Therefore, the pins have been connected manually in the following way:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|- style=&amp;quot;font-weight:bold;&amp;quot;&lt;br /&gt;
! BeagleBoard&lt;br /&gt;
! J-Link&lt;br /&gt;
|-&lt;br /&gt;
| 1 - TMS&lt;br /&gt;
| 7 - TMS&lt;br /&gt;
|-&lt;br /&gt;
| 2 - nTRST&lt;br /&gt;
| 3 - nTRST&lt;br /&gt;
|-&lt;br /&gt;
| 3 - TDI&lt;br /&gt;
| 5 - TDI&lt;br /&gt;
|-&lt;br /&gt;
| 4 - GND&lt;br /&gt;
| 4 - GND&lt;br /&gt;
|-&lt;br /&gt;
| 5 - VIO&lt;br /&gt;
| 1 - VTref&lt;br /&gt;
|-&lt;br /&gt;
| 7 - TDO&lt;br /&gt;
| 13 - TDO&lt;br /&gt;
|-&lt;br /&gt;
| 9 - RTCK&lt;br /&gt;
| 11 - RTCK&lt;br /&gt;
|-&lt;br /&gt;
| 11 - TCK&lt;br /&gt;
| 9 - TCK&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The other pins were not connected.&lt;br /&gt;
&lt;br /&gt;
See https://beagleboard.org/static/BBSRM_latest.pdf (Page 112) for more information about the BeagleBoard&#039;s JTAG connector.&lt;br /&gt;
&lt;br /&gt;
Information about the J-Link&#039;s pins can be found here: https://www.segger.com/products/debug-probes/j-link/technology/interface-description&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Connect using J-Link Commander ===&lt;br /&gt;
&lt;br /&gt;
J-Link supports many different devices/CPUs already. The BeagleBoard however requires a custom configuration script which can be found here: https://github.com/nullsub/sidplayer/blob/master/jlinkserver/Samples/JLink/Scripts/ScriptBeagleBoard_OMAP3530.JLinkScript&lt;br /&gt;
&lt;br /&gt;
This script requires a little modification before it can be used. Some variables are declared as type &amp;lt;code&amp;gt;__int64&amp;lt;/code&amp;gt;. This type was only available up to version 6.16 of the J-Link Software. For the usage in newer version it can be replaced with &amp;lt;code&amp;gt;U32&amp;lt;/code&amp;gt;. Although the name &amp;lt;code&amp;gt;__int64&amp;lt;/code&amp;gt; might suggest that it stores 64-bit values, according to https://forum.segger.com/index.php/Thread/4189-SOLVED-JLinkScript-and-int64/?postID=15018#post15018 it was internally handled as 32-bit, so these changes should have no effect on the script.&lt;br /&gt;
&lt;br /&gt;
The modified script has to be saved in the installation directory as &amp;lt;code&amp;gt;Default.JLinkScript&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Power the target device and connect the J-Link to the PC (if not already connected) and start the J-Link Commander. An output similar to the one shown in Step 1 should be shown again. Type &amp;lt;code&amp;gt;connect&amp;lt;/code&amp;gt; and then specify the target device / core. For the BeagleBoard type &amp;lt;code&amp;gt;CORTEX-A8&amp;lt;/code&amp;gt;. For the other settings keep the default values. After connecting it is possible to run commands like &amp;lt;code&amp;gt;halt&amp;lt;/code&amp;gt; to halt the cpu, &amp;lt;code&amp;gt;go&amp;lt;/code&amp;gt; to resume, etc. A list of commands can be found by typing &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Segger J-Link V8]]&lt;br /&gt;
* BeagleBoard® https://www.beagleboard.org/boards/beagleboard&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* https://beagleboard.org/static/BBSRM_latest.pdf&lt;br /&gt;
* https://www.segger.com/products/debug-probes/j-link/technology/interface-description/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Segger_J-Link:_JTAG_Usage&amp;diff=11603</id>
		<title>Segger J-Link: JTAG Usage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Segger_J-Link:_JTAG_Usage&amp;diff=11603"/>
		<updated>2023-04-20T12:28:40Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation describes the steps necessary to use the [[Segger J-Link V8]] to connect to a device using JTAG. In this example, a BeagleBoard® https://www.beagleboard.org/boards/beagleboard is used.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Target JTAG Device (e.g. BeagleBoard®)&lt;br /&gt;
* Compatible cable to connect the target&#039;s JTAG pins to the J-Link&lt;br /&gt;
** J-Link uses a standard 20-Pin connector compatible to ARM&#039;s Multi-ICE.&lt;br /&gt;
* Software: J-Link Software and Documentation pack https://www.segger.com/downloads/jlink/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Connect J-Link to PC ===&lt;br /&gt;
&lt;br /&gt;
Connect the Segger J-Link to the PC using the included cable and start the J-Link Commander.&lt;br /&gt;
Upon successful detection of the J-Link, a message like the following is shown:&lt;br /&gt;
&lt;br /&gt;
SEGGER J-Link Commander V7.86f (Compiled Mar 29 2023 16:41:57)&lt;br /&gt;
DLL version V7.86f, compiled Mar 29 2023 16:39:17&lt;br /&gt;
&lt;br /&gt;
 Connecting to J-Link via USB...O.K.&lt;br /&gt;
 Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46&lt;br /&gt;
 Hardware version: V8.00&lt;br /&gt;
 J-Link uptime (since boot): N/A (Not supported by this model)&lt;br /&gt;
 S/N: 788529685&lt;br /&gt;
 License(s): RDI,FlashDL,FlashBP,JFlash,GDB&lt;br /&gt;
 VTref=3.313V&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Type &amp;quot;connect&amp;quot; to establish a target connection, &#039;?&#039; for help&lt;br /&gt;
 J-Link&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Connect J-Link to target device ===&lt;br /&gt;
&lt;br /&gt;
Connect the J-Link to the target device&#039;s JTAG pins using an appropriate cable.&lt;br /&gt;
&lt;br /&gt;
In this example, such a cable to connect to the BeagleBoard was not available. Therefore, the pins have been connected manually in the following way:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|- style=&amp;quot;font-weight:bold;&amp;quot;&lt;br /&gt;
! BeagleBoard&lt;br /&gt;
! J-Link&lt;br /&gt;
|-&lt;br /&gt;
| 1 - TMS&lt;br /&gt;
| 7 - TMS&lt;br /&gt;
|-&lt;br /&gt;
| 2 - nTRST&lt;br /&gt;
| 3 - nTRST&lt;br /&gt;
|-&lt;br /&gt;
| 3 - TDI&lt;br /&gt;
| 5 - TDI&lt;br /&gt;
|-&lt;br /&gt;
| 4 - GND&lt;br /&gt;
| 4 - GND&lt;br /&gt;
|-&lt;br /&gt;
| 5 - VIO&lt;br /&gt;
| 1 - VTref&lt;br /&gt;
|-&lt;br /&gt;
| 7 - TDO&lt;br /&gt;
| 13 - TDO&lt;br /&gt;
|-&lt;br /&gt;
| 9 - RTCK&lt;br /&gt;
| 11 - RTCK&lt;br /&gt;
|-&lt;br /&gt;
| 11 - TCK&lt;br /&gt;
| 9 - TCK&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The other pins were not connected.&lt;br /&gt;
&lt;br /&gt;
See https://beagleboard.org/static/BBSRM_latest.pdf (Page 112) for more information about the BeagleBoard&#039;s JTAG connector.&lt;br /&gt;
&lt;br /&gt;
Information about the J-Link&#039;s pins can be found here: https://www.segger.com/products/debug-probes/j-link/technology/interface-description&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Connect using J-Link Commander ===&lt;br /&gt;
&lt;br /&gt;
J-Link supports many different devices/CPUs already. The BeagleBoard however requires a custom configuration script which can be found here: https://github.com/nullsub/sidplayer/blob/master/jlinkserver/Samples/JLink/Scripts/ScriptBeagleBoard_OMAP3530.JLinkScript&lt;br /&gt;
&lt;br /&gt;
This script requires a little modification before it can be used. Some variables are declared as type __int64. This type was only available up to version 6.16 of the J-Link Software. For the usage in newer version it can be replaced with U32. Although the name __int64 might suggest that it stores 64-bit values, according to https://forum.segger.com/index.php/Thread/4189-SOLVED-JLinkScript-and-int64/?postID=15018#post15018 it was internally handled as 32-bit, so these changes should have no effect on the script.&lt;br /&gt;
&lt;br /&gt;
The modified script has to be saved in the installation directory as &amp;quot;Default.JLinkScript&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Segger J-Link V8]]&lt;br /&gt;
* BeagleBoard® https://www.beagleboard.org/boards/beagleboard&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* https://beagleboard.org/static/BBSRM_latest.pdf&lt;br /&gt;
* https://www.segger.com/products/debug-probes/j-link/technology/interface-description/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Segger_J-Link:_JTAG_Usage&amp;diff=11602</id>
		<title>Segger J-Link: JTAG Usage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Segger_J-Link:_JTAG_Usage&amp;diff=11602"/>
		<updated>2023-04-20T11:56:42Z</updated>

		<summary type="html">&lt;p&gt;LPutz: Created page with &amp;quot;== Summary ==   This documentation describes the steps necessary to use the Segger J-Link V8 to connect to a device using JTAG. In this example, a BeagleBoard® https://www.beagleboard.org/boards/beagleboard is used.  == Requirements ==  * Target JTAG Device (e.g. BeagleBoard®) * Compatible cable to connect the target&amp;#039;s JTAG pins to the J-Link ** J-Link uses a standard 20-Pin connector compatible to ARM&amp;#039;s Multi-ICE. * Software: J-Link Software and Documentation pack...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation describes the steps necessary to use the [[Segger J-Link V8]] to connect to a device using JTAG. In this example, a BeagleBoard® https://www.beagleboard.org/boards/beagleboard is used.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Target JTAG Device (e.g. BeagleBoard®)&lt;br /&gt;
* Compatible cable to connect the target&#039;s JTAG pins to the J-Link&lt;br /&gt;
** J-Link uses a standard 20-Pin connector compatible to ARM&#039;s Multi-ICE.&lt;br /&gt;
* Software: J-Link Software and Documentation pack https://www.segger.com/downloads/jlink/&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Connect J-Link to PC ===&lt;br /&gt;
&lt;br /&gt;
Connect the Segger J-Link to the PC using the included cable and start the J-Link Commander.&lt;br /&gt;
Upon successful detection of the J-Link, a message like the following is shown:&lt;br /&gt;
&lt;br /&gt;
SEGGER J-Link Commander V7.86f (Compiled Mar 29 2023 16:41:57)&lt;br /&gt;
DLL version V7.86f, compiled Mar 29 2023 16:39:17&lt;br /&gt;
&lt;br /&gt;
 Connecting to J-Link via USB...O.K.&lt;br /&gt;
 Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46&lt;br /&gt;
 Hardware version: V8.00&lt;br /&gt;
 J-Link uptime (since boot): N/A (Not supported by this model)&lt;br /&gt;
 S/N: 788529685&lt;br /&gt;
 License(s): RDI,FlashDL,FlashBP,JFlash,GDB&lt;br /&gt;
 VTref=3.313V&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Type &amp;quot;connect&amp;quot; to establish a target connection, &#039;?&#039; for help&lt;br /&gt;
 J-Link&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Connect J-Link to target device ===&lt;br /&gt;
&lt;br /&gt;
Connect the J-Link to the target device&#039;s JTAG pins using an appropriate cable.&lt;br /&gt;
&lt;br /&gt;
In this example, such a cable to connect to the BeagleBoard was not available. Therefore, the pins have been connected manually in the following way:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|- style=&amp;quot;font-weight:bold;&amp;quot;&lt;br /&gt;
! BeagleBoard&lt;br /&gt;
! J-Link&lt;br /&gt;
|-&lt;br /&gt;
| 1 - TMS&lt;br /&gt;
| 7 - TMS&lt;br /&gt;
|-&lt;br /&gt;
| 2 - nTRST&lt;br /&gt;
| 3 - nTRST&lt;br /&gt;
|-&lt;br /&gt;
| 3 - TDI&lt;br /&gt;
| 5 - TDI&lt;br /&gt;
|-&lt;br /&gt;
| 4 - GND&lt;br /&gt;
| 4 - GND&lt;br /&gt;
|-&lt;br /&gt;
| 5 - VIO&lt;br /&gt;
| 1 - VTref&lt;br /&gt;
|-&lt;br /&gt;
| 7 - TDO&lt;br /&gt;
| 13 - TDO&lt;br /&gt;
|-&lt;br /&gt;
| 9 - RTCK&lt;br /&gt;
| 11 - RTCK&lt;br /&gt;
|-&lt;br /&gt;
| 11 - TCK&lt;br /&gt;
| 9 - TCK&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The other pins were not connected.&lt;br /&gt;
&lt;br /&gt;
See https://beagleboard.org/static/BBSRM_latest.pdf (Page 112) for more information about the BeagleBoard&#039;s JTAG connector.&lt;br /&gt;
&lt;br /&gt;
Information about the J-Link&#039;s pins can be found here: https://www.segger.com/products/debug-probes/j-link/technology/interface-description&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Segger J-Link V8]]&lt;br /&gt;
* BeagleBoard® https://www.beagleboard.org/boards/beagleboard&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Attify_Badge_IoT_Hacking_Device_Usage&amp;diff=11596</id>
		<title>Attify Badge IoT Hacking Device Usage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Attify_Badge_IoT_Hacking_Device_Usage&amp;diff=11596"/>
		<updated>2023-03-31T15:15:35Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
The [[Attify Badge IoT Hacking Device]] is a hardware security assessment tool created by Attify that is used to communicate between a PC and an embedded device using various hardware communication protocols. The device was initially built to aid in pentests for IoT devices, but the immense potential was soon recognized.&lt;br /&gt;
The Attify Badge uses an FTDI chip that can speak a wide variety of communication protocols and standards such as UART, SPI, I2C, 1-Wire and JTAG. This way one can interact with any IoT / embedded device for which one or more hardware communication ports are available. It supports both 3.3V and 5V, making it suitable for a large number of target devices. You don&#039;t need any special connection wires or cables to use the Attify Badge, but the standard Dupont jumper wires (also included in all Attify Badges). Attify Badge has a micro-USB port that allows it to be easily connected to your PC using a micro-USB cable. This is also included when you order an Attify Badge.&lt;br /&gt;
&lt;br /&gt;
== Usage Attify Badge Tool https://github.com/attify/attify-badge-tool ==&lt;br /&gt;
=== UART ===&lt;br /&gt;
Connect the Pins of the Attify Badge to the UART-device:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|- style=&amp;quot;font-weight:bold;&amp;quot;&lt;br /&gt;
! Attify Badge&lt;br /&gt;
! UART-device&lt;br /&gt;
|-&lt;br /&gt;
| D0 (TXD)&lt;br /&gt;
| RX&lt;br /&gt;
|-&lt;br /&gt;
| D1 (RXD)&lt;br /&gt;
| TX&lt;br /&gt;
|-&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
|}&lt;br /&gt;
Run the following commands to install and start the Attify Badge Tool (Attify Serial Console)&lt;br /&gt;
  git clone https://github.com/attify/attify-badge-tool&lt;br /&gt;
  cd attify-badge-tool&lt;br /&gt;
  pip3 install -r requirements.txt&lt;br /&gt;
  python3 serial-console.py&lt;br /&gt;
&lt;br /&gt;
Set the serial port (e.g. COM6) and the baud rate and the click on connect.&lt;br /&gt;
After that, you are connected to the UART.&lt;br /&gt;
&lt;br /&gt;
== Usage old Attify Badge Tool (deprecated) https://github.com/attify/attify-badge ==&lt;br /&gt;
The Attify Badge Tool consists of 5 main modules that correspond to the 5 protocols supported by the Attify Badge:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;UART&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;SPI&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;JTAG&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I2C&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;GPIO&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
If the target device you want to test or exploit has one of these interfaces, Attify Badge should be the tool of choice for this purpose.&lt;br /&gt;
=== Exploit by UART ===&lt;br /&gt;
&lt;br /&gt;
Register the external USB device connected to the system and add it to the combo box at the top left of the user interface.&lt;br /&gt;
&lt;br /&gt;
Select the USB port to which the device is connected and the baud rate to be used.&lt;br /&gt;
&lt;br /&gt;
Once you have selected the desired baud rate, press Enter to connect to the device. the data received from the UART device will be displayed in a black console window. You can use the input fields below it to interact with the device. In the combo box at the bottom right, you can select the line termination for each line you want to send to the device.&lt;br /&gt;
&lt;br /&gt;
=== Exploit by SPI ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Allows users to detect, read, write and erase SPI based memory of the target device connected to the Attify Badge.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Select the desired operation from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
For read/write commands, enter the path of the file where the data will be saved or read. An example of a path is ~/files/firmware.bin.&lt;br /&gt;
&lt;br /&gt;
=== Exploit by JTAG ===&lt;br /&gt;
Select the appropriate configuration file for the target device. (Custom configuration files can be placed directly in the cfg/ directory.)&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Start OpenOCD Server&amp;quot;. Then you will see the message &amp;quot;Initializing OpenOCD Server in the background&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Click on the &amp;quot;Connect to OpenOCD Server&amp;quot; button to connect to the OpenOCD Server. This will launch a new terminal window with a Telnet session connected to the OpenOCD Server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For further analysis (for example, to find and exploit firmware vulnerabilities).&lt;br /&gt;
&#039;&#039;Enter the path of the sprite file in the path edit box and click &amp;quot;Run GDB&amp;quot; (you will need the appropriate elf file).&lt;br /&gt;
&#039;&#039;This will start a gdb session for the tool to analyze.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Exploit by I²C ===&lt;br /&gt;
&#039;&#039;The I2C module can be used to find I2C devices and to read, write and erase the contents of I2C EEPROMs connected to the badge.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To do so, simply select the action you want from the drop-down menu, enter the file path if necessary, and click the &amp;quot;Run&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
=== Exploit by GPIO ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output Mode:&#039;&#039;&#039;&lt;br /&gt;
Selecting the check box next to each terminal will change the status of that terminal to &amp;quot;High&amp;quot;, and unchecking the box will change the status of that terminal to &amp;quot;Low&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input Mode&#039;&#039;&#039;&lt;br /&gt;
If you want to use the pin in input mode, change the mode of the desired pin to input mode and check the box to enable the pin.&lt;br /&gt;
&lt;br /&gt;
Click on the &amp;quot;Start input monitoring&amp;quot; button to start the input monitoring control.&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Start&amp;quot; button in the &amp;quot;Input monitoring&amp;quot; widget to start monitoring the input of the selected pin.&lt;br /&gt;
&lt;br /&gt;
== What&#039;s possible ==&lt;br /&gt;
With the help of UART communication you can get a serial root access to the target system, you can get debugging logs, U-Boot access and boot logs. It is also possible to save firmware, API keys or other confidential information stored on the flash chip via SPI or I2C. You can also write your own firmware to the device using Flash Write or perform JTAG debugging with OpenOCD and GDB.&lt;br /&gt;
Attify provides several tutorials on its own website and also sells its own [https://blog.attify.com/hack-iot-devices-embedded-exploitation/ IoT Exploitation Learning Kit], which is not affordable for every hobby pentester is. They also provide a [https://github.com/attify/attify-badge GitHub Repository] with sample code.&lt;br /&gt;
&lt;br /&gt;
== IoT Vulnerabilities ==&lt;br /&gt;
Nowadays, IoT devices are everywhere, including at home, e.g. To be able to control lamps or the heating with the mobile phone. However, many of these devices are very unsafe because for a long time no value was placed on the security of these things. Weak points are for example:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Weak, easy to guess, or hard-coded passwords. Often the standard passwords are simply used.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Insecure network services&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Lack of a secure update mechanism&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Insecure data transmission and storage&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;and many more&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
https://blog.attify.com/hack-iot-devices-embedded-exploitation/&lt;br /&gt;
&lt;br /&gt;
https://github.com/attify/attify-badge-tool&lt;br /&gt;
&lt;br /&gt;
[[Category:Pentesting]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Attify_Badge_IoT_Hacking_Device_Usage&amp;diff=11595</id>
		<title>Attify Badge IoT Hacking Device Usage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Attify_Badge_IoT_Hacking_Device_Usage&amp;diff=11595"/>
		<updated>2023-03-31T14:32:21Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
The [[Attify Badge IoT Hacking Device]] is a hardware security assessment tool created by Attify that is used to communicate between a PC and an embedded device using various hardware communication protocols. The device was initially built to aid in pentests for IoT devices, but the immense potential was soon recognized.&lt;br /&gt;
The Attify Badge uses an FTDI chip that can speak a wide variety of communication protocols and standards such as UART, SPI, I2C, 1-Wire and JTAG. This way one can interact with any IoT / embedded device for which one or more hardware communication ports are available. It supports both 3.3V and 5V, making it suitable for a large number of target devices. You don&#039;t need any special connection wires or cables to use the Attify Badge, but the standard Dupont jumper wires (also included in all Attify Badges). Attify Badge has a micro-USB port that allows it to be easily connected to your PC using a micro-USB cable. This is also included when you order an Attify Badge.&lt;br /&gt;
&lt;br /&gt;
== Firmware ==&lt;br /&gt;
Firmware is software that is embedded in electronic devices and performs basic functions there. It occupies an intermediate position between hardware (i.e. the physical components of a device) and the application software (the possibly exchangeable programs of a device). It is mostly stored in a flash memory, an EPROM, EEPROM or ROM and cannot be exchanged by the user or can only be exchanged with special means or functions. The term is derived from the fact that firmware is functionally permanently connected to the hardware, which means that one cannot be used without the other.&lt;br /&gt;
&lt;br /&gt;
Firmware is both the operating software of various devices or components (e.g. mobile phone, game console, remote control, hard drive, printer) and the basic software of a computer (e.g. the BIOS anchored in a flash memory in personal computers), which is necessary to load and operate the operating system kernel of the actual operating system&lt;br /&gt;
== Usage ==&lt;br /&gt;
The Attify Badge Tool consists of 5 main modules that correspond to the 5 protocols supported by the Attify Badge:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;UART&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;SPI&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;JTAG&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I2C&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;GPIO&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
If the target device you want to test or exploit has one of these interfaces, Attify Badge should be the tool of choice for this purpose.&lt;br /&gt;
== Exploit by UART ==&lt;br /&gt;
&lt;br /&gt;
Register the external USB device connected to the system and add it to the combo box at the top left of the user interface.&lt;br /&gt;
&lt;br /&gt;
Select the USB port to which the device is connected and the baud rate to be used.&lt;br /&gt;
&lt;br /&gt;
Once you have selected the desired baud rate, press Enter to connect to the device. the data received from the UART device will be displayed in a black console window. You can use the input fields below it to interact with the device. In the combo box at the bottom right, you can select the line termination for each line you want to send to the device.&lt;br /&gt;
&lt;br /&gt;
== Exploit by SPI ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Allows users to detect, read, write and erase SPI based memory of the target device connected to the Attify Badge.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Select the desired operation from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
For read/write commands, enter the path of the file where the data will be saved or read. An example of a path is ~/files/firmware.bin.&lt;br /&gt;
&lt;br /&gt;
== Exploit by JTAG ==&lt;br /&gt;
Select the appropriate configuration file for the target device. (Custom configuration files can be placed directly in the cfg/ directory.)&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Start OpenOCD Server&amp;quot;. Then you will see the message &amp;quot;Initializing OpenOCD Server in the background&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Click on the &amp;quot;Connect to OpenOCD Server&amp;quot; button to connect to the OpenOCD Server. This will launch a new terminal window with a Telnet session connected to the OpenOCD Server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For further analysis (for example, to find and exploit firmware vulnerabilities).&lt;br /&gt;
&#039;&#039;Enter the path of the sprite file in the path edit box and click &amp;quot;Run GDB&amp;quot; (you will need the appropriate elf file).&lt;br /&gt;
&#039;&#039;This will start a gdb session for the tool to analyze.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Exploit by I²C ==&lt;br /&gt;
&#039;&#039;The I2C module can be used to find I2C devices and to read, write and erase the contents of I2C EEPROMs connected to the badge.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To do so, simply select the action you want from the drop-down menu, enter the file path if necessary, and click the &amp;quot;Run&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
== Exploit by GPIO ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output Mode:&#039;&#039;&#039;&lt;br /&gt;
Selecting the check box next to each terminal will change the status of that terminal to &amp;quot;High&amp;quot;, and unchecking the box will change the status of that terminal to &amp;quot;Low&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input Mode&#039;&#039;&#039;&lt;br /&gt;
If you want to use the pin in input mode, change the mode of the desired pin to input mode and check the box to enable the pin.&lt;br /&gt;
&lt;br /&gt;
Click on the &amp;quot;Start input monitoring&amp;quot; button to start the input monitoring control.&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Start&amp;quot; button in the &amp;quot;Input monitoring&amp;quot; widget to start monitoring the input of the selected pin.&lt;br /&gt;
&lt;br /&gt;
== What&#039;s possible ==&lt;br /&gt;
With the help of UART communication you can get a serial root access to the target system, you can get debugging logs, U-Boot access and boot logs. It is also possible to save firmware, API keys or other confidential information stored on the flash chip via SPI or I2C. You can also write your own firmware to the device using Flash Write or perform JTAG debugging with OpenOCD and GDB.&lt;br /&gt;
Attify provides several tutorials on its own website and also sells its own [https://blog.attify.com/hack-iot-devices-embedded-exploitation/ IoT Exploitation Learning Kit], which is not affordable for every hobby pentester is. They also provide a [https://github.com/attify/attify-badge GitHub Repository] with sample code.&lt;br /&gt;
&lt;br /&gt;
== IoT Vulnerabilities ==&lt;br /&gt;
Nowadays, IoT devices are everywhere, including at home, e.g. To be able to control lamps or the heating with the mobile phone. However, many of these devices are very unsafe because for a long time no value was placed on the security of these things. Weak points are for example:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Weak, easy to guess, or hard-coded passwords. Often the standard passwords are simply used.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Insecure network services&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Lack of a secure update mechanism&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Insecure data transmission and storage&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;and many more&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
https://blog.attify.com/hack-iot-devices-embedded-exploitation/&lt;br /&gt;
&lt;br /&gt;
https://github.com/attify/attify-badge-tool&lt;br /&gt;
&lt;br /&gt;
[[Category:Pentesting]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Attify_Badge_IoT_Hacking_Device_Description&amp;diff=11594</id>
		<title>Attify Badge IoT Hacking Device Description</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Attify_Badge_IoT_Hacking_Device_Description&amp;diff=11594"/>
		<updated>2023-03-31T14:31:34Z</updated>

		<summary type="html">&lt;p&gt;LPutz: LPutz moved page Attify Badge IoT Hacking Device Description to Attify Badge IoT Hacking Device Usage: contains more usage than description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Attify Badge IoT Hacking Device Usage]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Attify_Badge_IoT_Hacking_Device_Usage&amp;diff=11593</id>
		<title>Attify Badge IoT Hacking Device Usage</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Attify_Badge_IoT_Hacking_Device_Usage&amp;diff=11593"/>
		<updated>2023-03-31T14:31:34Z</updated>

		<summary type="html">&lt;p&gt;LPutz: LPutz moved page Attify Badge IoT Hacking Device Description to Attify Badge IoT Hacking Device Usage: contains more usage than description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
The [[Attify Badge IoT Hacking Device]] is a hardware security assessment tool created by Attify that is used to communicate between a PC and an embedded device using various hardware communication protocols. The device was initially built to aid in pentests for IoT devices, but the immense potential was soon recognized. The Attify Badge uses an FTDI chip that can speak a wide variety of communication protocols and standards such as UART, SPI, I2C, 1-Wire and JTAG. This way one can interact with any IoT / embedded device for which one or more hardware communication ports are available. It supports both 3.3V and 5V, making it suitable for a large number of target devices. You don&#039;t need any special connection wires or cables to use the Attify Badge, but the standard Dupont jumper wires (also included in all Attify Badges). Attify Badge has a micro-USB port that allows it to be easily connected to your PC using a micro-USB cable. This is also included when you order an Attify Badge.&lt;br /&gt;
The Attify Badge uses an FTDI chip that can speak a wide variety of communication protocols and standards such as UART, SPI, I2C, 1-Wire and JTAG. This way one can interact with any IoT / embedded device for which one or more hardware communication ports are available. It supports both 3.3V and 5V, making it suitable for a large number of target devices.&lt;br /&gt;
You don&#039;t need any special connection wires or cables to use the Attify Badge, but the standard Dupont jumper wires (also included in all Attify Badges). Attify Badge has a micro-USB port that allows it to be easily connected to your PC using a micro-USB cable. This is also included when you order an Attify Badge.&lt;br /&gt;
== Firmware ==&lt;br /&gt;
Firmware is software that is embedded in electronic devices and performs basic functions there. It occupies an intermediate position between hardware (i.e. the physical components of a device) and the application software (the possibly exchangeable programs of a device). It is mostly stored in a flash memory, an EPROM, EEPROM or ROM and cannot be exchanged by the user or can only be exchanged with special means or functions. The term is derived from the fact that firmware is functionally permanently connected to the hardware, which means that one cannot be used without the other.&lt;br /&gt;
&lt;br /&gt;
Firmware is both the operating software of various devices or components (e.g. mobile phone, game console, remote control, hard drive, printer) and the basic software of a computer (e.g. the BIOS anchored in a flash memory in personal computers), which is necessary to load and operate the operating system kernel of the actual operating system&lt;br /&gt;
== Usage ==&lt;br /&gt;
The Attify Badge Tool consists of 5 main modules that correspond to the 5 protocols supported by the Attify Badge:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;UART&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;SPI&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;JTAG&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I2C&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;GPIO&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
If the target device you want to test or exploit has one of these interfaces, Attify Badge should be the tool of choice for this purpose.&lt;br /&gt;
== Exploit by UART ==&lt;br /&gt;
&lt;br /&gt;
Register the external USB device connected to the system and add it to the combo box at the top left of the user interface.&lt;br /&gt;
&lt;br /&gt;
Select the USB port to which the device is connected and the baud rate to be used.&lt;br /&gt;
&lt;br /&gt;
Once you have selected the desired baud rate, press Enter to connect to the device. the data received from the UART device will be displayed in a black console window. You can use the input fields below it to interact with the device. In the combo box at the bottom right, you can select the line termination for each line you want to send to the device.&lt;br /&gt;
&lt;br /&gt;
== Exploit by SPI ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Allows users to detect, read, write and erase SPI based memory of the target device connected to the Attify Badge.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Select the desired operation from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
For read/write commands, enter the path of the file where the data will be saved or read. An example of a path is ~/files/firmware.bin.&lt;br /&gt;
&lt;br /&gt;
== Exploit by JTAG ==&lt;br /&gt;
Select the appropriate configuration file for the target device. (Custom configuration files can be placed directly in the cfg/ directory.)&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Start OpenOCD Server&amp;quot;. Then you will see the message &amp;quot;Initializing OpenOCD Server in the background&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Click on the &amp;quot;Connect to OpenOCD Server&amp;quot; button to connect to the OpenOCD Server. This will launch a new terminal window with a Telnet session connected to the OpenOCD Server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For further analysis (for example, to find and exploit firmware vulnerabilities).&lt;br /&gt;
&#039;&#039;Enter the path of the sprite file in the path edit box and click &amp;quot;Run GDB&amp;quot; (you will need the appropriate elf file).&lt;br /&gt;
&#039;&#039;This will start a gdb session for the tool to analyze.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Exploit by I²C ==&lt;br /&gt;
&#039;&#039;The I2C module can be used to find I2C devices and to read, write and erase the contents of I2C EEPROMs connected to the badge.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To do so, simply select the action you want from the drop-down menu, enter the file path if necessary, and click the &amp;quot;Run&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
== Exploit by GPIO ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output Mode:&#039;&#039;&#039;&lt;br /&gt;
Selecting the check box next to each terminal will change the status of that terminal to &amp;quot;High&amp;quot;, and unchecking the box will change the status of that terminal to &amp;quot;Low&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input Mode&#039;&#039;&#039;&lt;br /&gt;
If you want to use the pin in input mode, change the mode of the desired pin to input mode and check the box to enable the pin.&lt;br /&gt;
&lt;br /&gt;
Click on the &amp;quot;Start input monitoring&amp;quot; button to start the input monitoring control.&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Start&amp;quot; button in the &amp;quot;Input monitoring&amp;quot; widget to start monitoring the input of the selected pin.&lt;br /&gt;
&lt;br /&gt;
== What&#039;s possible ==&lt;br /&gt;
With the help of UART communication you can get a serial root access to the target system, you can get debugging logs, U-Boot access and boot logs. It is also possible to save firmware, API keys or other confidential information stored on the flash chip via SPI or I2C. You can also write your own firmware to the device using Flash Write or perform JTAG debugging with OpenOCD and GDB.&lt;br /&gt;
Attify provides several tutorials on its own website and also sells its own [https://blog.attify.com/hack-iot-devices-embedded-exploitation/ IoT Exploitation Learning Kit], which is not affordable for every hobby pentester is. They also provide a [https://github.com/attify/attify-badge GitHub Repository] with sample code.&lt;br /&gt;
&lt;br /&gt;
== IoT Vulnerabilities ==&lt;br /&gt;
Nowadays, IoT devices are everywhere, including at home, e.g. To be able to control lamps or the heating with the mobile phone. However, many of these devices are very unsafe because for a long time no value was placed on the security of these things. Weak points are for example:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Weak, easy to guess, or hard-coded passwords. Often the standard passwords are simply used.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Insecure network services&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Lack of a secure update mechanism&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Insecure data transmission and storage&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;and many more&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
https://blog.attify.com/hack-iot-devices-embedded-exploitation/&lt;br /&gt;
&lt;br /&gt;
https://github.com/attify/attify-badge-tool&lt;br /&gt;
&lt;br /&gt;
[[Category:Pentesting]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Bus_Pirate:_UART&amp;diff=11592</id>
		<title>Bus Pirate: UART</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Bus_Pirate:_UART&amp;diff=11592"/>
		<updated>2023-03-31T10:10:50Z</updated>

		<summary type="html">&lt;p&gt;LPutz: Created page with &amp;quot;== Summary ==   This documentation describes the basic steps to connect to an UART-capable device using Bus Pirate v3.6  == Requirements ==  * Serial connection to the Bus Pirate (e.g. using Putty) * UART-capable device to connect to  If the currently installed Firmware doesn&amp;#039;t support UART mode, check Bus Pirate: First steps to install a different firmware.  == UART Connection ==  === Step 1 ===  Connect the Pins of the Bus Pirate to the UART-device:  {| class=&amp;quot;wiki...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation describes the basic steps to connect to an UART-capable device using Bus Pirate v3.6&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Serial connection to the Bus Pirate (e.g. using Putty)&lt;br /&gt;
* UART-capable device to connect to&lt;br /&gt;
&lt;br /&gt;
If the currently installed Firmware doesn&#039;t support UART mode, check [[Bus Pirate: First steps]] to install a different firmware.&lt;br /&gt;
&lt;br /&gt;
== UART Connection ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Connect the Pins of the Bus Pirate to the UART-device:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|- style=&amp;quot;font-weight:bold;&amp;quot;&lt;br /&gt;
! Bus Pirate&lt;br /&gt;
! UART-device&lt;br /&gt;
|-&lt;br /&gt;
| MOSI (TX)&lt;br /&gt;
| RX&lt;br /&gt;
|-&lt;br /&gt;
| MISO (RX)&lt;br /&gt;
| TX&lt;br /&gt;
|-&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Connect to the Bus Pirate using serial connection (e.g. using Putty) with baud rate 115200.&lt;br /&gt;
&lt;br /&gt;
Type &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; to start the mode selection.&lt;br /&gt;
&lt;br /&gt;
[[File:BusPirate_selectMode.png|500px|Bus Pirate Select Mode]]&lt;br /&gt;
&lt;br /&gt;
Select the UART and enter the settings (baud rate, etc.) according to the specifications of the UART-device.&lt;br /&gt;
&lt;br /&gt;
[[File:BusPirate_selectUART.png|500px|Bus Pirate Select UART]]&lt;br /&gt;
&lt;br /&gt;
After setting the correct values, type &amp;lt;code&amp;gt;W&amp;lt;/code&amp;gt; to enable the power supplies. Now it is possible to read values using &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;, send values like ASCII text using &amp;lt;code&amp;gt;&amp;quot;text&amp;quot;&amp;lt;/code&amp;gt; and more. &lt;br /&gt;
&lt;br /&gt;
[[File:BusPirate_testUART.png|500px|Bus Pirate Test UART]]&lt;br /&gt;
&lt;br /&gt;
Type &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; to see a list of available commands.&lt;br /&gt;
&lt;br /&gt;
[[File:BusPirate_UARThelpPage.png|500px|Bus Pirate UART help page]]&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Bus Pirate v3.6 Universal serial interface]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* http://dangerousprototypes.com/blog/bus-pirate-manual/bus-pirate-uart-guide/&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:BusPirate_UARThelpPage.png&amp;diff=11591</id>
		<title>File:BusPirate UARThelpPage.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:BusPirate_UARThelpPage.png&amp;diff=11591"/>
		<updated>2023-03-31T10:10:21Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:BusPirate_testUART.png&amp;diff=11590</id>
		<title>File:BusPirate testUART.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:BusPirate_testUART.png&amp;diff=11590"/>
		<updated>2023-03-31T10:10:03Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:BusPirate_selectUART.png&amp;diff=11589</id>
		<title>File:BusPirate selectUART.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:BusPirate_selectUART.png&amp;diff=11589"/>
		<updated>2023-03-31T10:09:08Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:BusPirate_selectMode.png&amp;diff=11588</id>
		<title>File:BusPirate selectMode.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:BusPirate_selectMode.png&amp;diff=11588"/>
		<updated>2023-03-31T10:07:59Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Bus_Pirate:_First_Steps&amp;diff=11587</id>
		<title>Bus Pirate: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Bus_Pirate:_First_Steps&amp;diff=11587"/>
		<updated>2023-03-31T09:57:35Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
Here the upgrade process for the Bus Pirate v3.6 will be showcased for [1.] Windows using the GUI application and for [2.] Linux using the console application.&lt;br /&gt;
&lt;br /&gt;
This will use the tutorial provided by the [http://dangerousprototypes.com/docs/Bus_Pirate manufacture] and the [https://github.com/BusPirate/Bus_Pirate github repository]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The Bus Pirate is an open source hacker multi-tool that talks to electronic stuff. It&#039;s got a bunch of features an intrepid hacker might need to prototype their next project. The Bus Pirate is used through a simple terminal interface.&lt;br /&gt;
&lt;br /&gt;
For [http://dangerousprototypes.com/docs/Bus_Pirate_menu_options_guide#I_Hardware.2C_firmware.2C_microcontroller_version_information all commands visit the manufactures website]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Protocols&lt;br /&gt;
* 1-Wire&lt;br /&gt;
* I2C&lt;br /&gt;
* SPI&lt;br /&gt;
* JTAG&lt;br /&gt;
* Asynchronous serial&lt;br /&gt;
* MIDI&lt;br /&gt;
* PC keyboard&lt;br /&gt;
* HD44780 LCD&lt;br /&gt;
* 2- and 3-wire libraries with bitwise pin control&lt;br /&gt;
* Scriptable binary bitbang, 1-Wire, I2C, SPI, and UART modes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Application Support&lt;br /&gt;
* AVRDude AVR programmer (AVRDude v5.8+, firmware v4 (any) or v5.9+)&lt;br /&gt;
* OpenOCD JTAG debugger&lt;br /&gt;
* flashrom bios/flash programmer&lt;br /&gt;
&lt;br /&gt;
== [1.] Windows ==&lt;br /&gt;
&lt;br /&gt;
; Check Bus Pirate Version&lt;br /&gt;
: Connect via Putty (baud rate 115200) to the Bus Pirate and type &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 HiZ&amp;gt;i&lt;br /&gt;
 Bus Pirate v3b&lt;br /&gt;
 Firmware v5.10 (r559)  Bootloader v4.4&lt;br /&gt;
 DEVID:0x0447 REVID:0x3046 (24FJ64GA002 B8)&lt;br /&gt;
 http://dangerousprototypes.com&lt;br /&gt;
&lt;br /&gt;
: Hardware v3b and v3.5 shipped with &#039;&#039;&#039;bootloader v4+, continue below&#039;&#039;&#039;&lt;br /&gt;
: Hardware v3a and v2go shipped with &#039;&#039;&#039;bootloader v2&#039;&#039;&#039;, please see the [http://dangerousprototypes.com/docs/Bus_Pirate#Bus_Pirate_v3_bootloader_upgradesbootloader upgrade guide]&lt;br /&gt;
&lt;br /&gt;
*; Enter Bus Pirate Bootloader mode (2 options)&lt;br /&gt;
: 1. Connect via Putty to the Bus Pirate and type &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; (! after this you have to close the application otherwise the firmware loader can not connect)&lt;br /&gt;
: 2. Connect the two pins: PGD and PGC (see image: [http://dangerousprototypes.com/docs/images/thumb/2/26/Bpv3-upgrade-jumper.jpg/250px-Bpv3-upgrade-jumper.jpg])&lt;br /&gt;
* Download: https://github.com/mikebdp2/Bus_Pirate.git&lt;br /&gt;
* Navigate to Bus_Pirate\BPv3-bootloader\ds30_Loader_GUI&lt;br /&gt;
*; Run &#039;ds30 Loader GUI.exe&#039;&lt;br /&gt;
* Click Connect / and select the firmware image (found under Bus_Pirate\package_latest\BPv3\bpv3_fw7.0_opt2_18092016.hex)&lt;br /&gt;
* Click Load&lt;br /&gt;
&lt;br /&gt;
== [2.] Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Communicate with the Bus Pirate ===&lt;br /&gt;
&lt;br /&gt;
; Install minicom serial reader/writer&lt;br /&gt;
: &amp;lt;code&amp;gt; sudo apt install minicom&amp;lt;/code&amp;gt;&lt;br /&gt;
; Connect BusPirate to the computer&lt;br /&gt;
: Check on what port the Bus Pirate connected to:&lt;br /&gt;
: &amp;lt;code&amp;gt;dmesg | tail&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 j@laptop:~$ dmesg | tail&lt;br /&gt;
 [  760.610683] ftdi_sio 1-1.2:1.0: device disconnected&lt;br /&gt;
 [  765.780110] usb 1-1.2: new full-speed USB device number 7 using xhci_hcd&lt;br /&gt;
 [  765.887218] usb 1-1.2: New USB device found, idVendor=0403, idProduct=6001&lt;br /&gt;
 [  765.887224] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3&lt;br /&gt;
 [  765.887227] usb 1-1.2: Product: FT232R USB UART&lt;br /&gt;
 [  765.887230] usb 1-1.2: Manufacturer: FTDI&lt;br /&gt;
 [  765.887233] usb 1-1.2: SerialNumber: A907NRH0&lt;br /&gt;
 [  765.890644] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected&lt;br /&gt;
 [  765.890768] usb 1-1.2: Detected FT232RL&lt;br /&gt;
 [  765.891161] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0&lt;br /&gt;
&lt;br /&gt;
; Configure minicom&lt;br /&gt;
: &amp;lt;code&amp;gt;minicom -s&amp;lt;/code&amp;gt;&lt;br /&gt;
: select &amp;lt;code&amp;gt;Serial port setup&amp;lt;/code&amp;gt;&lt;br /&gt;
: set to following parameters:&lt;br /&gt;
&lt;br /&gt;
    +-----------------------------------------------------------------------+&lt;br /&gt;
    | A -    Serial Device      : /dev/ttyUSB0                              |&lt;br /&gt;
    | B - Lockfile Location     : /var/lock                                 |&lt;br /&gt;
    | C -   Callin Program      :                                           |&lt;br /&gt;
    | D -  Callout Program      :                                           |&lt;br /&gt;
    | E -    Bps/Par/Bits       : 115200 8N1                                |&lt;br /&gt;
    | F - Hardware Flow Control : No                                        |&lt;br /&gt;
    | G - Software Flow Control : No                                        |&lt;br /&gt;
    |                                                                       |&lt;br /&gt;
    |    Change which setting?                                              |&lt;br /&gt;
    +-----------------------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
: Then &amp;lt;code&amp;gt;Save setup as dfl&amp;lt;/code&amp;gt;&lt;br /&gt;
; Connect to Bus Pirate&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo minicom&amp;lt;/code&amp;gt;&lt;br /&gt;
: Press Enter and following should be displayed:&lt;br /&gt;
 Welcome to minicom 2.7.1&lt;br /&gt;
 OPTIONS: I18n &lt;br /&gt;
 Compiled on Aug 13 2017, 15:25:34.&lt;br /&gt;
 Port /dev/ttyUSB0, 16:23:34&lt;br /&gt;
 Press CTRL-A Z for help on special keys&lt;br /&gt;
 HiZ&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If &amp;lt;code&amp;gt;Hiz/&amp;gt;&amp;lt;/code&amp;gt; is not being displayed the connection was not successful&lt;br /&gt;
&lt;br /&gt;
; Get Bus Pirate version&lt;br /&gt;
: Enter: &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 HiZ&amp;gt;i&lt;br /&gt;
 Bus Pirate v3b&lt;br /&gt;
 Firmware v5.10 (r559)  Bootloader v4.4&lt;br /&gt;
 DEVID:0x0447 REVID:0x3046 (24FJ64GA002 B8)&lt;br /&gt;
 http://dangerousprototypes.com&lt;br /&gt;
&lt;br /&gt;
Hardware v3b and v3.5 shipped with &#039;&#039;&#039;bootloader v4+, continue below&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Hardware v3a and v2go shipped with &#039;&#039;&#039;bootloader v2&#039;&#039;&#039;, please see the [http://dangerousprototypes.com/docs/Bus_Pirate#Bus_Pirate_v3_bootloader_upgradesbootloader upgrade guide]&lt;br /&gt;
&lt;br /&gt;
For [http://dangerousprototypes.com/docs/Bus_Pirate_menu_options_guide#I_Hardware.2C_firmware.2C_microcontroller_version_information all commands visit the manufactures website]&lt;br /&gt;
&lt;br /&gt;
== Update Firmware ==&lt;br /&gt;
&lt;br /&gt;
In general there are two options. You can:&lt;br /&gt;
# Build the [http://dangerousprototypes.com/docs/Compile_the_Bus_Pirate_firmware source code yourself]&lt;br /&gt;
# Or use a precompiled binary of the firmware: (&#039;&#039;&#039;recommended&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This tutorial is using the latest community package 7.1 for the BusPiratev3&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The latest is posted in [[http://dangerousprototypes.com/forum/index.php?topic=8498.135 here]]&#039;&#039;&#039; (usually by the user called USBEprom)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT: In order to update to v7.1 you need to upgrade the bootloader to v4.5&#039;&#039;&#039; (see [http://dangerousprototypes.com/forum/index.php?topic=8498.135 forum discussion], otherwise &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; to enter the bootloader will not work)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This tutorial is using Windows, if you have a Linux system please read &amp;quot;How to update with pirate-loader.rtf&amp;quot; in the downloaded folder&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Download firmware v7.1 for Bus Pirate v3.6&lt;br /&gt;
: Latest post by USBEprom: http://dangerousprototypes.com/forum/index.php?topic=8498.120&lt;br /&gt;
: Or if the site is unavailable use this copy [[File:BPv3-bootloaderv4xtov45-update-vb ENG-g2.7z]] @credits to USBEprom (Note: Read the the summary!)&lt;br /&gt;
; Update Bootloader&lt;br /&gt;
* Check the bootloader version, it needs to be 4.1+, otherwise follow the description in &amp;quot;How to use UPGRADE_TO_BL_v4.5.bat.rft&amp;quot;&lt;br /&gt;
* Change the COM-port to the correct one in UPGRADE_TO_BL_v4.5.bat&lt;br /&gt;
* Save changes&lt;br /&gt;
* Enter Bootloader (2 options):&lt;br /&gt;
:: 1. connect via some serial terminal (eg. minicom) and enter &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; (! after this you have to close the application otherwise the firmware loader can not connect) &#039;&#039;&#039;recommended&#039;&#039;&#039;&lt;br /&gt;
:: 2. connect the two pins: PGD and PGC (see image: [http://dangerousprototypes.com/docs/images/thumb/2/26/Bpv3-upgrade-jumper.jpg/250px-Bpv3-upgrade-jumper.jpg])&lt;br /&gt;
* Run UPGRADE_TO_BL_v4.5.bat&lt;br /&gt;
* Ignore the error: Erasing page 42, a800...ERROR [50], Error updating firmware :(&lt;br /&gt;
* Unplug an re-plug the USB cable of the BusPirate v3&lt;br /&gt;
* Open the terminal and press &amp;lt;code&amp;gt;space&amp;lt;/code&amp;gt; for further instructions&lt;br /&gt;
* Type &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt; if prompted -&amp;gt; This will overwrite the old bootloader&lt;br /&gt;
; Upgrade the firmware:&lt;br /&gt;
* Change COM-port to correct one in UPGRADE_FW_S_1-29092019.hex.bat &lt;br /&gt;
* Save changed file&lt;br /&gt;
* Run the file&lt;br /&gt;
* Ignore error: Erasing page 42, a800...ERROR [50] Error updating firmware :(&lt;br /&gt;
* Unplug and re-plug the BusPirate&lt;br /&gt;
* Done!&lt;br /&gt;
&lt;br /&gt;
 HiZ&amp;gt;i&lt;br /&gt;
 Bus Pirate v3.5&lt;br /&gt;
 Community Firmware v7.1 - goo.gl/gCzQnW [HiZ 1-WIRE UART I2C SPI 2WIRE 3WIRE KEYB LCD PIC DIO] Bootloader v4.5&lt;br /&gt;
 DEVID:0x0447 REVID:0x3046 (24FJ64GA00 2 B8)&lt;br /&gt;
 http://dangerousprototypes.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Bus Pirate v3.6 Universal serial interface]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [http://dangerousprototypes.com/docs/Bus_Pirate manufactures website]&lt;br /&gt;
* [https://github.com/BusPirate/Bus_Pirate github repository]&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=JTAGulator:_Find_IoT-Device%27s_UART_interface&amp;diff=11584</id>
		<title>JTAGulator: Find IoT-Device&#039;s UART interface</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=JTAGulator:_Find_IoT-Device%27s_UART_interface&amp;diff=11584"/>
		<updated>2023-03-30T11:57:56Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
Description of how to find the UART interface of an IoT-Device. In this example the &amp;quot;smart&amp;quot; alarm system [[Technaxx WiFi smart alarm system starter kit TX-84]] will be used.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Read subsection &#039;Finding UART&#039; &#039;&#039;&#039; of [[JTAGulator: Introduction]] to understand the basic commands available.&lt;br /&gt;
* JTAGualtor&lt;br /&gt;
* [[Technaxx WiFi smart alarm system starter kit TX-84]] or some other device&lt;br /&gt;
&lt;br /&gt;
== UART explained ==&lt;br /&gt;
&lt;br /&gt;
UART stands for Universal Asynchronous Receiver/Transmitter and is a serialized asynchronous communication specification between two devices. The communication can be simplex, half-duplex or duplex.&lt;br /&gt;
&lt;br /&gt;
; UART consist out of:&lt;br /&gt;
* &#039;&#039;&#039;TX&#039;&#039;&#039; .. Transmit&lt;br /&gt;
* &#039;&#039;&#039;RX&#039;&#039;&#039; .. Receive&lt;br /&gt;
* Vcc .. Supply Voltage (optional)&lt;br /&gt;
* Gnd .. Ground 0V (optional)&lt;br /&gt;
&lt;br /&gt;
whereas the RX from one device is connected to the TX from the other device&lt;br /&gt;
&lt;br /&gt;
http://www.circuitbasics.com/wp-content/uploads/2016/01/Introduction-to-UART-Basic-Connection-Diagram-300x147.png&lt;br /&gt;
&lt;br /&gt;
The two devices should have the same ground and same Vcc&lt;br /&gt;
&lt;br /&gt;
=== Data transmission ===&lt;br /&gt;
&lt;br /&gt;
http://www.circuitbasics.com/wp-content/uploads/2016/01/Introduction-to-UART-Packet-Frame-and-Bits-2.png&lt;br /&gt;
&lt;br /&gt;
; UART packet are defined as followed:&lt;br /&gt;
: - Start Bit: A connected not-sending data-line is kept at the Vcc voltage (idle, but can also be the reverse). When one party wants to send data it indicates it by pulling the data-line to ground.&lt;br /&gt;
: - Data Frame: The actual data section allows to send 5 to 9 bits per packet.&lt;br /&gt;
: - Parity: To detect transmission errors a checksum is appended to the packet. There are different modes: total of all even bits, total of all uneven bits.&lt;br /&gt;
: - Stop Bit: To end the packet the data-line is set to Vcc for 1 or 2 bit duration.&lt;br /&gt;
&lt;br /&gt;
* The Data Frame can only send 9 bits when the Parity Bit is turned off. The Data Frame &amp;quot;borrows&amp;quot; the extra bit from the Parity Bit.&lt;br /&gt;
* Data is send using least significant bit first.&lt;br /&gt;
* The baud rate of the 2 devices should be within +-10%&lt;br /&gt;
&lt;br /&gt;
[[File:UART.png|400px|border]]&lt;br /&gt;
&lt;br /&gt;
Source and Images:&lt;br /&gt;
* https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter&lt;br /&gt;
* http://www.circuitbasics.com/basics-uart-communication/&lt;br /&gt;
&lt;br /&gt;
== Find UART interface ==&lt;br /&gt;
&lt;br /&gt;
As explained in the section before the UART interface consists out of two pins: RX and TX. Usually also the pins Gnd and Vcc are laid out together. Therefore these 4 pins are usually right next to each other in a line.&lt;br /&gt;
&lt;br /&gt;
We look at this mainboard we can see 4 pins next to each other.&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t find them it helps to look at the datasheet of the microprocessor. It is good practice to remove the UART interface of the device since this should only be accessible for testing. (exceptions exist)&lt;br /&gt;
&lt;br /&gt;
== Connect to the possible pins ==&lt;br /&gt;
&lt;br /&gt;
Connect the JTAGulator Gnd Channel to the Gnd of the target device. Then connect the channels (start with 0 and proceed incrementally) to the possible pins of the UART.&lt;br /&gt;
&lt;br /&gt;
(Tip: you do not have to connect to the Gnd and Vcc of the target device since Gnd is already connected and Vcc has to be set in the software of the JTAGulator)&lt;br /&gt;
&lt;br /&gt;
== Connect to the JTAGualtor ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This tutorial is based on the firmware version 1.6&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure you connected the target device to power.&lt;br /&gt;
&lt;br /&gt;
; Connect the JTAGulator to the computer&lt;br /&gt;
: and open a serial connection using the following parameters: (eg. use Putty, minicom, ...)&lt;br /&gt;
:: 115200 bps, 8 data bits, no parity, 1 stop bit&lt;br /&gt;
; Go into the UART menu&lt;br /&gt;
: Type &amp;lt;code&amp;gt;U&amp;lt;/code&amp;gt; for the UART menu&lt;br /&gt;
: Type &amp;lt;code&amp;gt;H&amp;lt;/code&amp;gt; for help and all possible commands&lt;br /&gt;
; Find UART pin configuration&lt;br /&gt;
: Set the voltage level of the target device&lt;br /&gt;
:: &amp;lt;code&amp;gt;V&amp;lt;/code&amp;gt; and enter Vcc (if not known check with oscilloscope of multimeter)&lt;br /&gt;
: Type &amp;lt;code&amp;gt;U&amp;lt;/code&amp;gt; in the UART menu to start the brute force on the pin configuration of the UART pins.&lt;br /&gt;
: Enter the text string you want to output on the UART interface:&lt;br /&gt;
:: Usually you want to keep the &amp;lt;code&amp;gt;default configuration [CR]&amp;lt;/code&amp;gt; so &amp;lt;code&amp;gt;just press enter&amp;lt;/code&amp;gt;&lt;br /&gt;
:: Usually when pressing &amp;lt;code&amp;gt;enter&amp;lt;/code&amp;gt; into a UART interface it will great you with a response.&lt;br /&gt;
: Enter starting channel of the JTAGulator&lt;br /&gt;
: Enter ending channel of the JTAGulator&lt;br /&gt;
:: Now the JTAGulator will cycle through all pin configurations and possible baud rates and prints out the output character you specified&lt;br /&gt;
&lt;br /&gt;
 UART&amp;gt; u                                                                         &lt;br /&gt;
 UART pin naming is from the target&#039;s perspective.                               &lt;br /&gt;
 Enter text string to output (prefix with \x for hex) [CR]:                      &lt;br /&gt;
 Enter starting channel [0]:                                                     &lt;br /&gt;
 Enter ending channel [4]:                                                       &lt;br /&gt;
 Possible permutations: 20                                                       &lt;br /&gt;
                                                                                 &lt;br /&gt;
 Ignore non-printable characters? [y/N]: n                                       &lt;br /&gt;
 Press spacebar to begin (any other key to abort)...                             &lt;br /&gt;
 JTAGulating! Press any key to abort...                                          &lt;br /&gt;
 ----------                                                                      &lt;br /&gt;
 TXD: 2                                                                          &lt;br /&gt;
 RXD: 3                                                                          &lt;br /&gt;
 Baud: 19200                                                                     &lt;br /&gt;
 Data: ..(t0d^l.. ..... [ AF 85 28 74 30 64 5E 6C D9 0F 20 B7 E7 A5 F5 D4 ]      &lt;br /&gt;
                                                                                 &lt;br /&gt;
 TXD: 2                                                                          &lt;br /&gt;
 RXD: 3                                                                          &lt;br /&gt;
 Baud: 57600                                                                     &lt;br /&gt;
 Data: ...[32;40m00:16: [ 0D 0A 1B 5B 33 32 3B 34 30 6D 30 30 3A 31 36 3A ]      &lt;br /&gt;
                                                                                 &lt;br /&gt;
 TXD: 2                                                                          &lt;br /&gt;
 RXD: 3                                                                          &lt;br /&gt;
 Baud: 76800                                                                     &lt;br /&gt;
 Data: . [ 0C ]                                                                  &lt;br /&gt;
                                                                                 &lt;br /&gt;
 ...                                                                &lt;br /&gt;
                                                                                                                                               &lt;br /&gt;
 TXD: 2                                                                          &lt;br /&gt;
 RXD: 4                                                                          &lt;br /&gt;
 Baud: 115200                                                                    &lt;br /&gt;
 Data: ................ [ 9E CF 0F 98 06 9E 0F 0F 98 98 E0 CF F3 98 E6 98 ]      &lt;br /&gt;
 ---------                                                                       &lt;br /&gt;
 UART scan complete.  &lt;br /&gt;
&lt;br /&gt;
We can see that the JTAGulator received some input. Now you have to filter out the right combination by looking at the output. The UART interface will send back some ASCII characters. 0x0D / 0x0A are very good indicator signalling a carriage return / newline. So the second output (TX:2 RX:3 Baud:56700) looks very promising&lt;br /&gt;
&lt;br /&gt;
; Check the found UART pin configuration&lt;br /&gt;
: Now we will use the UART pass-through to send terminal input directly through the JTAGulator to the specific UART pin configuration&lt;br /&gt;
: Type &amp;lt;code&amp;gt;P&amp;lt;/code&amp;gt; in the UART menu to start the UART passthrough mode.&lt;br /&gt;
&lt;br /&gt;
Restarting the target device (alarmsystem) gives us the perfect example to disable the UART as a debugging interface&lt;br /&gt;
&lt;br /&gt;
 -Boot 1.1.3 (May 24 2016 - 11:52:40)&lt;br /&gt;
 &lt;br /&gt;
 Board: Dahua Tech Soc DRAM:  64 MB&lt;br /&gt;
 relocate_code Pointer at: 83fb8000&lt;br /&gt;
 ***********************&lt;br /&gt;
 Watchdog Reset Occurred&lt;br /&gt;
 ***********************&lt;br /&gt;
 flash manufacture id: ef, device id 40 18&lt;br /&gt;
 find flash: W25Q128BV&lt;br /&gt;
 env_relocate[232] malloced ENV at 83f78010&lt;br /&gt;
 ============================================ &lt;br /&gt;
 Ralink UBoot Version: 4.3.0.0&lt;br /&gt;
 -------------------------------------------- &lt;br /&gt;
 ASIC 7628_MP (Port5&amp;lt;-&amp;gt;None)&lt;br /&gt;
 DRAM component: 512 Mbits DDR, width 16&lt;br /&gt;
 DRAM bus: 16 bit&lt;br /&gt;
 Total memory: 64 MBytes&lt;br /&gt;
 Flash component: SPI Flash&lt;br /&gt;
 Date:May 24 2016  Time:11:52:40&lt;br /&gt;
 ============================================ &lt;br /&gt;
 icache: sets:512, ways:4, linesz:32 ,total:65536&lt;br /&gt;
 dcache: sets:256, ways:4, linesz:32 ,total:32768 &lt;br /&gt;
 &lt;br /&gt;
  ##### The CPU freq = 580 MHZ #### &lt;br /&gt;
  estimate memory size =64 Mbytes&lt;br /&gt;
 RESET MT7628 PHY!!!!!!&lt;br /&gt;
 &lt;br /&gt;
 Please choose the operation: &lt;br /&gt;
    1: Load system code to SDRAM via TFTP. &lt;br /&gt;
    2: Load system code then write to Flash via TFTP. &lt;br /&gt;
    3: Boot system code via Flash (default).&lt;br /&gt;
    *: Entr boot command line interface.&lt;br /&gt;
    5: Load img then write to Flash via TFTP. &lt;br /&gt;
    7: Load Boot Loader code then write to Flash via Serial. &lt;br /&gt;
    9: Load Boot Loader code then write to Flash via TFTP. &lt;br /&gt;
 default: 3&lt;br /&gt;
  0 &lt;br /&gt;
    &lt;br /&gt;
 3: System Boot system code via Flash.&lt;br /&gt;
 ## Booting image at bc050000 ...&lt;br /&gt;
    Image Name:   Linux Kernel Image&lt;br /&gt;
    Image Type:   MIPS Linux Kernel Image (lzma compressed)&lt;br /&gt;
    Data Size:    2621376 Bytes =  2.5 MB&lt;br /&gt;
    Load Address: 80000000&lt;br /&gt;
    Entry Point:  8000c150&lt;br /&gt;
    Verifying Checksum ... OK&lt;br /&gt;
    Uncompressing Kernel Image ... OK&lt;br /&gt;
 No initrd&lt;br /&gt;
 ## Transferring control to Linux (at address 8000c150) ...&lt;br /&gt;
 ## Giving linux memsize in MB, 64&lt;br /&gt;
 &lt;br /&gt;
 Starting kernel ...&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 LINUX started...&lt;br /&gt;
 Linux version 2.6.36+ (wu_zhongren@centos128) (gcc version 4.6.3 (Buildroot 2012.11.1) )  #1 Wed Nov 30 19:48:01 CST 2016 &lt;br /&gt;
 &lt;br /&gt;
  The CPU feqenuce set to 580 MHz&lt;br /&gt;
 &lt;br /&gt;
  MIPS CPU sleep mode enabled.&lt;br /&gt;
 prom_envp(0)=memsize=64  ace in production:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ohh look it started Linux :)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
further down in the output we can see following:&lt;br /&gt;
&lt;br /&gt;
 00:00:17|[NetApp-364975] debug tid:344 tid:344, P2P current config:[&lt;br /&gt;
    {&lt;br /&gt;
       &amp;quot;Address&amp;quot; : &amp;quot;www.easy4ipcloud.com&amp;quot;,&lt;br /&gt;
       &amp;quot;Enable&amp;quot; : true,&lt;br /&gt;
       &amp;quot;Key&amp;quot; : &amp;quot;YXQ3Maxxxxxxxxx&amp;quot;,&lt;br /&gt;
       &amp;quot;Port&amp;quot; : 8800,&lt;br /&gt;
       &amp;quot;RecvBufferSize&amp;quot; : 524288,&lt;br /&gt;
       &amp;quot;RegisterPort&amp;quot; : 12366,&lt;br /&gt;
       &amp;quot;RegisterServer&amp;quot; : &amp;quot;www.easy4ip.com&amp;quot;,&lt;br /&gt;
       &amp;quot;ThreadNum&amp;quot; : 1,&lt;br /&gt;
       &amp;quot;Type&amp;quot; : &amp;quot;dhp2p&amp;quot;,&lt;br /&gt;
       &amp;quot;UUID&amp;quot; : &amp;quot;3F0073EPAN00338&amp;quot;,&lt;br /&gt;
       &amp;quot;WebVersion&amp;quot; : &amp;quot;2.211.0&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Oh look it also printed out some password! &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(I replaced the last characters of the password with x)&lt;br /&gt;
&lt;br /&gt;
Let&#039;s see what happens if I press enter:&lt;br /&gt;
&lt;br /&gt;
 user name:&lt;br /&gt;
 password:&lt;br /&gt;
 23:50:23|[Manager] info tid:360 CLocalClient::CLocalClient(0x0x1c28f90)&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
 23:50:23|[libInfra] warn tid:360 [Src/Component/Client.cpp:67] this:0x1c28f90 tid:360,  userName of client is a null string! &lt;br /&gt;
 23:50:23|[libInfra] warn tid:360 [Sr c/Component/Client.cpp:67] this:0x1c28f90 tid:360,  userName of client is a null string! &lt;br /&gt;
 23:50:23|[Manager] info tid:360 si.l oginType=0, si.clientAddress=, si.clientType=Consol e  si.authorityInfo= si.authorityType=  si.passwordType=Plain &lt;br /&gt;
 23:50:23|[Manager] error tid:360 CLo calClient::login() fa iled with:268632070!&lt;br /&gt;
 23:50:23|[Manager] info tid:360 CLocalClient::~CLocalClie nt(0x0x1c28f90)&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
 User not valid!&lt;br /&gt;
 user name:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Oh look it asks for a username and password&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s test admin:admin&lt;br /&gt;
&lt;br /&gt;
 23:50:27|[Manager] debug tid:360 CLocalClient::login() successful! username = admin&lt;br /&gt;
&lt;br /&gt;
... well that was easy 😅 &lt;br /&gt;
&lt;br /&gt;
and the best part is: &#039;&#039;&#039;I am logged into root&#039;&#039;&#039; :)&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[JTAGulator]]&lt;br /&gt;
[[Technaxx WiFi smart alarm system starter kit TX-84]]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10966</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10966"/>
		<updated>2023-01-08T18:26:16Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explains the basics of WiFi Security, specifically the protocols WPA2 and WPA3 and their respective handshakes. It also explains the possibility of frame aggregation and fragmentation, as well as some attacks on these concepts.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the 2. message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed.&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
A description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre Shared Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10965</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10965"/>
		<updated>2023-01-08T18:07:06Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explains the basics of WiFi Security, specifically the protocols WPA2 and WPA3 and their respective handshakes. It also explains the possibility of frame aggregation and fragmentation, as well as some attacks on these concepts.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the 2. message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed.&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|500px|Dragonfly Handshake]]&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|WiFi Frame Structure]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
[[File:Fragexample.png|500px|Example for a Mixed Key Attack]]&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture above for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
A description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre Shared Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:WiFiFrameAufbau.png&amp;diff=10964</id>
		<title>File:WiFiFrameAufbau.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:WiFiFrameAufbau.png&amp;diff=10964"/>
		<updated>2023-01-08T18:04:48Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10963</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10963"/>
		<updated>2023-01-08T18:03:13Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explains the basics of WiFi Security, specifically the protocols WPA2 and WPA3 and their respective handshakes. It also explains the possibility of frame aggregation and fragmentation, as well as some attacks on these concepts.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the 2. message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed.&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|500px|Dragonfly Handshake]]&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destionation. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destionation-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
[[File:Fragexample.png|500px|Example for a Mixed Key Attack]]&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture above for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
A description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre Shared Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Dragonfly.png&amp;diff=10962</id>
		<title>File:Dragonfly.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Dragonfly.png&amp;diff=10962"/>
		<updated>2023-01-08T18:02:19Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10961</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10961"/>
		<updated>2023-01-08T17:53:56Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explains the basics of WiFi Security, specifically the protocols WPA2 and WPA3 and their respective handshakes. It also explains the possibility of frame aggregation and fragmentation, as well as some attacks on these concepts.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the 2. message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed.&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destionation. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destionation-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
[[File:Fragexample.png|500px|Example for a Mixed Key Attack]]&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture above for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
A description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre Shared Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Fragexample.png&amp;diff=10958</id>
		<title>File:Fragexample.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Fragexample.png&amp;diff=10958"/>
		<updated>2023-01-08T17:51:03Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:4way.png&amp;diff=10957</id>
		<title>File:4way.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:4way.png&amp;diff=10957"/>
		<updated>2023-01-08T17:47:35Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10956</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10956"/>
		<updated>2023-01-08T17:46:31Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explains the basics of WiFi Security, specifically the protocols WPA2 and WPA3 and their respective handshakes. It also explains the possibility of frame aggregation and fragmentation, as well as some attacks on these concepts.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the 2. message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed.&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destionation. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destionation-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
A description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre Shared Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10955</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=10955"/>
		<updated>2023-01-08T17:45:58Z</updated>

		<summary type="html">&lt;p&gt;LPutz: Created page with &amp;quot;== Summary ==   This documentation explains the basics of WiFi Security, specifically the protocols WPA2 and WPA3 and their respective handshakes. It also explains the possibility of frame aggregation and fragmentation, as well as some attacks on these concepts.  == Basics ==  === WPA2 === WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was do...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explains the basics of WiFi Security, specifically the protocols WPA2 and WPA3 and their respective handshakes. It also explains the possibility of frame aggregation and fragmentation, as well as some attacks on these concepts.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the 2. message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed.&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destionation. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destionation-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
A description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre Shared Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
&lt;br /&gt;
[[Category:Basics]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Hak5_Signal_Owl&amp;diff=10449</id>
		<title>Hak5 Signal Owl</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Hak5_Signal_Owl&amp;diff=10449"/>
		<updated>2022-12-12T12:33:30Z</updated>

		<summary type="html">&lt;p&gt;LPutz: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
&lt;br /&gt;
The [https://docs.hak5.org/hc/en-us/categories/360002117953-Signal-Owl Signal Owl] is a hardware product developed by the company Hak5.&lt;br /&gt;
It is a simple payload-based signals intelligence platform with a unique design for discreet planting or mobile operations on any engagement. The most popular application cases include classic network mapping and basic penetration tests for various wireless technologies.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
[[File:SignalOwlDiagram.png|thumb|500px|frame|Components of the Signal Owl [Eigene Darstellung]]] &lt;br /&gt;
&lt;br /&gt;
The Signal Owl is designed to be rapidly deployed in all kinds of environments, allowing it to be an entry point for network analysis and basic wireless attacks in a variety of locations. With a power consumption of 100-200 mAh and the thermally optimized architecture, mobile operations as well as long term deployments, are enabled.&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
&lt;br /&gt;
This device features several components of which some may not be visible to the human eye at first sight.&lt;br /&gt;
&lt;br /&gt;
==== USB Power / Passthrough Plug ====&lt;br /&gt;
&lt;br /&gt;
The USB power or passthrough plug is used to power the device. It can be powered from any reliable USB source.&lt;br /&gt;
&lt;br /&gt;
==== USB 2.0 Passthrough Port ====&lt;br /&gt;
&lt;br /&gt;
The USB 2.0 passthrough port is the port closest to the pigtail. Data and power pass through to that port, allowing for implant operations. With devices like keyboards plugged plugged inline between this passthrough port and the power plug connected to the target computer, the Signal Owl will remain undetected from the operating system. Only the keyboard will be visible.&lt;br /&gt;
&lt;br /&gt;
==== USB 2.0 Host Port ====&lt;br /&gt;
&lt;br /&gt;
The USB 2.0 host port is the port farthest away from the pigtail. It is connected to the Linux socket of the Signal Owl and supports USB flash drives formatted with FAT32 and EXT4 file systems as well as many Wi-Fi, Bluetooth and other RF transceivers.&lt;br /&gt;
&lt;br /&gt;
==== Button ====&lt;br /&gt;
&lt;br /&gt;
The button on the bottom of the device is used to enter Arming Mode and to interact with payloads. It is not pressable without special tools like paperclips.&lt;br /&gt;
&lt;br /&gt;
==== Status LED ====&lt;br /&gt;
&lt;br /&gt;
The status LED indicates the current status of the Signal Owl. When turned off, it is not visible.&lt;br /&gt;
&lt;br /&gt;
=== Implant / mobile operations ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implant operations&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During long term wireless engagements, the Signal Owl may be planted inline between any typical 5V USB power source. This may be useful in situations where ports are occupied, or to deter the unit from being unplugged.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Mobile operations&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The Signal Owl features a low power consumption profile, with a typical power draw averaging 100-200 mAh. Additionally, it is thermally optimized for long term deployments in many indoor environments. One can expect a large 20,000 mAh USB battery bank to operate the unit for up to 4 days.&lt;br /&gt;
&lt;br /&gt;
=== Default Settings ===&lt;br /&gt;
&lt;br /&gt;
Default settings that are used in order to access the device via SSH are pictured in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|Default Settings&lt;br /&gt;
|-&lt;br /&gt;
|Username&lt;br /&gt;
|root&lt;br /&gt;
|-&lt;br /&gt;
|Password&lt;br /&gt;
|hak5owl&lt;br /&gt;
|-&lt;br /&gt;
|SSID&lt;br /&gt;
|Owl_xxxx&lt;br /&gt;
|-&lt;br /&gt;
|IP Address&lt;br /&gt;
|172.16.56.1&lt;br /&gt;
|-&lt;br /&gt;
|SSH command&lt;br /&gt;
|ssh root@172.16.56.1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The SSID during Arming Mode is Owl_xxxx in which xxxx indicates the last two octets of the devices MAC address.&lt;br /&gt;
&lt;br /&gt;
=== LED Status Indications ===&lt;br /&gt;
&lt;br /&gt;
The Signal Owl features a red LED with the following default status indications:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|LED&lt;br /&gt;
!|Status&lt;br /&gt;
|-&lt;br /&gt;
|Blinking&lt;br /&gt;
|Booting&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|Mounting external storage / Running upgrade&lt;br /&gt;
|-&lt;br /&gt;
|Single blinking&lt;br /&gt;
|Attack Mode&lt;br /&gt;
|-&lt;br /&gt;
|Double blinking&lt;br /&gt;
|Arming Mode&lt;br /&gt;
|-&lt;br /&gt;
|Slow blinking&lt;br /&gt;
|Error running payload&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
&lt;br /&gt;
The Signal Owl comes with two modes of operation, Attack Mode and Arming Mode. By default, the device will boot into Attack Mode. In order to access Arming Mode, the button on the bottom of the device has to be pressed while in Attack Mode. It is not recommended to press the button during the boot sequence as this can possibly brick the device and render it useless. The arming mode is used for firmware updates and shell access, while the attack mode is used to load and execute the payload.&lt;br /&gt;
&lt;br /&gt;
==== Attack Mode ====&lt;br /&gt;
&lt;br /&gt;
Attack Mode is the default mode, the Signal Owl boots into. It provides two basic functions, being the payload loading function and the payload execution function. The payload loading function checks for any USB flash drives plugged into the host port of the device and copies payloads and extensions to the root of the Signal Owl. The payload execution function is responsible for executing the payload that is currently stored on the root of the Signal Owl. In case no payload is found, the device will blink slowly, indicating the FAIL status.&lt;br /&gt;
&lt;br /&gt;
==== Arming Mode ====&lt;br /&gt;
&lt;br /&gt;
The Arming Mode provides two basic functions, being the firmware update function and the shell access function. The firmware update function checks for any USB flash drives plugged into the host port of the device and copies firmware upgrade files into the internal storage of the device and flashes it. The shell access function starts an open access point with the SSID Owl_xxxx in which xxxx indicates the last two octets of the devices MAC address. Additionally, a SSH server providing access to the shell of the Signal Owl is enabled.&lt;br /&gt;
&lt;br /&gt;
=== Initial Setup ===&lt;br /&gt;
&lt;br /&gt;
When first unboxing the Signal Owl, the device runs a stager firmware that is designed to flash the latest firmware from a USB flash drive. In order to update the Signal Owl, the [https://downloads.hak5.org/owl latest firmware] has to be downloaded. Then, the downloaded file must be copied to the root of an EXT4 or FAT32 formatted USB flash drive. It is important not to modify this file. The next step is to plug the USB flash drive into the powered off Signal Owl. Afterwards, the device has to be powered on by a reliable USB source. The upgrade itself takes approximately five to ten minutes and is indicated by a solid red LED light. When finished, the device will reboot, enter Attack Mode and blink slowly, indicating an error running the payload because no payload has been found.&lt;br /&gt;
&lt;br /&gt;
=== Payload Development ===&lt;br /&gt;
&lt;br /&gt;
Payloads for the Signal Owl are written in bash with [https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Duckyscript Ducky Script] and can be created with any standard text editor. All payloads should begin with an interpreter directive, like the shebang #!/bin/bash for bash payloads and payloads must be named either payload.txt or payload.sh. In order to create effective payloads, the Signal Owl comes with several preinstalled penetration testing tools. These are as follows: [https://nmap.org/ Nmap], [https://www.aircrack-ng.org/ Aircrack-ng], [https://github.com/aircrack-ng/mdk4 MDK4] and [https://www.kismetwireless.net/ Kismet].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tools&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
• Kismet - detector for wireless networks and devices.&lt;br /&gt;
&lt;br /&gt;
• MDK4 - Wi-Fi testing tool.&lt;br /&gt;
&lt;br /&gt;
• Aircrack-ng Suite - a complete suite of tools for WiFi network security assessment.&lt;br /&gt;
&lt;br /&gt;
• Nmap - open source utility for network discovery and security auditing.&lt;br /&gt;
&lt;br /&gt;
=== Adding Payloads and Extensions ===&lt;br /&gt;
&lt;br /&gt;
Payloads can be stored on the internal storage of the Signal Owl as well as on a USB flash drive. When booting, payloads on USB flash drives are given priority and will override payloads stored on the Signal Owl. If no payload is found on the external storage and a payload is present on the internal storage, the internally stored payload will be executed. In case no payload is found on both internal and external storage, the Signal Owl will blink slowly. To successfully copy a payload to the Signal Owl and execute it, the payload must be named payload.txt or payload.sh and it has to be placed in the root directory of the flash drive. Similarly, payload extensions should be stored in a /extensions directory on the flash drive.&lt;br /&gt;
&lt;br /&gt;
After plugging the Signal Owl into a USB source, it will boot and then copy the payloads and payload extensions to the /root/payload and /root/payload/extensions directory respectively. Then, the device will enter Attack Mode and execute the payload.&lt;br /&gt;
&lt;br /&gt;
== Fake Beacon Flooding Attack ==&lt;br /&gt;
&lt;br /&gt;
The fake beacon flooding attack is one possible use case for the Signal Owl. With that attack, fake beacon frames are broadcasted to nearby devices. Beacon Frames include various parameters like the SSID, the type of encryption used and timestamps. This results in the creation of multiple fake Wi-Fi networks. Devices with Wi-Fi browsers are then flooded with these fake networks, causing potential network scanner and driver crashes. Furthermore, the attack may prevent legitimate users from finding their networks and lead to denial of service. &lt;br /&gt;
To execute the attack with the Signal Owl, the preinstalled tools Aircrack-ng and MDK4 are used. The following bash script is saved as payload.sh and placed on the root of an USB flash drive. Then the USB flash drive is plugged into the Signal Owl. After powering on the device, multiple fake networks with random SSIDs are generated and broadcasted to all nearby devices.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
LED SETUP&lt;br /&gt;
#creates monitor mode interface on wirelss card of the Signal Owl&lt;br /&gt;
airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
LED ATTACK&lt;br /&gt;
#floods nearby devices with random SSIDs&lt;br /&gt;
mdk4 wlan0mon b -w a -m -s 1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results as seen from a victim running a Windows 10 system are pictured in the figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:FakeBeaconFloodingSignalOwl.png|none|Random SSIDs as seen from a victim windows 10 client |]][Eigene Darstellung]&lt;br /&gt;
&lt;br /&gt;
== Open AP Nmap Scanner ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Description: First access points are scanned, then a connection is established to the open access points, after connecting, the nmap scan runs and analyses the AP, &lt;br /&gt;
the results are saved in the loot folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Settings &lt;br /&gt;
&lt;br /&gt;
NMAP_OPTIONS=&amp;quot;-sP&amp;quot;&lt;br /&gt;
&lt;br /&gt;
LOOT_DIR=/root/loot/open_ap_nmap_scan&lt;br /&gt;
&lt;br /&gt;
MAX_CIDR=20&lt;br /&gt;
&lt;br /&gt;
DEBUG=1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Step-by-step guide&lt;br /&gt;
&lt;br /&gt;
    1) download the payload [https://github.com/hak5/signalowl-payloads/blob/master/payloads/library/wifi/Open-AP-Nmap-Scanner/payload.txt payload]&lt;br /&gt;
    2) store the payload in a usb stick and plug the stick into the signal owl&lt;br /&gt;
    3) after connecting the signal owl, the payload is loaded on the root folder and the scan starts. &lt;br /&gt;
    4) once successfully executed, you can start the signal owl in arming mode and see the results in the loot folder.&lt;br /&gt;
      example loot Directory&lt;br /&gt;
      [[File:ArmingmodeSSHloot.png [Eigene Darstellung]]]&lt;br /&gt;
&lt;br /&gt;
== Arming Mode connection ==&lt;br /&gt;
&lt;br /&gt;
Step-by-step guide for accessing the arming mode&lt;br /&gt;
   1) click on the button located on the bottom of the signal owl while it is in attack mode. After pressing the button, the signal owl enters the arming &lt;br /&gt;
      mode and provides an open access point with the name Owl xxxx (where xxxx stands for the last two digits of the MAC address of the device).&lt;br /&gt;
   2) Connect to the access point. &lt;br /&gt;
      [[File:Armingmode.png]][Eigene Darstellung]&lt;br /&gt;
   3) Now you can connect via ssh by using the username and password (default: Username: root, Password: hak5owl, IP Address: 172.16.56.1)&lt;br /&gt;
   4) after successful connection you will end up in root@Owl directory&lt;br /&gt;
      [[File:ArmingmodeSSH.png]][Eigene Darstellung]&lt;br /&gt;
   5) Now you can enter the directories loot and payload to either view the results or to make further settings&lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
      example Directory structure&lt;br /&gt;
      [[File:ArmingmodeSSHdirectories.png]][Eigene Darstellung]&lt;br /&gt;
&lt;br /&gt;
== Use Cases ==&lt;br /&gt;
&lt;br /&gt;
The Signal Owl has a variety of different use cases. Among the most popular ones are classical network mapping and wardriving as well as basic penetration tests for different wireless technologies.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Signal Owl]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://docs.hak5.org/signal-owl/&lt;br /&gt;
*https://github.com/hak5/signalowl-payloads&lt;br /&gt;
&lt;br /&gt;
[[Category:Pentesting]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Jetson_AGX_Xavier_Development_Kit:_Setup&amp;diff=10401</id>
		<title>Jetson AGX Xavier Development Kit: Setup</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Jetson_AGX_Xavier_Development_Kit:_Setup&amp;diff=10401"/>
		<updated>2022-07-25T19:30:47Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a guide to set up the [[Jetson AGX Xavier Development Kit]]. After this guide the user will be able to connect with SSH and VNC.&lt;br /&gt;
This guide will also show the installation process of TensorFlow and Keras for AI-Research purposes.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Operating system: Ubuntu 18*&lt;br /&gt;
* Software: Nvidia SDK Manager https://developer.nvidia.com/nvidia-sdk-manager&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#42;Depending on the desired JetPack version different Ubuntu versions are required.&lt;br /&gt;
&lt;br /&gt;
::JetPack 4.x requires Ubuntu 18&lt;br /&gt;
&lt;br /&gt;
::JetPack 5.0 requires Ubuntu 20&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must install the required Software before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Connecting the Jetson AGX ===&lt;br /&gt;
&lt;br /&gt;
*To start setting up the Jetson AGX Xavier Development Kit, you need to connect it to your host computer using the included USB-C to USB-A cable. This cable has to be connected to the USB-C port on the front side of the Jetson AGX.&lt;br /&gt;
[[File:JetsonFrontSide.jpg|500px|Jetson AGX Front Side]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Next, connect it to your local network using the Ethernet port on the back side. On this side also connect a monitor using HDMI and keyboard/mouse using USB-A. If you need a second USB-A port, an USB-C to USB-A adapter is included which can be plugged in to the USB-C port on this side.&lt;br /&gt;
[[File:JetsonBackSide.jpg|500px|Jetson AGX Back Side]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Finally, connect the Jetson to the power supply.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Installing the JetPack ===&lt;br /&gt;
&lt;br /&gt;
*To install the JetPack, you need to bring the Jetson AGX into force recovery mode. To do this, press and hold the force-recovery button (middle button). Then press the power button (left button) and release both buttons.&lt;br /&gt;
[[File:JetsonButtons.jpg|500px|Jetson AGX Buttons]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Start the Nvidia SDK Manager on your host computer, make sure that the Jetson AGX is detected and choose your desired JetPack version.&lt;br /&gt;
[[File:JetsonSetup1.png|500px|Nvidia SDK Manager Choose JetPack Version]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*On the next page you can choose if the SDK Components should be installed, which is the default. Make sure you have enough disk space available on your device and click continue.&lt;br /&gt;
[[File:JetsonSetup2.png|500px|Nvidia SDK Manager Choose SDK Components]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*When the SDK manager is about to flash the OS to the Jetson AGX, choose Manual Setup to put the device into force recovery mode (as it should already be) and choose the storage device it should be installed to.&lt;br /&gt;
[[File:JetsonSetup3.png|500px|Nvidia SDK Manager Flash Settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*During the installation, you need to complete the Ubuntu configuration on the Jetson AGX using the connected monitor and keyboard/mouse.&lt;br /&gt;
&lt;br /&gt;
*Afterwards, enter the chosen username and password in the SDK Manager to allow it to complete the installation.&lt;br /&gt;
[[File:JetsonSetup4.png|500px|Nvidia SDK Manager Enter user credentials]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*After the installation is completed, you can connect to the Jetson AGX using SSH.&lt;br /&gt;
[[File:JetsonSetup5.png|500px|Nvidia SDK Manager Setup Complete]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Enabling VNC ===&lt;br /&gt;
&lt;br /&gt;
To enable VNC, run the following commands as provided by Nvidia:&lt;br /&gt;
&lt;br /&gt;
*Enable the VNC server to start each time you log in&lt;br /&gt;
 mkdir -p ~/.config/autostart&lt;br /&gt;
 cp /usr/share/applications/vino-server.desktop ~/.config/autostart&lt;br /&gt;
&lt;br /&gt;
*Configure the VNC server&lt;br /&gt;
 gsettings set org.gnome.Vino prompt-enabled false&lt;br /&gt;
 gsettings set org.gnome.Vino require-encryption false&lt;br /&gt;
&lt;br /&gt;
*Change the desktop resolution&lt;br /&gt;
If no monitor is connected to the Jetson AGX, the default resolution (for VNC) is 640x480&lt;br /&gt;
To change this, append the following lines to &amp;lt;code&amp;gt;/etc/X11/xorg.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
 Section &amp;quot;Screen&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;Default Screen&amp;quot;&lt;br /&gt;
    Monitor       &amp;quot;Configured Monitor&amp;quot;&lt;br /&gt;
    Device        &amp;quot;Tegra0&amp;quot;&lt;br /&gt;
    SubSection &amp;quot;Display&amp;quot;&lt;br /&gt;
        Depth    24&lt;br /&gt;
        Virtual 1280 800 # Modify the resolution by editing these values&lt;br /&gt;
    EndSubSection&lt;br /&gt;
 EndSection&lt;br /&gt;
&lt;br /&gt;
*Reboot the system&lt;br /&gt;
 sudo reboot&lt;br /&gt;
&lt;br /&gt;
Note: You can only connect to the VNC server after logging in to the Jetson locally. To be able to always use VNC enable automatic login in the Ubuntu system settings on the Jetson AGX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Installing TensorFlow and Keras ===&lt;br /&gt;
Nvidia provides a custom TensorFlow package, which requires the installation of some dependencies first (https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#prereqs).&lt;br /&gt;
&lt;br /&gt;
*Install required system packages&lt;br /&gt;
 sudo apt-get update&lt;br /&gt;
 sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran&lt;br /&gt;
&lt;br /&gt;
*Install/Upgrade pip3&lt;br /&gt;
 sudo apt-get install python3-pip&lt;br /&gt;
 sudo pip3 install -U pip testresources setuptools==49.6.0&lt;br /&gt;
&lt;br /&gt;
*Install python packages&lt;br /&gt;
 sudo pip3 install -U --no-deps numpy==1.19.4 future==0.18.2 mock==3.0.5 keras_preprocessing==1.1.2 keras_applications==1.0.8 gast==0.4.0 protobuf pybind11 cython pkgconfig packaging&lt;br /&gt;
 sudo env H5PY_SETUP_REQUIRES=0 pip3 install -U h5py==3.1.0&lt;br /&gt;
&lt;br /&gt;
*Install TensorFlow&lt;br /&gt;
 sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v46 tensorflow&lt;br /&gt;
Note: This command installs the latest available TensorFlow version for the specified JetPack version. If you installed a different version, you need to change the URL: e.g. /v46 for JetPack 4.6, /v461 for JetPack 4.6.1, /v50 for JetPack 5.0&lt;br /&gt;
&lt;br /&gt;
*Install Keras&lt;br /&gt;
 sudo pip3 install keras==2.5.0rc0&lt;br /&gt;
Note: Depending on your installed JetPack and TensorFlow versions you might need a different version of keras.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Jetson AGX Xavier Development Kit]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Jetson AGX Xavier Development Kit User Guide https://developer.download.nvidia.com/embedded/L4T/r32-3-1_Release_v1.0/jetson_agx_xavier_developer_kit_user_guide.pdf&lt;br /&gt;
* NVIDIA SDK Manager Installation Guide https://docs.nvidia.com/sdk-manager/download-run-sdkm/index.html&lt;br /&gt;
* Tensorflow Installation Guide https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#prereqs&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=AI:_Anomaly_Detection_in_logfiles&amp;diff=10341</id>
		<title>AI: Anomaly Detection in logfiles</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=AI:_Anomaly_Detection_in_logfiles&amp;diff=10341"/>
		<updated>2022-07-13T14:48:09Z</updated>

		<summary type="html">&lt;p&gt;LPutz: /* Step 4 - Plot the results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10148; IMPORTANT: This page is still under construction.&amp;lt;/div&amp;gt;&lt;br /&gt;
== Summary == &lt;br /&gt;
&lt;br /&gt;
This guide will create a basic AI model to perform binary classification in order to detect anomalies in logfiles.&lt;br /&gt;
This AI model is also suitable for the [[Jetson AGX Xavier Development Kit]]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Packages: TensorFlow, Keras, Pandas, sklearn, numpy, seaborn, matplotlib&lt;br /&gt;
* Software: Pycharm or any other python editor&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0 - Import the needed packages/libraries ===&lt;br /&gt;
&lt;br /&gt;
 from keras.callbacks import EarlyStopping, ModelCheckpoint # for training&lt;br /&gt;
 from keras.models import Sequential, load_model # for model&lt;br /&gt;
 from keras.layers import Dense, Activation # layers and activation function&lt;br /&gt;
 import pandas as pd # read/prep dataset&lt;br /&gt;
 pd.options.mode.chained_assignment = None # removes warning&lt;br /&gt;
 import numpy as np # read/prep dataset&lt;br /&gt;
 import sklearn.model_selection as sk # dataset splitting&lt;br /&gt;
 import tensorflow as tf # for model&lt;br /&gt;
 import seaborn as sns # plotting&lt;br /&gt;
 from sklearn.metrics import confusion_matrix # confusion matrix&lt;br /&gt;
 from matplotlib import pyplot as plt # plotting&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Read the dataset ===&lt;br /&gt;
&lt;br /&gt;
First we need to read the data, for that we can use the predefined function from pandas &#039;read_csv&#039;&lt;br /&gt;
 logfile_features = pd.read_csv(path)&lt;br /&gt;
Afterwards we replace the infinite values with nans and drop them all together&lt;br /&gt;
 logfile_features.replace([np.inf, -np.inf], np.nan, inplace=True)&lt;br /&gt;
 logfile_features.dropna(inplace=True)&lt;br /&gt;
Our dataset has labels which define if its an attack or not, so we replace them with numericals (0 and 1)&lt;br /&gt;
 logfile_features[&amp;quot;Label&amp;quot;].replace({&amp;quot;Benign&amp;quot;: 0, &amp;quot;DoS attacks-Slowloris&amp;quot;: 1, &amp;quot;DoS attacks-GoldenEye&amp;quot;: 1}, inplace=True)&lt;br /&gt;
Next we shuffle our dataset&lt;br /&gt;
 logfile_features = logfile_features.sample(frac=1) &lt;br /&gt;
&lt;br /&gt;
Now we need to split our data into 3 parts: Training data (60%), Test data (20%) and Validation data (20%).&lt;br /&gt;
To do that we use the following methods&lt;br /&gt;
 train_dataset, temp_test_dataset = sk.train_test_split(logfile_features, test_size=0.4)&lt;br /&gt;
 test_dataset, valid_dataset = sk.train_test_split(temp_test_dataset, test_size=0.5)&lt;br /&gt;
&lt;br /&gt;
Next we extract the labels from the actual dataset, we need them extra for our training&lt;br /&gt;
 train_labels = train_dataset.pop(&#039;Label&#039;)&lt;br /&gt;
 test_labels = test_dataset.pop(&#039;Label&#039;)&lt;br /&gt;
 valid_labels = valid_dataset.pop(&#039;Label&#039;)&lt;br /&gt;
&lt;br /&gt;
To norm our data correctly we need to get the stats of our training data (mean and standard deviation)&lt;br /&gt;
 train_stats = train_dataset.describe()&lt;br /&gt;
 train_stats = train_stats.transpose()&lt;br /&gt;
&lt;br /&gt;
For norming we use a following method&lt;br /&gt;
 def norm(x, stats):&lt;br /&gt;
     return (x - stats[&#039;mean&#039;]) / stats[&#039;std&#039;]&lt;br /&gt;
This method can then be used the following way&lt;br /&gt;
  normed_train_data = norm(train_dataset, train_stats)&lt;br /&gt;
  normed_test_data = norm(test_dataset, train_stats)&lt;br /&gt;
  normed_valid_dataset = norm(valid_dataset, train_stats)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Create a model ===&lt;br /&gt;
&lt;br /&gt;
First we need to create a sequential model, which can be trained later&lt;br /&gt;
 model = Sequential()&lt;br /&gt;
&lt;br /&gt;
The next step is to create an input layer with exactly as many nodes as features in our training data&lt;br /&gt;
  model.add(Dense(normed_train_data.shape[1],input_shape=(normed_train_data.shape[1],))&lt;br /&gt;
&lt;br /&gt;
Next a hidden layer consisting of 128 nodes with the ReLU (Rectified Linear Unit) activation function&lt;br /&gt;
 model.add(Dense(128, Activation(&#039;relu&#039;)))&lt;br /&gt;
&lt;br /&gt;
And finally the output layer consisting of 1 node which represents &#039;attack&#039; or &#039;no attack&#039;&lt;br /&gt;
 model.add(Dense(1))&lt;br /&gt;
&lt;br /&gt;
Now we could change the learning rate to a specific value, but we just leave it at the default 0.001&lt;br /&gt;
 learning_rate = 0.001&lt;br /&gt;
For the optimizer we just use the Adam Optimizer with the pre-defined learning rate&lt;br /&gt;
 optimizer = tf.optimizers.Adam(learning_rate)&lt;br /&gt;
&lt;br /&gt;
Lastly we need to compile the model, for the loss function we use BinaryCrossentropy, our optimizer and the metric should be the accuarcy of the model&lt;br /&gt;
 model.compile(loss=tf.keras.losses.BinaryCrossentropy(from_logits=True), &lt;br /&gt;
   optimizer=optimizer,&lt;br /&gt;
   metrics=[&#039;accuracy&#039;])&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Train the model ===&lt;br /&gt;
&lt;br /&gt;
First we set our epochs, a complete pass of the normed training data through the model, and our batch size, after how many datapoints the model gets updated&lt;br /&gt;
 EPOCHS = 5000&lt;br /&gt;
 batch_size = 1024&lt;br /&gt;
&lt;br /&gt;
To not have to wait for 5000 training epochs to finish and to prevent overfitting we can set an early stop&lt;br /&gt;
 es = EarlyStopping(monitor=&#039;val_loss&#039;, mode=&#039;min&#039;, verbose=1, patience=2)&lt;br /&gt;
&lt;br /&gt;
Finally the training, model fitting, can start&lt;br /&gt;
 with tf.device(&#039;/CPU:0&#039;): &lt;br /&gt;
    # with tf.device(&#039;/GPU:0&#039;): # wenn man mit der Grafikkarte trainieren will&lt;br /&gt;
    history = model.fit(&lt;br /&gt;
        normed_train_data,&lt;br /&gt;
        train_labels,&lt;br /&gt;
        batch_size=batch_size,&lt;br /&gt;
        epochs=EPOCHS,&lt;br /&gt;
        verbose=1,&lt;br /&gt;
        shuffle=True,&lt;br /&gt;
        steps_per_epoch=int(normed_train_data.shape[0] / batch_size),&lt;br /&gt;
        validation_data=(normed_valid_dataset, valid_labels), callbacks=[es],&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Plot the results ===&lt;br /&gt;
After the training has been completed you can easily plot the accuarcy and validation accuracy during the training using&lt;br /&gt;
 plt.plot(history.history[&#039;accuracy&#039;])&lt;br /&gt;
 plt.plot(history.history[&#039;val_accuracy&#039;])&lt;br /&gt;
 plt.title(&#039;model accuracy&#039;)&lt;br /&gt;
 plt.ylabel(&#039;accuracy&#039;)&lt;br /&gt;
 plt.xlabel(&#039;epoch&#039;)&lt;br /&gt;
 plt.legend([&#039;Train&#039;, &#039;Cross-Validation&#039;], loc=&#039;upper left&#039;)&lt;br /&gt;
 plt.show()&lt;br /&gt;
&lt;br /&gt;
To show the accuarcy when tested against the test data, meaning data the model didn&#039;t train with, we can use a confusion matrix the following&lt;br /&gt;
 ax = plt.subplot()&lt;br /&gt;
 predict_results = model.predict(normed_test_data)&lt;br /&gt;
 predict_results = (predict_results &amp;gt; 0.5)&lt;br /&gt;
 cm = confusion_matrix(test_labels, predict_results)&lt;br /&gt;
 ax.set_xlabel(&#039;Predicted labels&#039;)&lt;br /&gt;
 ax.set_ylabel(&#039;True labels&#039;)&lt;br /&gt;
 ax.set_title(&#039;Confusion Matrix&#039;)&lt;br /&gt;
 ax.xaxis.set_ticklabels([&#039;No Attack&#039;, &#039;Attack&#039;])&lt;br /&gt;
 ax.yaxis.set_ticklabels([&#039;No Attack&#039;, &#039;Attack&#039;])&lt;br /&gt;
 plt.show()&lt;br /&gt;
&lt;br /&gt;
[[File:AI_model_accuracy.png|500px|Model Accuracy]]&lt;br /&gt;
[[File:AI_confusion_matrix.png|500px|Confusion Matrix]]&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Jetson AGX Xavier Development Kit]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:AI_confusion_matrix.png&amp;diff=10339</id>
		<title>File:AI confusion matrix.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:AI_confusion_matrix.png&amp;diff=10339"/>
		<updated>2022-07-13T14:47:06Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:AI_model_accuracy.png&amp;diff=10338</id>
		<title>File:AI model accuracy.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:AI_model_accuracy.png&amp;diff=10338"/>
		<updated>2022-07-13T14:46:58Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Jetson_AGX_Xavier_Development_Kit:_Setup&amp;diff=10255</id>
		<title>Jetson AGX Xavier Development Kit: Setup</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Jetson_AGX_Xavier_Development_Kit:_Setup&amp;diff=10255"/>
		<updated>2022-07-10T15:34:18Z</updated>

		<summary type="html">&lt;p&gt;LPutz: Added setup instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a guide to set up the [[Jetson AGX Xavier Development Kit]]. After this guide the user will be able to connect with SSH and VNC.&lt;br /&gt;
This guide will also show the installation process of TensorFlow and Keras for AI-Research purposes.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Operating system: Ubuntu 18*&lt;br /&gt;
* Software: Nvidia SDK Manager https://developer.nvidia.com/nvidia-sdk-manager&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#42;Depending on the desired JetPack version different Ubuntu versions are required.&lt;br /&gt;
&lt;br /&gt;
::JetPack 4.x requires Ubuntu 18&lt;br /&gt;
&lt;br /&gt;
::JetPack 5.0 requires Ubuntu 20&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must install the required Software before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Connecting the Jetson AGX ===&lt;br /&gt;
&lt;br /&gt;
*To start setting up the Jetson AGX Xavier Development Kit, you need to connect it to your host computer using the included USB-C to USB-A cable. This cable has to be connected to the USB-C port on the front side of the Jetson AGX.&lt;br /&gt;
[[File:JetsonFrontSide.jpg|500px|Jetson AGX Front Side]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Next, connect it to your local network using the Ethernet port on the back side. On this side also connect a monitor using HDMI and keyboard/mouse using USB-A. If you need a second USB-A port, an USB-C to USB-A adapter is included which can be plugged in to the USB-C port on this side.&lt;br /&gt;
[[File:JetsonBackSide.jpg|500px|Jetson AGX Back Side]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Finally, connect the Jetson to the power supply.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Installing the JetPack ===&lt;br /&gt;
&lt;br /&gt;
*To install the JetPack, you need to bring the Jetson AGX into force recovery mode. To do this, press and hold the force-recovery button (middle button). Then press the power button (left button) and release both buttons.&lt;br /&gt;
[[File:JetsonButtons.jpg|500px|Jetson AGX Buttons]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Start the Nvidia SDK Manager on your host computer, make sure that the Jetson AGX is detected and choose your desired JetPack version.&lt;br /&gt;
[[File:JetsonSetup1.png|500px|Nvidia SDK Manager Choose JetPack Version]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*On the next page you can choose if the SDK Components should be installed, which is the default. Make sure you have enough disk space available on your device and click continue.&lt;br /&gt;
[[File:JetsonSetup2.png|500px|Nvidia SDK Manager Choose SDK Components]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*When the SDK manager is about to flash the OS to the Jetson AGX, choose Manual Setup to put the device into force recovery mode (as it should already be) and choose the storage device it should be installed to.&lt;br /&gt;
[[File:JetsonSetup3.png|500px|Nvidia SDK Manager Flash Settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*During the installation, you need to complete the Ubuntu configuration on the Jetson AGX using the connected monitor and keyboard/mouse.&lt;br /&gt;
&lt;br /&gt;
*Afterwards, enter the chosen username and password in the SDK Manager to allow it to complete the installation.&lt;br /&gt;
[[File:JetsonSetup4.png|500px|Nvidia SDK Manager Enter user credentials]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*After the installation is completed, you can connect to the Jetson AGX using SSH.&lt;br /&gt;
[[File:JetsonSetup5.png|500px|Nvidia SDK Manager Setup Complete]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Enabling VNC ===&lt;br /&gt;
&lt;br /&gt;
To enable VNC, run the following commands as provided by Nvidia:&lt;br /&gt;
&lt;br /&gt;
*Enable the VNC server to start each time you log in&lt;br /&gt;
 mkdir -p ~/.config/autostart&lt;br /&gt;
 cp /usr/share/applications/vino-server.desktop ~/.config/autostart&lt;br /&gt;
&lt;br /&gt;
*Configure the VNC server&lt;br /&gt;
 gsettings set org.gnome.Vino prompt-enabled false&lt;br /&gt;
 gsettings set org.gnome.Vino require-encryption false&lt;br /&gt;
&lt;br /&gt;
*Change the desktop resolution&lt;br /&gt;
If no monitor is connected to the Jetson AGX, the default resolution (for VNC) is 640x480&lt;br /&gt;
To change this, append the following lines to &amp;lt;code&amp;gt;/etc/X11/xorg.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
 Section &amp;quot;Screen&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;Default Screen&amp;quot;&lt;br /&gt;
    Monitor       &amp;quot;Configured Monitor&amp;quot;&lt;br /&gt;
    Device        &amp;quot;Tegra0&amp;quot;&lt;br /&gt;
    SubSection &amp;quot;Display&amp;quot;&lt;br /&gt;
        Depth    24&lt;br /&gt;
        Virtual 1280 800 # Modify the resolution by editing these values&lt;br /&gt;
    EndSubSection&lt;br /&gt;
 EndSection&lt;br /&gt;
&lt;br /&gt;
*Reboot the system&lt;br /&gt;
 sudo reboot&lt;br /&gt;
&lt;br /&gt;
Note: You can only connect to the VNC server after logging in to the Jetson locally. To be able to always use VNC enable automatic login in the Ubuntu system settings on the Jetson AGX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Installing TensorFlow and Keras ===&lt;br /&gt;
Nvidia provides a custom TensorFlow package, which requires the installation of some dependencies first (https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#prereqs).&lt;br /&gt;
&lt;br /&gt;
*Install required system packages&lt;br /&gt;
 sudo apt-get update&lt;br /&gt;
 sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran&lt;br /&gt;
&lt;br /&gt;
*Install/Upgrade pip3&lt;br /&gt;
 sudo apt-get install python3-pip&lt;br /&gt;
 sudo pip3 install -U pip testresources setuptools==49.6.0&lt;br /&gt;
&lt;br /&gt;
*Install python packages&lt;br /&gt;
 sudo pip3 install -U --no-deps numpy==1.19.4 future==0.18.2 mock==3.0.5 keras_preprocessing==1.1.2 keras_applications==1.0.8 gast==0.4.0 protobuf pybind11 cython pkgconfig packaging&lt;br /&gt;
 sudo env H5PY_SETUP_REQUIRES=0 pip3 install -U h5py==3.1.0&lt;br /&gt;
&lt;br /&gt;
*Install TensorFlow&lt;br /&gt;
 sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v46 tensorflow&lt;br /&gt;
Note: This command installs the latest available TensorFlow version for the specified JetPack version. If you installed a different version, you need to change the URL: e.g. /v46 for JetPack 4.6, /v461 for JetPack 4.6.1, /v50 for JetPack 5.0&lt;br /&gt;
&lt;br /&gt;
*Install Keras&lt;br /&gt;
 sudo pip3 install keras==2.5.0rc0&lt;br /&gt;
Note: Depending on your installed JetPack and TensorFlow versions you might need a different version of keras.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Jetson AGX Xavier Development Kit]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup5.png&amp;diff=10254</id>
		<title>File:JetsonSetup5.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup5.png&amp;diff=10254"/>
		<updated>2022-07-10T15:09:32Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup4.png&amp;diff=10253</id>
		<title>File:JetsonSetup4.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup4.png&amp;diff=10253"/>
		<updated>2022-07-10T15:09:24Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup3.png&amp;diff=10252</id>
		<title>File:JetsonSetup3.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup3.png&amp;diff=10252"/>
		<updated>2022-07-10T15:09:18Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup2.png&amp;diff=10251</id>
		<title>File:JetsonSetup2.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup2.png&amp;diff=10251"/>
		<updated>2022-07-10T15:09:12Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup1.png&amp;diff=10250</id>
		<title>File:JetsonSetup1.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonSetup1.png&amp;diff=10250"/>
		<updated>2022-07-10T15:09:03Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonButtons.jpg&amp;diff=10249</id>
		<title>File:JetsonButtons.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonButtons.jpg&amp;diff=10249"/>
		<updated>2022-07-10T15:08:48Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonBackSide.jpg&amp;diff=10248</id>
		<title>File:JetsonBackSide.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonBackSide.jpg&amp;diff=10248"/>
		<updated>2022-07-10T15:07:57Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonFrontSide.jpg&amp;diff=10247</id>
		<title>File:JetsonFrontSide.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:JetsonFrontSide.jpg&amp;diff=10247"/>
		<updated>2022-07-10T15:06:09Z</updated>

		<summary type="html">&lt;p&gt;LPutz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LPutz</name></author>
	</entry>
</feed>