From cbc62fec9d7856354306f5f8035e0caae0f65a27 Mon Sep 17 00:00:00 2001 From: Jan Vales Date: Sun, 17 Jan 2016 00:37:10 +0100 Subject: [PATCH] added red frames. --- report/content/exercise1.tex | 124 +++++++++++++++++------------------ report/main.tex | 5 +- 2 files changed, 65 insertions(+), 64 deletions(-) diff --git a/report/content/exercise1.tex b/report/content/exercise1.tex index b4847f1..5640c20 100644 --- a/report/content/exercise1.tex +++ b/report/content/exercise1.tex @@ -90,42 +90,42 @@ The message was \emph{\textbf{Starting transmission from Ministry of Cyber {\ucr By applying a corrective timing difference of 0.05 we can fully decode the message: \emph{\textbf{Starting transmission from Ministry of Cyber affairs. (Agent Scott)Startin}}\\ Final py-code -\begin{scriptsize}\begin{verbatim} -#!/usr/bin/env python - -import csv -import binascii - -def somedecode(filename): - with open(filename, 'rb') as csvfile: - spamreader = csv.reader(csvfile, delimiter=',', quotechar='"') - header = last = None - ln = 0 - v = "" - - for row in spamreader: - if header is None: - header = row - continue - if last is None: - last = row - continue - - va = str(int((float(row[1])-float(last[1])-0.05)*10)) - if va not in ["0","1"]: - va = "1" - - v = v+va - ln += 1 - if ln == 8: - print binascii.unhexlify('%x' % int(v, 2)), - v = "" - ln = 0 - last = row - -if __name__ == "__main__": - somedecode("filtered.dehexed.csv") -\end{verbatim}\end{scriptsize} +\begin{redframe}\begin{scriptsize}\begin{verbatim} +#!/usr/bin/env python + +import csv +import binascii + +def somedecode(filename): + with open(filename, 'rb') as csvfile: + spamreader = csv.reader(csvfile, delimiter=',', quotechar='"') + header = last = None + ln = 0 + v = "" + + for row in spamreader: + if header is None: + header = row + continue + if last is None: + last = row + continue + + va = str(int((float(row[1])-float(last[1])-0.05)*10)) + if va not in ["0","1"]: + va = "1" + + v = v+va + ln += 1 + if ln == 8: + print binascii.unhexlify('%x' % int(v, 2)), + v = "" + ln = 0 + last = row + +if __name__ == "__main__": + somedecode("filtered.dehexed.csv") +\end{verbatim}\end{scriptsize}\end{redframe} \subsection{Rep:1.i} @@ -233,32 +233,32 @@ Write in the report the decoded message. Explain clearly how you carried out the \emph{\textbf{Agent South already successfully infiltrated The minister's office. In the next step, we try to acquire data from the Ministry of Cyber Affair's office network. Stay tuned, I will keep you updated on the progress. (This message was sent by agent Scott)Agent South already successfully infiltrated The minister's office. In the next step, we try to acquire data from the Ministry of Cyber Affair's office network. Stay tuned, I will keep you updated on t}}\\ -code\\ -\begin{verbatim} -#!/usr/bin/env python - -import csv -import binascii - -def somedecode(filename): - with open(filename, 'rb') as csvfile: - spamreader = csv.reader(csvfile, delimiter=',', quotechar='"') - header = None - bits = "" - - for row in spamreader: - if header is None: - header = row - continue - - if row[2] == '192.168.67.81': - bits += "{0:06b}".format(int(row[7])) - - print binascii.unhexlify('%x' % int(bits, 2)) - -if __name__ == "__main__": - somedecode("transmission.csv") -\end{verbatim} +Final py-code +\begin{redframe}\begin{scriptsize}\begin{verbatim} +#!/usr/bin/env python + +import csv +import binascii + +def somedecode(filename): + with open(filename, 'rb') as csvfile: + spamreader = csv.reader(csvfile, delimiter=',', quotechar='"') + header = None + bits = "" + + for row in spamreader: + if header is None: + header = row + continue + + if row[2] == '192.168.67.81': + bits += "{0:06b}".format(int(row[7])) + + print binascii.unhexlify('%x' % int(bits, 2)) + +if __name__ == "__main__": + somedecode("transmission.csv") +\end{verbatim}\end{scriptsize}\end{redframe} \subsection{Rep:1.p} diff --git a/report/main.tex b/report/main.tex index 0f2a5c3..9b84e1d 100644 --- a/report/main.tex +++ b/report/main.tex @@ -92,8 +92,9 @@ \DeclareUnicodeCharacter{20AC}{\euro} % frames -\usepackage[framemethod=default]{mdframed} -\newmdenv[linecolor=red,backgroundcolor=yellow]{yellowframe} +\usepackage[framemethod=tikz]{mdframed} +\newmdenv[linecolor=red]{redframe} +\newmdenv[linecolor=black]{blackframe} % quotes \usepackage[babel,german=quotes]{csquotes} -- 2.43.0