]> git.somenet.org - pub/jan/netsec2.git/blob - report/content/exercise2.tex
Fixed and "fixed" latex-build-errors :/
[pub/jan/netsec2.git] / report / content / exercise2.tex
1
2 \section{Exercise 2 - Task 1}
3 \subsection{Rep:2.a}
4
5 First we converted the file {\tt team15\_ex21.pcap} from the pcap-ng format to the pcap format to be able to use it with {\tt scapy}.
6 % TODO: fixme!
7 %\fbox{\parbox{{\textwidth}
8 %}}
9 \begin{lstlisting}
10 $ editcap -F libpcap team15_ex21.pcap ex21.pcap
11 \end{lstlisting}
12
13 Then we filtered out the large flows with more or equal than 400 packets.
14
15 % TODO include readflows.py-source
16
17 \begin{lstlisting}
18 $ ./readflows.py
19 {('113.15.85.25', '179.160.238.111'): (463, 0),
20  ('114.176.157.191', '221.72.61.209'): (541, 0),
21  ('134.134.122.170', '179.187.246.122'): (419, 0),
22  ('179.187.53.117', '129.49.173.82'): (472, 0),
23  ('211.2.138.61', '144.66.241.253'): (462, 151),
24  ('221.100.234.92', '161.194.49.146'): (547, 0),
25  ('8.73.98.88', '144.66.191.77'): (535, 0)}
26 \end{lstlisting}
27
28 (Format: {\tt (src, dst) : (srctodst, dsttosrc)})
29
30 We then split the pcap into different files for each stream using the following filter expressions into separate files:
31 \begin{lstlisting}
32 (ip.addr == 113.15.85.25 and ip.addr == 179.160.238.111)
33 (ip.addr == 114.176.157.191 and ip.addr == 221.72.61.209)
34 (ip.addr == 134.134.122.170 and ip.addr == 179.187.246.122)
35 (ip.addr == 179.187.53.117 and ip.addr == 129.49.173.82)
36 (ip.addr == 211.2.138.61 and ip.addr == 144.66.241.253)
37 (ip.addr == 221.100.234.92 and ip.addr == 161.194.49.146)
38 (ip.addr == 8.73.98.88 and ip.addr == 144.66.191.77)
39 \end{lstlisting}
40
41 We also did generate csv files for all pcap files.
42
43 Then we generated graphs to visualize the respective flows and found that the second flow has suspicious source ports, alternating between two values ({\tt 5950} and {\tt 5960}).
44
45 % TODO include gnuplot-source
46
47 % TODO include image
48 large\_flow\_2.png
49
50 % TODO include bitstobytes.py-source
51
52 \begin{lstlisting}
53 $ awk -F, '{print $8}' large_flow_2.csv | sed -e 's/5950/0/' -e 's/5960/1/' -e 's/"//g'
54 $ ./bitstobytes.py
55 \end{lstlisting}
56
57 \subsection{Rep:2.b}
58 %\fbox{\parbox{\textwidth{{Data acquired. Key for message (len=42 \& pkts>200): nSa123 (Scott)}}
59
60 \section{Exercise 2 - Task 2}
61 \subsection{Rep:2.c}
62
63 Then we converted the file {\tt team15\_ex22.pcap} from the pcap-ng format to the pcap format to be able to use it with {\tt scapy}.
64
65 \begin{lstlisting}
66 $ editcap -F libpcap team15_ex22.pcap ex22.pcap
67 \end{lstlisting}
68
69 Then we filtered out the large flows with more than 200 packets and a frame length of 42 as mentioned in the solution from task 1.
70
71 % TODO \begin{didntwork}
72 ./task2/readflows.py
73 % {('53.151.211.106', '217.115.203.44'): (213, 0)}
74
75 filter into file
76 ip.addr == 53.151.211.106 and ip.addr == 217.115.203.44 and eth.len == 42
77
78 generate graph:
79 large\_flow.png
80
81 save bytes (ipid) from stream to file
82 ./decode\_ipid.py
83
84 try decoding with password from previous task
85 openssl enc -d -rc4 -nosalt -k nSa123 -in stream\_encrypted -out stream\_decrypted
86
87 -> didn't work
88
89 tried reversing the bytes (lower byte first, upper byte next)
90
91 -> didn't work
92
93 trying to decode the second-largest flow:
94 ip.addr == 96.55.191.225 and ip.addr == 217.115.203.44 and eth.len == 42
95
96 -> didn't work
97 % TODO \end{didntwork}
98
99 Finally we found out, that scapy removes the frame length when parsing packets with the {\tt PcapReader}.
100
101 This does not happen with the {\tt PcapRawReader}, so we rewrote the script a bit.
102
103 % TODO continue writing here
104
105 filter into files
106
107 ./readflows.py
108
109 manually create csv files
110
111 for i in large\_flow\_*.csv ; do ./../../only\_decimal.sh \$i > \${i\%.csv}.dehexed.csv ; done
112
113 ./autocorrelate.sh | grep -v "All values are identical" | sort -k2
114
115 -> ./parse\_stream\_data.py
116
117 \subsection{Rep:2.c}
118 Agent South was captured! Aborting operation. (Agent Scott)