{"id":12700,"date":"2019-01-31T02:26:07","date_gmt":"2019-01-31T01:26:07","guid":{"rendered":"http:\/\/blog.wenzlaff.de\/?p=12700"},"modified":"2019-01-31T18:48:35","modified_gmt":"2019-01-31T17:48:35","slug":"user-webseiten-sniffing-mit-tshark-auf-einem-headless-raspberry-pi-oder-dump-and-analyze-network-traffic-with-tshark","status":"publish","type":"post","link":"http:\/\/blog.wenzlaff.de\/?p=12700","title":{"rendered":"User Webseiten Sniffing mit tshark auf einem headless Raspberry Pi oder &#8222;Dump and analyze network traffic with tshark&#8220;"},"content":{"rendered":"<p>Wie kann eine User Aktion mitgelesen werden, die ein User im Browser t\u00e4tigt? Also wie k\u00f6nnen wir die URLs usw. mitlesen, die von und zu einem Browser gehen? Das alle von der Konsole aus z.B. mit einem Raspberry Pi? Das hatte ich schon mal vor 5 Jahren nicht ganz so ausf\u00fchrlich <a href=\"http:\/\/blog.wenzlaff.de\/?s=tshark\" rel=\"noopener\" target=\"_blank\">hier<\/a> beschrieben. Noch mit <a href=\"https:\/\/www.wireshark.org\/docs\/man-pages\/tshark.html\" rel=\"noopener\" target=\"_blank\">tshark<\/a> 1.12. jetzt mal mit 2.6.5. Hier ein kleiner Einblick in die Arbeit eines <strong>Pentesters<\/strong>.<\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-20.40.51.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-20.40.51.png\" alt=\"\" width=\"990\" height=\"618\" class=\"aligncenter size-full wp-image-12702\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-20.40.51.png 990w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-20.40.51-300x187.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-20.40.51-768x479.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Also zu erst der User Task, er ruf in einer Konsole die URL www.wenzlaff.info auf. Daf\u00fcr benutzen wir den Browser lynx. Wenn der noch nicht auf dem Pi installiert ist, kann das schnell mit einem <strong>sudo apt-get install lynx<\/strong> durchgef\u00fchrt werden. Dann der erste Test, Aufruf:<\/p>\n<p><strong>lynx www.wenzlaff.de<\/strong><!--more--><\/p>\n<p>Es \u00f6ffnet sich die Seite im Browser:<\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_084630-CapturFiles.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_084630-CapturFiles.png\" alt=\"\" width=\"1182\" height=\"764\" class=\"aligncenter size-full wp-image-12703\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_084630-CapturFiles.png 1182w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_084630-CapturFiles-300x194.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_084630-CapturFiles-768x496.png 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_084630-CapturFiles-1024x662.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Ok, das ist unser Testfall, den wir jedesmal aufrufen. Dann schlie\u00dfen wir den Browser wieder mit <strong>q<\/strong> und <strong>y<\/strong>.<\/p>\n<p>Nun schauen wir uns in einer neuen Konsole erst einmal alle Schnitstellen mit <strong>tshark<\/strong> an. Das kann mit <strong>sudo apt-get install tshark<\/strong> leicht installiert werden. Also erster Test. Welche Schnittstellen gibt es? Das geht mit <strong>tshark -D<\/strong><\/p>\n<pre class=\"lang:default decode:true \" >\r\npi@pi-bplus:~$ tshark -D\r\n1. eth0\r\n2. any\r\n3. lo (Loopback)\r\n4. nflog\r\n5. nfqueue\r\n6. usbmon1\r\n7. ciscodump (Cisco remote capture)\r\n8. randpkt (Random packet generator)\r\n9. sshdump (SSH remote capture)\r\n10. udpdump (UDP Listener remote capture)\r\n<\/pre>\n<p>Wir wollen mal direkt an der <strong>eth<\/strong> <strong>alles<\/strong> Schnittstelle mithorchen, also die 1. Wir wollen alles was von und zum Host 10.0.0.0 geht (anpassen, auf eigene Rapberry Pi Adresse). Das geht mit<\/p>\n<p><strong>tshark -i 1 host 10.0.0.0<\/strong><\/p>\n<p>Liefert: <strong>Capturing on &#8218;eth0&#8216;<\/strong> dann kann in dem anderen Konsolen Fenster die Webabfrage <strong>lynx www.wenzlaff.info<\/strong> gestartet werden, es kommt dann eine Menge, das kann dann mit <strong>CTRL-C<\/strong> gestopt werden.<\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_085635-CapturFiles.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_085635-CapturFiles.png\" alt=\"\" width=\"1644\" height=\"764\" class=\"aligncenter size-full wp-image-12705\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_085635-CapturFiles.png 1644w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_085635-CapturFiles-300x139.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_085635-CapturFiles-768x357.png 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_085635-CapturFiles-1024x476.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>oder auch als Hex und Asci Ausgabe mit einem zus\u00e4tzlichen <strong>x<\/strong><\/p>\n<p><strong>tshark -ix 1 host 10.0.0.0<\/strong><\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_090156-CapturFiles.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_090156-CapturFiles.png\" alt=\"\" width=\"1644\" height=\"764\" class=\"aligncenter size-full wp-image-12706\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_090156-CapturFiles.png 1644w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_090156-CapturFiles-300x139.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_090156-CapturFiles-768x357.png 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_090156-CapturFiles-1024x476.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Das ist aber beides zuviel des Guten. Also Filtern wir mal nur die http Anfragen.<\/p>\n<p>Im Hex-Format, f\u00fcr Passw\u00f6rter ganz gut, mit Filter nur http<\/p>\n<p><strong>tshark -i 1 -Y http host 10.0.0.0<\/strong><\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-21.04.47.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-21.04.47.png\" alt=\"\" width=\"944\" height=\"120\" class=\"aligncenter size-full wp-image-12708\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-21.04.47.png 944w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-21.04.47-300x38.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/Bildschirmfoto-2019-01-30-um-21.04.47-768x98.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Das ist ja schon das was wir wollten.<br \/>\noder im hex und text Format:<\/p>\n<p>tshark -xi 1 -Y http host 10.0.0.0<\/p>\n<p>Mit etwas Farbe in die Ausgabe sieht es schon viel besser aus, wir browsen mal ein paar Seiten an:<\/p>\n<p><strong>tshark -i 1 &#8211;color -Y http host 10.0.0.0<\/strong><\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_091217-CapturFiles.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_091217-CapturFiles.png\" alt=\"\" width=\"1616\" height=\"736\" class=\"aligncenter size-full wp-image-12710\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_091217-CapturFiles.png 1616w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_091217-CapturFiles-300x137.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_091217-CapturFiles-768x350.png 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/01\/20190130_091217-CapturFiles-1024x466.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Da kann man denn schon genau erkennen welche Seiten der User angesehen und auch welche Datei genau runtergeladen wurde.<\/p>\n<p>Oder wir schneiden mal nur 10 Sekunden mit, und beenden das Programm dann:<\/p>\n<p><strong>tshark -i 1 -Y http &#8211;color -a duration:10 host 10.0.0.0<\/strong><\/p>\n<p>Es geht auch die ganze Seite zum Mitlesen mit <strong>-V<\/strong><\/p>\n<p><strong>tshark -i 1 -Y http &#8211;color -a duration:60 -V host 10.0.0.0<\/strong><\/p>\n<p>Nun mal was f\u00fcr 30 Sekunden in eine Datei pipen<\/p>\n<p><strong>tshark -i 1 -Y http -a duration:30 host 10.0.7.43 > mitschnitt-1.txt<\/strong><\/p>\n<p>Ok, dann noch alle Optionen mit <strong>tshark -h<\/strong>:<\/p>\n<pre class=\"lang:default decode:true \" >tshark -h\r\nTShark (Wireshark) 2.6.5 (Git v2.6.5 packaged as 2.6.5-1~deb9u1)\r\nDump and analyze network traffic.\r\nSee https:\/\/www.wireshark.org for more information.\r\n\r\nUsage: tshark [options] ...\r\n\r\nCapture interface:\r\n  -i &lt;interface&gt;           name or idx of interface (def: first non-loopback)\r\n  -f &lt;capture filter&gt;      packet filter in libpcap filter syntax\r\n  -s &lt;snaplen&gt;             packet snapshot length (def: appropriate maximum)\r\n  -p                       don't capture in promiscuous mode\r\n  -I                       capture in monitor mode, if available\r\n  -B &lt;buffer size&gt;         size of kernel buffer (def: 2MB)\r\n  -y &lt;link type&gt;           link layer type (def: first appropriate)\r\n  --time-stamp-type &lt;type&gt; timestamp method for interface\r\n  -D                       print list of interfaces and exit\r\n  -L                       print list of link-layer types of iface and exit\r\n  --list-time-stamp-types  print list of timestamp types for iface and exit\r\n\r\nCapture stop conditions:\r\n  -c &lt;packet count&gt;        stop after n packets (def: infinite)\r\n  -a &lt;autostop cond.&gt; ...  duration:NUM - stop after NUM seconds\r\n                           filesize:NUM - stop this file after NUM KB\r\n                              files:NUM - stop after NUM files\r\nCapture output:\r\n  -b &lt;ringbuffer opt.&gt; ... duration:NUM - switch to next file after NUM secs\r\n                           interval:NUM - create time intervals of NUM secs\r\n                           filesize:NUM - switch to next file after NUM KB\r\n                              files:NUM - ringbuffer: replace after NUM files\r\nInput file:\r\n  -r &lt;infile&gt;              set the filename to read from (- to read from stdin)\r\n\r\nProcessing:\r\n  -2                       perform a two-pass analysis\r\n  -M &lt;packet count&gt;        perform session auto reset\r\n  -R &lt;read filter&gt;         packet Read filter in Wireshark display filter syntax\r\n                           (requires -2)\r\n  -Y &lt;display filter&gt;      packet displaY filter in Wireshark display filter\r\n                           syntax\r\n  -n                       disable all name resolutions (def: all enabled)\r\n  -N &lt;name resolve flags&gt;  enable specific name resolution(s): \"mnNtdv\"\r\n  -d &lt;layer_type&gt;==&lt;selector&gt;,&lt;decode_as_protocol&gt; ...\r\n                           \"Decode As\", see the man page for details\r\n                           Example: tcp.port==8888,http\r\n  -H &lt;hosts file&gt;          read a list of entries from a hosts file, which will\r\n                           then be written to a capture file. (Implies -W n)\r\n  --enable-protocol &lt;proto_name&gt;\r\n                           enable dissection of proto_name\r\n  --disable-protocol &lt;proto_name&gt;\r\n                           disable dissection of proto_name\r\n  --enable-heuristic &lt;short_name&gt;\r\n                           enable dissection of heuristic protocol\r\n  --disable-heuristic &lt;short_name&gt;\r\n                           disable dissection of heuristic protocol\r\nOutput:\r\n  -w &lt;outfile|-&gt;           write packets to a pcap-format file named \"outfile\"\r\n                           (or to the standard output for \"-\")\r\n  -C &lt;config profile&gt;      start with specified configuration profile\r\n  -F &lt;output file type&gt;    set the output file type, default is pcapng\r\n                           an empty \"-F\" option will list the file types\r\n  -V                       add output of packet tree        (Packet Details)\r\n  -O &lt;protocols&gt;           Only show packet details of these protocols, comma\r\n                           separated\r\n  -P                       print packet summary even when writing to a file\r\n  -S &lt;separator&gt;           the line separator to print between packets\r\n  -x                       add output of hex and ASCII dump (Packet Bytes)\r\n  -T pdml|ps|psml|json|jsonraw|ek|tabs|text|fields|?\r\n                           format of text output (def: text)\r\n  -j &lt;protocolfilter&gt;      protocols layers filter if -T ek|pdml|json selected\r\n                           (e.g. \"ip ip.flags text\", filter does not expand child\r\n                           nodes, unless child is specified also in the filter)\r\n  -J &lt;protocolfilter&gt;      top level protocol filter if -T ek|pdml|json selected\r\n                           (e.g. \"http tcp\", filter which expands all child nodes)\r\n  -e &lt;field&gt;               field to print if -Tfields selected (e.g. tcp.port,\r\n                           _ws.col.Info)\r\n                           this option can be repeated to print multiple fields\r\n  -E&lt;fieldsoption&gt;=&lt;value&gt; set options for output when -Tfields selected:\r\n     bom=y|n               print a UTF-8 BOM\r\n     header=y|n            switch headers on and off\r\n     separator=\/t|\/s|&lt;char&gt; select tab, space, printable character as separator\r\n     occurrence=f|l|a      print first, last or all occurrences of each field\r\n     aggregator=,|\/s|&lt;char&gt; select comma, space, printable character as\r\n                           aggregator\r\n     quote=d|s|n           select double, single, no quotes for values\r\n  -t a|ad|d|dd|e|r|u|ud|?  output format of time stamps (def: r: rel. to first)\r\n  -u s|hms                 output format of seconds (def: s: seconds)\r\n  -l                       flush standard output after each packet\r\n  -q                       be more quiet on stdout (e.g. when using statistics)\r\n  -Q                       only log true errors to stderr (quieter than -q)\r\n  -g                       enable group read access on the output file(s)\r\n  -W n                     Save extra information in the file, if supported.\r\n                           n = write network address resolution information\r\n  -X &lt;key&gt;:&lt;value&gt;         eXtension options, see the man page for details\r\n  -U tap_name              PDUs export mode, see the man page for details\r\n  -z &lt;statistics&gt;          various statistics, see the man page for details\r\n  --capture-comment &lt;comment&gt;\r\n                           add a capture comment to the newly created\r\n                           output file (only for pcapng)\r\n  --export-objects &lt;protocol&gt;,&lt;destdir&gt; save exported objects for a protocol to\r\n                           a directory named \"destdir\"\r\n  --color                  color output text similarly to the Wireshark GUI,\r\n                           requires a terminal with 24-bit color support\r\n                           Also supplies color attributes to pdml and psml formats\r\n                           (Note that attributes are nonstandard)\r\n  --no-duplicate-keys      If -T json is specified, merge duplicate keys in an object\r\n                           into a single key with as value a json array containing all\r\n                           values\r\nMiscellaneous:\r\n  -h                       display this help and exit\r\n  -v                       display version info and exit\r\n  -o &lt;name&gt;:&lt;value&gt; ...    override preference setting\r\n  -K &lt;keytab&gt;              keytab file to use for kerberos decryption\r\n  -G [report]              dump one of several available reports and exit\r\n                           default report=\"fields\"\r\n                           use \"-G help\" for more help\r\n\r\nDumpcap can benefit from an enabled BPF JIT compiler if available.\r\nYou might want to enable it by executing:\r\n \"echo 1 &gt; \/proc\/sys\/net\/core\/bpf_jit_enable\"\r\nNote that this can make your system less secure!<\/pre>\n<p>Oder <a href=\"https:\/\/www.wireshark.org\/docs\/man-pages\/tshark.html\" rel=\"noopener\" target=\"_blank\">hier auf der wireshark<\/a> Seite. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wie kann eine User Aktion mitgelesen werden, die ein User im Browser t\u00e4tigt? Also wie k\u00f6nnen wir die URLs usw. mitlesen, die von und zu einem Browser gehen? Das alle von der Konsole aus z.B. mit einem Raspberry Pi? Das hatte ich schon mal vor 5 Jahren nicht ganz so ausf\u00fchrlich hier beschrieben. Noch mit &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/blog.wenzlaff.de\/?p=12700\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eUser Webseiten Sniffing mit tshark auf einem headless Raspberry Pi oder &#8222;Dump and analyze network traffic with tshark&#8220;\u201c <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[220,808,1023,2752,1319,2713],"tags":[1460,3534,1585,3533,3536,3532,1727,3535],"class_list":["post-12700","post","type-post","status-publish","format-standard","hentry","category-anleitung","category-linux-2","category-raspberry-pi","category-raspberry-pi-zero-w","category-sicherheit-2","category-statistik","tag-browser","tag-http","tag-man-in-the-middel","tag-mithoeren","tag-pentester","tag-schniffen","tag-tshark","tag-verkehr"],"_links":{"self":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/12700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12700"}],"version-history":[{"count":0,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/12700\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12700"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}