This commit is contained in:
firmianay 2021-01-05 19:13:23 +08:00
parent 0d5cdd5886
commit b1a66f632d
65 changed files with 21 additions and 2369 deletions

227
.gitignore vendored
View File

@ -1,229 +1,2 @@
.vscode/ .vscode/
*.DS_Store *.DS_Store
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
!libc.so.6
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.gtex
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Comment the next line if you want to keep your tikz graphics files
*.tikz
*-tikzDictionary
# listings
*.lol
# makeidx
*.idx
*.ilg
*.ind
*.ist
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# nomencl
*.nlo
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# todonotes
*.tdo
# easy-todo
*.lod
# xindy
*.xdy
# xypic precompiled matrices
*.xyc
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# Kile
*.backup
# KBibTeX
*~[0-9]*
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta

View File

@ -1,17 +0,0 @@
sudo: required
dist: xenial
before_install:
- unalias cp
- sudo apt-get update
- sudo apt-get -y install texlive-full
- sudo apt-get -y install fonts-roboto # install fonts
- wget https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCJKsc-hinted.zip
- unzip NotoSansCJKsc-hinted.zip
- cp NotoSansCJKsc-Bold.otf ./CTF-All-In-One/tex/fonts/NotoSansCJKSC/NotoSansCJKsc-Bold.otf
- cp NotoSansCJKsc-Regular.otf ./CTF-All-In-One/tex/fonts/NotoSansCJKSC/NotoSansCJKsc-Regular.otf
- sudo fc-cache -fv
- sudo rm -rf *.otf *.zip
script:
- cd tex
- xelatex -output-directory build ./main.tex

View File

@ -54,15 +54,12 @@
- `CONTRIBUTION.md`:合作与贡献的相关内容。 - `CONTRIBUTION.md`:合作与贡献的相关内容。
- `SUMMARY.md`GitBook 目录结构。 - `SUMMARY.md`GitBook 目录结构。
- `.gitignore`:忽略特殊文件。 - `.gitignore`:忽略特殊文件。
- `.travis.yml`Travis CI 配置文件。
- `FAQ.md`:常见问题解答。 - `FAQ.md`:常见问题解答。
- `THANKS`:致谢名单。 - `THANKS`:致谢名单。
- `doc`:该目录包含书全部内容的 Markdown 文件。(文字) - `doc`:该目录包含书全部内容的 Markdown 文件。(文字)
- `tex`:该目录包含使用 LaTex 重写的内容。PDF
- `pic`:该目录包含所有 Markdown 中引用的所有图片文件。(图片) - `pic`:该目录包含所有 Markdown 中引用的所有图片文件。(图片)
- `src`:该目录包含书中示例和练习的二进制文件或源代码,分专题保存。(代码) - `src`:该目录包含书中示例和练习的二进制文件或源代码,分专题保存。(代码)
- `slides`:该目录包含以书为主要内容制作的幻灯片。(ppt) - `slides`:该目录包含以书为主要内容制作的幻灯片。(ppt)
- `build`:该目录包含使用 LaTeX 生成的 PDF 书籍。(pdf)
### 注意事项 ### 注意事项
@ -87,3 +84,24 @@
| 1.4.6.md | phantom0301 | 未完成 | | 1.4.6.md | phantom0301 | 未完成 |
| 3.4.1.md | phantom0301 | 未完成 | | 3.4.1.md | phantom0301 | 未完成 |
| 3.4.2.md | phantom0301 | 未完成 | | 3.4.2.md | phantom0301 | 未完成 |
## 其他说明
*对最后一个 PDF 版本( 2018.07.15 )的说明*
《CTF All-In-One》满一周年了正好也是世界杯决赛的日子或许应该纪念一下。
去年有段时间我就在想应该给大学生涯留下点什么然后某天我在读《Reverse Engineering for Beginners》的时候突然就萌生了像作者一样写一本开源书的想法。当时就很激动CTF for Beginners听起来不错然后又一想CTF 这么多内容,全包含进来是不是用 All-In-One 更好一点,然后就有了这本书。书的结构经过几次大改,现在有点像博客式的连载,但章节之间也会有一些关联。理想很丰满现实很骨感,一年过去了仅有四个 contributer内容虽然超过 1700 页但也只覆盖了二进制的一部分或许把书名换成《Binary for Beginners》会更匹配一点这一条在我的计划中。当然 482 个 star 和 95 个 fork 的成绩似乎也还说得过去。
写东西确实很辛苦,生怕哪里写错或者表述不清楚误导了别人(虽然还是错了不少...)。特别是在调试漏洞的时候,为了将每个步骤及内存的情况清晰地展现出来,花费了非常多的时间。当然辛苦的同时自己也得到了许多东西,从学习到总结再到分享,本身就是一个自我提高的过程。然后还认识了一些朋友,能够交流一些技术问题,其中有一个看不懂中文的小哥,问我能否提供英文版,我当然是很感动然后拒绝了他(能力有限…)。大概一个月前,在 ASU 做科研的 Fish 师傅说看了我写的东西,问我是否有打算出国深造,无奈作为学渣绩点太低。如果列表里出国的同学有对自动化二进制程序分析感兴趣的,赶紧抱紧 Fish 师傅大腿angr 的作者之一)。
这本书未来还会继续更新,速度就不好说了,希望有更多的朋友参与进来。
最后,克罗地亚加油!!!
例行描述:
1、距离上次 release 已有三个月。
2、总共 1795 页,增加约 30%。
3、增加的内容主要是题解和论文笔记。
4、我好菜啊QAQ。

View File

@ -36,18 +36,12 @@
--- ---
[![Build Status](https://travis-ci.org/firmianay/CTF-All-In-One.svg?branch=master)](https://travis-ci.org/firmianay/CTF-All-In-One)
*——“与其相信谣言,不如一直学习。”* *——“与其相信谣言,不如一直学习。”*
GitHub 地址:<https://github.com/firmianay/CTF-All-In-One> GitHub 地址:<https://github.com/firmianay/CTF-All-In-One>
GitBook 地址:<https://firmianay.gitbook.io/ctf-all-in-one/> GitBook 地址:<https://firmianay.gitbook.io/ctf-all-in-one/>
由于 GitBook 把 pdf 导出设置为会员服务了,所以这应该是虽不推荐但唯一的版本了,还是直接在 GitHub 看吧:
- (不推荐 2018-07-15<https://github.com/firmianay/CTF-All-In-One/releases>
## 目录 ## 目录
请查看 [SUMMARY.md](https://github.com/firmianay/CTF-All-In-One/blob/master/SUMMARY.md) 请查看 [SUMMARY.md](https://github.com/firmianay/CTF-All-In-One/blob/master/SUMMARY.md)

View File

@ -1,18 +0,0 @@
# 一些使用Latex事项
* 使用开源Latex模板https://github.com/GGolbik/GGLaTeXBookTemplate该模板为GPL 3.0 协议。具体使用以该仓库的README为准。
* 目前还在测试中需各位仍以markdown写作为主。
* 仅在Share Latex上测试已经成功生成PDF文件于build目录看上去还不错细节有待打磨
## 其他
### 字体
为了减小仓库体积fonts文件夹下字体全为空文件可以从以下地址下载并编译使用
- NotoSansCJKsc
- Source: [Google Noto Fonts](https://www.google.com/get/noto/#sans-hans)
- License: [SIL Open Font License, Version 1.1](https://github.com/GGerry/GGLaTeXBookTemplate/blob/master/fonts/NotoSansCJKjp/LICENSE_OFL.txt)
- Roboto
- Source: [Google Fonts](https://fonts.google.com/specimen/Roboto?selection.family=Roboto)
- License: [Apache License 2.0](https://github.com/GGerry/GGLaTeXBookTemplate/blob/master/fonts/Roboto/LICENSE.txt)

View File

@ -1,54 +0,0 @@
% add table of contents entry
\addstarredchapter{\DICTAbbreviations}
% update mark for use of \leftmark and \rightmark
\markboth{\DICTAbbreviations}{\DICTAbbreviations}
\chapter*{\DICTAbbreviations}
% You can enter a short name between the abbreviation and the long form (for example, for I²C). This is necessary for mathematical characters, for example, since only normal characters may be used in the abbreviation. The corresponding call looks like usual: \ac{I2C}, the abbreviation I²C appears in the generated document.
% After \begin{acronym} an expression can be specified in square brackets. After the length of this expression, the indentation of the abbreviations is set. In this case, it is recommended to use the longest abbreviation in order to obtain a uniform indentation for all abbreviations.
\begin{acronym}[Bash]
\acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\end{acronym}
% Use in the text
% Here are only the most important examples:
% Outputs the long form with the abbreviation in parentheses for the first use, from then on always the short form.
%--------------------------------------
% \ac{KDE} % K Desktop Environment (KDE)
%--------------------------------------
% Returns the abbreviation.
%--------------------------------------
% \acs{KDE} % KDE
%--------------------------------------
% Outputs the long and short form.
%--------------------------------------
% \acf{KDE} % K Desktop Environment (KDE)
%--------------------------------------
% Only outputs the long form without the short form.
%--------------------------------------
% \acl{KDE} % K Desktop Environment
%--------------------------------------
% Similar to the above commands, the plural can also be displayed accordingly:
%--------------------------------------
% \acp{KDE} % K Desktop Environments (KDEs)
% \acsp{KDE} % KDEs
% \acfp{KDE} % K Desktop Environments (KDEs)
% \aclp{KDE} % K Desktop Environments
%--------------------------------------
% If the plural does not end at -s, you can set it with the following command:
%--------------------------------------
% \acrodefplural{VM}[VMs]{Virtuelle Maschinen}
%--------------------------------------

View File

@ -1,33 +0,0 @@
\RedeclareSectionCommand[tocnumwidth=6em]{section}
\RedeclareSectionCommand[tocnumwidth=6.5em]{subsection}
\RedeclareSectionCommand[tocindent=0em]{section}
\RedeclareSectionCommand[tocindent=2em]{subsection}
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
% update mark for use of \leftmark and \rightmark
\markboth{\DICTAppendix}{\DICTAppendix}
\chapter*{\DICTAppendix}
\nomtcrule
\mtcsettitle{minitoc}{\DICTTableOfAppendix}
\setcounter{section}{0}
\addstarredchapter{\DICTAppendix}
\ifthenelse{\equal{\CONFIGEnableTableOfAppendix}{true}}
{
\minitoc % minitoc-Ausgeben
\newpage
}{}
\renewcommand{\thesection}{\DICTAppendix~\Alph{section}}
% include appendix content
%--------------------------------------
\input{base/appendix/appendixcontent}
%--------------------------------------
\addtocontents{toc}{\protect\setcounter{tocdepth}{3}}

View File

@ -1,7 +0,0 @@
% \section{Packed Objects Encoding tables}
% \subsection{Packed Objects Encoding tables}
% \section{Encoding Packed Objects}
% \section{Decoding Packed Objects}

View File

@ -1,18 +0,0 @@
% Use the below command to add references
% \cite{name of reference}
% Required for table of contents
\addstarredchapter{\DICTReferences}
% update mark for use of \leftmark and \rightmark
\markboth{\DICTReferences}{\DICTReferences}
% to avoid the warning: Overfull \hbox
\emergencystretch=1em
% show all entries even the once which are not used
%\nocite{*}
\printbibliography[title={\DICTReferences}
%,heading=bibnumbered
]

View File

@ -1,62 +0,0 @@
% You can find the documentation on ftp://ctan.tug.org/tex-archive/macros/latex/exptl/biblatex/doc/biblatex.pdf
% Article
%
% An article in a journal, magazine, newspaper, or other periodical which forms a
% self-contained unit with its own title. The title of the periodical is given in the
% journaltitle field. If the issue has its own title in addition to the main title of
% the periodical, it goes in the issuetitle field. Note that editor and related
% fields refer to the journal while translator and related fields refer to the article.
@article{exampleArticle,
% Required fields:
author = "Max Mustermann",
title = "Mustertitle - Article",
journaltitle = "Muster Journal",
date = "2017-12-13",
% Optional fields: see documentation
}
% Book
%
% A single-volume book with one or more authors where the authors share credit for
% the work as a whole. This entry type also covers the function of the @inbook type
% of traditional BibTeX, see § 2.3.1 for details
@book{exampleBook,
% Required fields:
author = "Max Mustermann",
title = "Mustertitle - Book",
date = "2017-12-14",
% Optional fields: see documentation
}
% Manual
%
% Technical or other documentation, not necessarily in printed form. The author or
% editor is omissible in terms of § 2.3.2.
@manual{exampleManual,
% Required fields:
author = "Max Mustermann",
title = "Mustertitle - Manual",
date = "2017-12-15",
% Optional fields: see documentation
}
% Online
%
% An online resource. author, editor, and year are omissible in terms of § 2.3.2.
% This entry type is intended for sources such as web sites which are intrinsically
% online resources. Note that all entry types support the url field. For example, when
% adding an article from an online journal, it may be preferable to use the @article
% type and its url field.
@online{exampleOnline,
% Required fields:
author = "Max Mustermann",
title = "Mustertitle - Online",
date = "2017-12-16",
url = "http://example.url",
% Optional fields: see documentation
}

View File

@ -1,4 +0,0 @@
\begin{flushleft}
\copyright~Copyright~\the\year~\DICTDocAuthor
\end{flushleft}
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the author or other organizations.

View File

@ -1,4 +0,0 @@
\begin{flushleft}
\copyright~版权~\the\year~\DICTDocAuthor
\end{flushleft}
Creative Commons license (CC BY-SA 4.0)

View File

@ -1,5 +0,0 @@
\IfFileExists{base/copyright/\CONFIGLanguage}{
\input{base/copyright/\CONFIGLanguage}
}{
Copyright: UNSUPPORTED LANGUAGE ,,\CONFIGLanguage ``
}

View File

@ -1,5 +0,0 @@
\begin{center}
{\Large DISCLAIMER}
\end{center}
This document and the information contained herein is provided on an “As Is” basis and the author disclaims all warranties, express or implied, including but not limited to any warranty that the use of the information herein will not infringe any rights or any implied warranties of merchantability or fitness for a particular purpose.

View File

@ -1,5 +0,0 @@
\begin{center}
{\Large 声明}
\end{center}
本书使用 Creative Commons license (CC BY-SA 4.0)大可随意使用。欢迎来本书的Github页面提交PR.

View File

@ -1,5 +0,0 @@
\IfFileExists{base/disclaimer/\CONFIGLanguage}{
\input{base/disclaimer/\CONFIGLanguage}
}{
DISCLAIMER: UNSUPPORTED LANGUAGE ,,\CONFIGLanguage ``
}

View File

@ -1,88 +0,0 @@
%\ifthenelse{\equal{\CONFIGLanguage}{twoside}}
% {\input{base/headerfooter/twoside}}
% {\input{base/headerfooter/oneside}}
\pagestyle{fancy}
\fancyhf{}
% E for even page
% O for odd page
% L for left side
% C for centered
% R for right side
% set header
%--------------------------------------
\ifthenelse{\equal{\CONFIGOneTwoSided}{oneside}}
{
\fancyhead[L]{\includegraphics[width=5mm]{\IMGHeader}}
\fancyhead[R]{\DICTDocTitle}
\fancyhead[C]{}
}
{
\fancyhead[RE,LO]{\includegraphics[width=5mm]{\IMGHeader}}
\fancyhead[LE,RO]{\DICTDocTitle}
\fancyhead[CE,CO]{}
}
% change header line color
\patchcmd{\headrule}{\hrule}{\color{LightGray}\hrule}{}{}
% show header line
\renewcommand{\headrulewidth}{0.4pt} % set to 0pt if line shall be removed
%--------------------------------------
% set footer
%--------------------------------------
\ifthenelse{\equal{\CONFIGOneTwoSided}{oneside}}
{
\fancyfoot[R]{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\fancyfoot[L]{\DICTDocDate}
\fancyfoot[C]{}
}
{
\fancyfoot[RE,LO]{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\fancyfoot[LE,RO]{\DICTDocDate}
\fancyfoot[CE,CO]{}
}
% change footer line color
\patchcmd{\footrule}{\hrule}{\color{LightGray}\hrule}{}{}
% show footer line
\renewcommand{\footrulewidth}{0.4pt}% default is 0pt
%--------------------------------------
\fancypagestyle{plain}{%
\fancyhf{}
% set header
%--------------------------------------
\ifthenelse{\equal{\CONFIGOneTwoSided}{oneside}}
{
\fancyhead[L]{\includegraphics[width=5mm]{\IMGHeader}}
\fancyhead[R]{\DICTDocTitle}
\fancyhead[C]{}
}
{
\fancyhead[RE,LO]{\includegraphics[width=5mm]{\IMGHeader}}
\fancyhead[LE,RO]{\DICTDocTitle}
\fancyhead[CE,CO]{}
}
%--------------------------------------
% set footer
%--------------------------------------
\ifthenelse{\equal{\CONFIGOneTwoSided}{oneside}}
{
\fancyfoot[R]{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\fancyfoot[L]{\DICTDocDate}
\fancyfoot[C]{}
}
{
\fancyfoot[RE,LO]{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\fancyfoot[LE,RO]{\DICTDocDate}
\fancyfoot[CE,CO]{}
}
}

View File

@ -1,10 +0,0 @@
% use the below command to add index entries
% \index{index name}
% add table of contents entry
\addstarredchapter{\DICTIndex}
% update mark for use of \leftmark and \rightmark
\markboth{\DICTIndex}{\DICTIndex}
\printindex

View File

@ -1,11 +0,0 @@
\setcounter{tocdepth}{3}
% add table of contents entry
\addstarredchapter{\DICTListOfFigures}
\renewcommand{\listfigurename}{\DICTListOfFigures}
\renewcommand{\figurename}{\DICTFigureName}
\listoffigures
% update mark for use of \leftmark and \rightmark
\markboth{\DICTListOfFigures}{\DICTListOfFigures}

View File

@ -1,11 +0,0 @@
\setcounter{tocdepth}{3}
% add table of contents entry
\addstarredchapter{\DICTListOfTables}
\renewcommand{\listtablename}{\DICTListOfTables}
\renewcommand{\tablename}{\DICTTableName}
\listoftables
% update mark for use of \leftmark and \rightmark
\markboth{\DICTListOfTables}{\DICTListOfTables}

View File

@ -1,14 +0,0 @@
\setcounter{tocdepth}{3}
% change listings name below code
\renewcommand{\lstlistingname}{\DICTListingName}
% add table of contents entry
\addstarredchapter{\DICTListOfCodeSnippets}
% List of Listings -> List of Algorithms
\renewcommand{\lstlistlistingname}{\DICTListOfCodeSnippets}
\lstlistoflistings
% update mark for use of \leftmark and \rightmark
\markboth{\DICTListOfCodeSnippets}{\DICTListOfCodeSnippets}

View File

@ -1,10 +0,0 @@
% add table of contents entry
\addstarredchapter{\DICTTableOfContents}
% Rename name of table of contents
\renewcommand\contentsname{\DICTTableOfContents}
% update mark for use of \leftmark and \rightmark
\markboth{\DICTTableOfContents}{\DICTTableOfContents}
\tableofcontents

View File

@ -1,37 +0,0 @@
\pagecolor{brandcolor}
\color{white}
\begin{titlepage}
% doc image
% \begin{figure}[ht]
% \centering
% \includegraphics{\IMGTitlePage}
% \end{figure}
\begin{center}
{\Huge \DICTDocTitle}
\end{center}
\vfill
% \begin{center}
% {\Large by}
% \end{center}
\begin{center}
{\Large \DICTDocAuthor}
\end{center}
\begin{center}
{\Large \DICTDocEmail}
\end{center}
\begin{center}
{\Large \DICTDocDate}
\end{center}
\vspace{5mm}
\end{titlepage}
\pagecolor{white}
\color{black}

View File

@ -1,14 +0,0 @@
% Required packages:
% \usepackage{xcolor}
\definecolor{brandcolor}{RGB}{0, 148, 134}
\definecolor{LightGray}{RGB}{235,235,235}
\definecolor{Gray}{RGB}{210,210,210}
\definecolor{Blue}{RGB}{48,129,238}
\definecolor{HyperlinkBlue}{RGB}{0,0,195}
\definecolor{VioletBlue}{RGB}{102,51,153}

View File

@ -1,33 +0,0 @@
% Define the used document language in ISO 639-1 code
% see for more info https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
%--------------------------------------
\def\CONFIGLanguage{ZH}
%--------------------------------------
\def\CONFIGEnableTitlePage{true} % true or false
\def\CONFIGEnableDisclaimer{true} % true or false
\def\CONFIGEnableCopyright{true} % true or false
\def\CONFIGEnableTableOfContents{true} % true or false
\def\CONFIGEnableListOfFigures{false} % true or false
\def\CONFIGEnableListOfTables{false} % true or false
\def\CONFIGEnableListOfSnippets{false} % true or false
\def\CONFIGEnableListOfAbbreviations{true} % true or false
\def\CONFIGEnableAppendix{true} % true or false
\def\CONFIGEnableTableOfAppendix{true} % true or false
\def\CONFIGEnableReferences{true} % true or false
\def\CONFIGEnableIndex{true} % true or false
% check if document is oneside or twoside
% The type is set in main.tex in \documentclass[...]{...} -> line 2
%--------------------------------------
\makeatletter
\if@twoside
\def\CONFIGOneTwoSided{twoside}
\else
\def\CONFIGOneTwoSided{oneside}
\fi
\makeatother
%--------------------------------------
% Load basic packages for layout
\input{config/layout}

View File

@ -1,7 +0,0 @@
\def\IMGTitlePage{images/favicon/favicon_white_padding_192.png}
\def\IMGHeader{images/favicon/favicon_32.png}
\def\IMGHeaderColored{images/favicon/favicon_white_32.png}
\def\IMGExampleOne{images/content/ben-kolde-367194.jpg}
\def\IMGExampleTwo{images/content/nate-grant-346782.jpg}

View File

@ -1,162 +0,0 @@
\usepackage{ifthen}
% page dimensions
%--------------------------------------
% see https://de.sharelatex.com/learn/Page_size_and_margins
\ifthenelse{\equal{\CONFIGOneTwoSided}{oneside}}
{
\usepackage{geometry}\geometry{
a4paper, % a4 size 210x297 mm
left=35mm,
right=20mm,
top=35mm,
bottom=25mm,
footskip=10mm,
headheight=20mm % required for header
}
}
{
\usepackage{geometry}\geometry{
a4paper, % a4 size 210x297 mm
twoside,
left=35mm,
right=20mm,
top=35mm,
bottom=25mm,
footskip=10mm,
headheight=20mm % required for header
}
}
%--------------------------------------
% reduce chapter margin
\renewcommand*{\chapterheadstartvskip}{\vspace*{0mm}}
% Multi line comments
%--------------------------------------
\usepackage{verbatim}
%--------------------------------------
% font
%--------------------------------------
\usepackage{fontspec}
\setmainfont[ExternalLocation=fonts/Roboto/,
BoldFont = Roboto-Bold.ttf,
ItalicFont = Roboto-Italic.ttf ,
BoldItalicFont = Roboto-BoldItalic.ttf]{Roboto-Regular.ttf}
% language Japanese
%--------------------------------------
\usepackage{xeCJK}
\setCJKmainfont[ExternalLocation=fonts/NotoSansCJKSC/,
BoldFont = NotoSansCJKsc-Bold.otf]{NotoSansCJKsc-Regular.otf}
%--------------------------------------
% set line height/spacing
\renewcommand{\baselinestretch}{1.5}
\ifthenelse{\equal{\CONFIGLanguage}{DE}}
{
% German hyphenation
\usepackage[ngerman]{babel}
\usepackage{csquotes}
}{}
%--------------------------------------
% Remove indentation
%--------------------------------------
\parindent0pt
%-------------------------------------
% Landscape
%--------------------------------------
\usepackage{pdflscape}
%--------------------------------------
% dictionary
%--------------------------------------
\input{dictionary/dictionary}
%--------------------------------------
% colors
%--------------------------------------
\usepackage[table]{xcolor}
\input{config/colors}
%--------------------------------------
% images
%--------------------------------------
\usepackage{graphicx}
% \input{config/images}
%--------------------------------------
% Tables
%--------------------------------------
\usepackage{longtable}
% alternate rowcolors for all long-tables
\let\oldlongtable\longtable
\let\endoldlongtable\endlongtable
%--------------------------------------
% date
%--------------------------------------
\usepackage[yyyymmdd]{datetime}
% format date
\renewcommand{\dateseparator}{--}
%--------------------------------------
% Header & footer
%--------------------------------------
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{etoolbox}
%--------------------------------------
% Enable linking e.g. for table of contents
%--------------------------------------
\usepackage{hyperref}
\urlstyle{rm}
%--------------------------------------
% Listings - e.g. List of code snippets
%--------------------------------------
\usepackage{listings}
% load style
\input{config/lstdefinestyle}
% init file variables
%\input{config/snippets}
%--------------------------------------
% Abbreviations
%--------------------------------------
\usepackage[printonlyused]{acronym}
%--------------------------------------
% Bibliography/References
%--------------------------------------
\usepackage[
backend=biber,
style=numeric,
sorting=ynt
% citestyle=chicago-authordate
]{biblatex}
% define reference resource
\addbibresource{base/bibliography/references.bib}
%--------------------------------------
% Index
%--------------------------------------
\usepackage{imakeidx}
% uncomment to at numbering
%\indexsetup{level=\chapter}
% Activate index commands
\makeindex
%--------------------------------------
% Appendix
%--------------------------------------
\usepackage{appendix}
\usepackage[german]{minitoc}
\usepackage{titletoc}
%--------------------------------------

View File

@ -1,150 +0,0 @@
% Default code style
\lstset{
frame=single,
captionpos=b,
lineskip=0.5em,
xleftmargin=\parindent,
belowskip=0em
}
\lstdefinestyle{customStyleBashDark}{
language=Bash,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{255,255,255},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{33,36,33},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{153,153,153},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{143,217,68},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{101,197,222},
stringstyle=\color[RGB]{236,118,0},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=single,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleBashLight}{
language=Bash,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{0,0,0},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{255,255,255},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{52,121,54},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{138,18,130},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{0,0,0},
stringstyle=\color[RGB]{0,0,192},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=shadowbox,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
rulesepcolor=\color{black},
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleJavaDark}{
language=Java,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{255,255,255},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{33,36,33},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{153,153,153},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{143,217,68},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{101,197,222},
stringstyle=\color[RGB]{236,118,0},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=single,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleJavaLight}{
language=Java,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{0,0,0},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{255,255,255},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{52,121,54},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{138,18,130},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{0,0,0},
stringstyle=\color[RGB]{0,0,192},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=shadowbox,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
rulesepcolor=\color{black},
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleHTMLDark}{
language=HTML,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{255,255,255},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{33,36,33},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{153,153,153},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{143,217,68},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{101,197,222},
stringstyle=\color[RGB]{236,118,0},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=single,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
usekeywordsintag=false,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleHTMLLight}{
language=HTML,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{0,0,0},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{255,255,255},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{52,121,54},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{138,18,130},%style of keywords in source language (e.g. keywordstyle=\color{red})
stringstyle=\color[RGB]{0,0,238},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=shadowbox,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
rulesepcolor=\color{black},
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
usekeywordsintag=false,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}

View File

@ -1,21 +0,0 @@
\input{contents/EN/introduction/introduction}
\newpage
\input{contents/EN/snippets/snippets}
\newpage
\input{contents/EN/useofabbreviations/useofabbreviations}
\newpage
\input{contents/EN/useofbibliography/useofbibliography}
\newpage
\input{contents/EN/useofindex/useofindex}
\newpage
\input{contents/EN/tables/tables}
\newpage
\input{contents/EN/footnotes/footnotes}
\newpage
\input{contents/EN/japanese/japanese}
\newpage
\input{contents/EN/images/images}
\newpage
\input{contents/EN/landscape/landscape}
\newpage
\input{contents/EN/mathematics/mathematics}

View File

@ -1,9 +0,0 @@
\chapter{Footnotes}
one\footnote{\label{foot-1}Footnote 1.}
two\footnote{\label{foot-2}Footnote 2.}
three\footnote{\label{foot-3}Footnote 3.}
four\textsuperscript{\ref{foot-2}}
\section{Example 1}
test

View File

@ -1,18 +0,0 @@
\chapter{Use of Images}
% Required packages: "graphicx", "float"
% See for more info: https://en.wikibooks.org/wiki/LaTeX/Importing_Graphics
\section{Image Area}\index{Image Area}
\subsection{Example Image 1}
\includegraphics[trim = 10mm 60mm 20mm 5mm, clip, height=\linewidth, angle=90]{\IMGExampleOne}
\captionof{figure}{Example Image 1}
\subsection{Example Image 2}
\includegraphics[width=\linewidth]{\IMGExampleTwo}
\captionof{figure}{Example Image 2}
\label{figure:anime}
You can reference images, for instance, the image \ref{figure:anime} shows
an image from \textit{unsplash}

View File

@ -1,37 +0,0 @@
\chapter{Introduction}
this is the first chapter
\section{section}
This is the first section.
\subsection{Subsection}
normal \emph{italic}, \textbf{bold} and \textbf{\emph{bold italic}}.
ä ö ü ß
% Required packages: "csquotes", (optional) "babel"
% bold
{\textbf{Sample Text 0123}}
\\ % italic
{\textit{Sample Text 0123}}
\\ % small caps
{\textsc{Sample Text 0123}}
\\ % sans serif
{\textsf{Sample Text 0123}}
\\ % tiny
{\tiny{Sample Text 0123}}
\\ % normalsize
{\normalsize{Sample Text 0123}}
\\ % huge
{\huge{Sample Text 0123}}
\\ % hiperlink
{\color{HyperlinkBlue}\url{https://de.sharelatex.com/learn/}}
\\
\\
A \rotatebox{90}{B} C
\\
These are special characters: äöüß

View File

@ -1,4 +0,0 @@
\chapter{Japanese - 日本語}
むかし、むかし、ある所におじいさんとおばあさんが住んでいました。おじいさんは山へしば刈りに、おばあさんは川へ洗濯に行きました。すると大きな桃が流れてきました。
「なんと大きな桃じゃろう!家に持って帰ろう。」とおばあさんは背中に担いで帰って行きました。

View File

@ -1,6 +0,0 @@
% Requierd packages: "pdflscape" alternative: lscape
\begin{landscape}
\chapter{Landscape Area}\index{Landscape Area}
\section{Example 1}
This page is in Landscape mode
\end{landscape}

View File

@ -1,30 +0,0 @@
\chapter{Mathematics Area}\index{Mathematics Area}
\section{Example 1}
The well known Pythagorean theorem \(x^2 + y^2 = z^2\) was
proved to be invalid for other exponents.
Meaning the next equation has no integer solutions:
\[ x^n + y^n = z^n \]
An alternative:
\begin{center}
\begin{math}
7+12+x=10
\end{math}
\end{center}
In physics, the mass-energy equivalence is stated
by the equation $E=mc^2$, discovered in 1905 by Albert Einstein.
The mass-energy equivalence is described by the famous equation
$$E=mc^2$$
discovered in 1905 by Albert Einstein.
In natural units ($c$ = 1), the formula expresses the identity
\begin{equation}
E=m
\end{equation}

View File

@ -1,21 +0,0 @@
\section{Bash Light}
\begin{lstlisting}[language=bash, style=customStyleBashLight, caption=Snippet title]
#!/bin/bash
STRING="HELLO WORLD!!!"
echo $STRING
\end{lstlisting}
\section{Bash Dark}
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=Snippet title]
#!/bin/bash
STRING="HELLO WORLD!!!"
echo $STRING
\end{lstlisting}
\section{Bash Import}
\lstinputlisting[language=bash, style=customStyleBashDark, caption=Snippet title]{\SNIPPETBash}

View File

@ -1,51 +0,0 @@
\section{HTML Light}
\begin{lstlisting}[language=bash, style=customStyleHTMLLight, caption=Snippet title]
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>GGHTMLCodeExample</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<script>
var variable = 4;
if(variable != null && variable == 4) {
variable++;
variable += 12 * 4 / 3;
document.write(variable);
}
</script>
</head>
<body>
<div><Example HTML/div>
</body>
</html>
\end{lstlisting}
\section{HTML Dark}
\begin{lstlisting}[language=bash, style=customStyleHTMLDark, caption=Snippet title]
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>GGHTMLCodeExample</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<script>
var variable = 4;
if(variable != null && variable == 4) {
variable++;
variable += 12 * 4 / 3;
document.write(variable);
}
</script>
</head>
<body>
<div><Example HTML/div>
</body>
</html>
\end{lstlisting}
\section{HTML Import}
\lstinputlisting[language=bash, style=customStyleHTMLDark, caption=Snippet title]{\SNIPPETHTML}

View File

@ -1,33 +0,0 @@
\section{Java Light}
\begin{lstlisting}[language=bash, style=customStyleJavaLight, caption=Snippet title]
/**
* HelloWorld.java
*/
public class HelloWorld
{
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
\end{lstlisting}
\section{Java Dark}
\begin{lstlisting}[language=bash, style=customStyleJavaDark, caption=Snippet title]
/**
* HelloWorld.java
*/
public class HelloWorld
{
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
\end{lstlisting}
\section{Java Import}
\lstinputlisting[language=bash, style=customStyleJavaDark, caption=Snippet title]{\SNIPPETJava}

View File

@ -1,7 +0,0 @@
\chapter{Snippets}
\input{contents/EN/snippets/bash}
\input{contents/EN/snippets/html}
\input{contents/EN/snippets/java}

View File

@ -1,109 +0,0 @@
\chapter{Tables}
% alternate rowcolors for all long-tables
\renewenvironment{longtable}{\rowcolors{2}{LightGray}{white}\oldlongtable} {\endoldlongtable}
\begin{longtable}[l]{| p{40mm} | p{105mm} |}
\hline
\rowcolor{Gray}
\textbf{Term} & \textbf{Description}\\
\hline
\endfirsthead
\hline
\rowcolor{Gray}
\textbf{Term} & \textbf{Description}\\
\hline
\endhead
\hiderowcolors
\endfoot
\caption{Table example}\label{table:kysymys}\\
\endlastfoot
\showrowcolors
Lotsoflines & like this like this like this like this like this like this like this like this like this like this like this like this like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
Lots of lines & like this\\
\hline
\end{longtable}
Table \ref{table:kysymys}

View File

@ -1,33 +0,0 @@
\chapter{Use of Abbreviations}
\ac{KDE} % K Desktop Environment (KDE)
\\
\acs{KDE} % KDE
\\
\acf{KDE} % K Desktop Environment (KDE)
\\
\acl{KDE} % K Desktop Environment
\\
\acp{KDE} % K Desktop Environments (KDEs)
\\
\acsp{KDE} % KDEs
\\
\acfp{KDE} % K Desktop Environments (KDEs)
\\
\aclp{KDE} % K Desktop Environments
\\
\ac{SQL}
\\
\acs{SQL}
\\
\acf{SQL}
\\
\acl{SQL}
\\
\acp{SQL}
\\
\acsp{SQL}
\\
\acfp{SQL}
\\
\aclp{SQL}

View File

@ -1,9 +0,0 @@
\chapter{Use of References}
\cite{exampleArticle} Article
\\
\cite{exampleBook} Book
\\
\cite{exampleManual} Manual
\\
\cite{exampleOnline} Online

View File

@ -1,3 +0,0 @@
\chapter{Use of Index}
\index{test index} Test

View File

@ -1,595 +0,0 @@
\chapter{CTF 基础知识}\index{CTF 基础知识}
\section{CTF 简介}
% \setlength{\parindent}{2em}
\subsection{概述}
\indent \setlength{\parindent}{2em}
\indent CTFCapture The Flag中文一般译作夺旗赛在网络安全领域中指的是网络安全技术人员之间进行技术竞技的一种比赛形式。CTF起源于1996年DEFCON全球黑客大会以代替之前黑客们通过互相发起真实攻击进行技术比拼的方式。发展至今已经成为全球范围网络安全圈流行的竞赛形式2013年全球举办了超过五十场国际性CTF赛事。而DEFCON作为CTF赛制的发源地DEFCON CTF也成为了目前全球最高技术水平和影响力的CTF竞赛类似于CTF赛场中的“世界杯”。
\indent CTF 为团队赛,通常以三人为限,要想在比赛中取得胜利,就要求团队中每个人在各种类别的题目中至少精通一类,三人优势互补,取得团队的胜利。同时,准备和参与 CTF 比赛是一种有效将计算机科学的离散面、聚焦于计算机安全领域的方法。
\subsection{赛事介绍}
\indent \setlength{\parindent}{2em}
\indent CTF是一种流行的信息安全竞赛形式其英文名可直译为“夺得Flag”也可意译为“夺旗赛”。其大致流程是参赛团队之间通过进行攻防对抗、程序分析等形式率先从主办方给出的比赛环境中得到一串具有一定格式的字符串或其他内容并将其提交给主办方从而夺得分数。为了方便称呼我们把这样的内容称之为“Flag”。
\indent CTF竞赛模式具体分为以下三类
\begin{itemize}
\item \textbf{解题模式Jeopardy}
\indent 在解题模式CTF赛制中参赛队伍可以通过互联网或者现场网络参与这种模式的CTF竞赛与ACM编程竞赛、信息学奥赛比较类似以解决网络安全技术挑战题目的分值和时间来排名通常用于在线选拔赛。题目主要包含逆向、漏洞挖掘与利用、Web渗透、密码、取证、隐写、安全编程等类别。
\item \textbf{攻防模式Attack-Defense}
\indent 在攻防模式CTF赛制中参赛队伍在网络空间互相进行攻击和防守挖掘网络服务漏洞并攻击对手服务来得分修补自身服务漏洞进行防御来避免丢分。攻防模式CTF赛制可以实时通过得分反映出比赛情况最终也以得分直接分出胜负是一种竞争激烈具有很强观赏性和高度透明性的网络安全赛制。在这种赛制中不仅仅是比参赛队员的智力和技术也比体力因为比赛一般都会持续48小时及以上同时也比团队之间的分工配合与合作。
\item \textbf{混合模式Mix}
\indent 结合了解题模式与攻防模式的CTF赛制比如参赛队伍通过解题可以获取一些初始分数然后通过攻防对抗进行得分增减的零和游戏最终以得分高低分出胜负。采用混合模式CTF赛制的典型代表如iCTF国际CTF竞赛。
\end{itemize}
\subsection{题目类别}
\indent \setlength{\parindent}{2em}
\begin{itemize}
\item Reverse
\begin{itemize}
\item 题目涉及到软件逆向、破解技术等,要求有较强的反汇编、反编译功底。主要考查参赛选手的逆向分析能力。
\item 所需知识:汇编语言、加密与解密、常见反汇编工具
\end{itemize}
\item Pwn
\begin{itemize}
\item Pwn 在黑客俚语中代表着攻破,获取权限,在 CTF 比赛中它代表着溢出类的题目,其中常见类型溢出漏洞有整数溢出、栈溢出、堆溢出等。主要考查参赛选手对漏洞的利用能力。
\item 所需知识COD+IDA数据结构操作系统
\end{itemize}
\item Web
\begin{itemize}
\item Web 是 CTF 的主要题型,题目涉及到许多常见的 Web 漏洞,如 XSS、文件包含、代码执行、上传漏洞、SQL 注入等。也有一些简单的关于网络基础知识的考察如返回包、TCP/IP、数据包内容和构造。有些题目环境比较接近真实环境因此通过各种高质量Web题目可以迅速提高选手的安全技能。
\item 所需知识基础的web开发能力一门脚本语言PHP、Python、JavaScript、数据库、网络协议等
\end{itemize}
\item Crypto
\begin{itemize}
\item 题目考察各种加解密技术,包括古典加密技术、现代加密技术甚至出题者自创加密技术,以及一些常见编码解码,主要考查参赛选手密码学相关知识点。通常也会和其他题目相结合。
\item 所需知识数论、现代密码学和一门编程语言C或Python
\end{itemize}
\item Misc
\begin{itemize}
\item Misc 即安全杂项,题目涉及隐写术、流量分析、电子取证、人肉搜索、数据分析、大数据统计等,覆盖面比较广,主要考查参赛选手的各种基础综合知识。
\item 所需知识常见隐写术工具、Wireshark 等流量审查工具、编码知识;此类题目知识繁杂,有时候更需要一个灵活的思路
\end{itemize}
\item Mobile(Android)
\begin{itemize}
\item 主要分为 Android 和 iOS 两个平台,以 Android 逆向为主,破解 APK 并提交正确答案。
\item 所需知识JavaAndroid 开发,常见工具
\end{itemize}
\end{itemize}
\subsection{高质量的CTF比赛}
\indent \setlength{\parindent}{2em}
\indent 详见:
\begin{itemize}
\item 国外比赛平台:\url{http://www.ctftime.org}
\item 国内CTF评分网站\url{https://www.ctfrank.org}
\end{itemize}
\subsection{竞赛小贴士}
\indent \setlength{\parindent}{2em}
\begin{itemize}
\item 寻找团队
\begin{itemize}
\item 彼此激励24小时以上的连续作战
\item 彼此分享交流技术与心得是最快的成长途径
\item 强有力的团队可以让你安心专注于某一领域
\item 在探索技术的道路上不会孤独
\end{itemize}
\item 有效训练
\begin{itemize}
\item 坚持不懈地训练是成为强者的必经途径
\begin{itemize}
\item wargame
\item 经典赛题配合writeup加以总结
\item https://github.com/ctfs 以赛代练,总结与分享
\end{itemize}
\end{itemize}
\item wargame推荐
\begin{itemize}
\item 漏洞挖掘与利用(pwn)
\begin{itemize}
\item pwnable.kr
\item \href{https://exploit-exercises.com}{https://exploit-exercises.com}
\item \href{https://io.netgarage.org}{https://io.netgarage.org}
\end{itemize}
\item 逆向工程与软件破解(re)
\begin{itemize}
\item reversing.kr
\item \href{http://crackmes.de}{http://crackmes.de}
\end{itemize}
\item web渗透(web)
\begin{itemize}
\item webhacking.kr
\item \href{https://xss-game.appspot.com}{https://xss-game.appspot.com}
\end{itemize}
\item 综合类
\begin{itemize}
\item \href{http://overthewire.org/wargames}{http://overthewire.org/wargames}
\item \href{https://w3challs.com}{https://w3challs.com}
\item \href{https://chall.stypr.com/?chall}{https://chall.stypr.com/?chall}
\item \href{https://pentesterlab.com}{https://pentesterlab.com}
\end{itemize}
\end{itemize}
\end{itemize}
\subsection{线下赛 AWD 模式概述}
\indent \setlength{\parindent}{2em}
\indent Attack With Defence简而言之就是你既是一个 hacker又是一个 manager。
\indent 比赛形式:一般就是一个 ssh 对应一个服务,可能是 web 也可能是 pwn然后 flag 五分钟一轮各队一般都有自己的初始分数flag 被拿会被拿走 flag 的队伍均分,主办方会对每个队伍的服务进行 checkcheck 不过就扣分,扣除的分值由服务 check 正常的队伍均分。
\subsubsection{怎样拿到Flag}
\indent \setlength{\parindent}{2em}
\intent web 主要是向目标服务器发送 http 请求,返回 flagbin 主要是通过 exploit 脚本读取 \verb+/home/username+ 下某个文件夹下的 \verb+flag+ 文件。
\subsubsection{Web 题目类型}\setlength{\parindent}{2em}
\begin{itemize}
\item 出题人自己写的 CMS 或者魔改后的 CMS(注意最新漏洞、1day漏洞等)
\item 常见(比如 Wordpress、Discuz!)或者不常见 CMS 等
\item 框架型漏洞(CI等)
\item \href{http://www.mamicode.com/info-detail-1590551.html}{如何在 CTF 中当搅屎棍}
\item \href{http://bobao.360.cn/ctf/detail/169.html}{AWD 模式生存技巧}
\item 能力:
\begin{itemize}
\item 漏洞反应能力
\item 快速编写脚本
\item web代码审计
\item 心态放好,因为 web 比较容易抓取流量,所以即使我们被打,我们也可以及时通过分析流量去查看别的队伍的 payload从而进行反打。
\end{itemize}
\item 脚本准备:一句话,文件包含,不死马、禁止文件上传等
\item \textbf{警惕 web 弱口令,用最快的速度去补}
\end{itemize}
\subsubsection{Bin 题目类型}
\indent \setlength{\parindent}{2em}
\indent 大部分是 PWN题目类型包括栈、堆、格式化字符串等等。
\indent 能力:
\begin{itemize}
\item 迅速找到二进制文件的漏洞,迅速打 patch 的能力
\item 全场打 pwn 的 exp 脚本编写
\item 熟悉服务器运维,如果二进制分析遇到障碍难以进行,那就去帮帮 web 选手运维
\item 尽快摸清楚比赛的 check 机制
\item 看看现场环境是否可以提权这样可以方便我们搞操作如魔改libc等等
\end{itemize}
\subsubsection{技巧}
\begin{itemize}
\item 如果自己拿到 FB 先用 NPC 服务器或者自己服务器测试,格外小心自己的 payload 不要被别的队伍抓取到, 写打全场的 exp 时,一定要加入混淆流量。
\item 提前准备好 PHP 一句话木马等等脚本。
\item 小心其他队伍恶意攻击使我们队伍机器的服务不能正常运行,因此一定要备份服务器的配置。
\item 尽可能在不搞崩服务和绕过 check 的情况下,上 WAF注意分析别人打过来的流量如果没有混淆可以大大加快我们的漏洞分析速度。
\item 工具准备: 中国菜刀、 Nmap、Xshell、 合适的扫描器等。
\item 如果自己丢分,心态不要崩。
\item 不要忽视 Github 等平台,可能会有写好的 exp 可以用。
\item 将 flag 的提交自动化。
\end{itemize}
\subsection{搭建CTF平台}
\indent \setlength{\parindent}{2em}
\indent 已经有现成开源平台供我们使用:
\indent \begin{itemize}
\item \href{https://github.com/facebook/fbctf}{FBCTF} - The Facebook CTF is a platform to host Jeopardy and “King of the Hill” style Capture the Flag competitions.
\item \href{https://github.com/CTFd/CTFd}{CTFd} - CTFd is a Capture The Flag in a can. It's easy to customize with plugins and themes and has everything you need to run a jeopardy style CTF.
\item \href{https://github.com/cliffe/SecGen}{SecGen} - SecGen creates vulnerable virtual machines so students can learn security penetration testing techniques.
\end{itemize}
\subsection{参考}
\indent \setlength{\parindent}{2em}
\indent \href{https://baike.baidu.com/item/ctf/9548546}{https://baike.baidu.com/item/ctf/9548546}
\section{学习方法}
\indent \setlength{\parindent}{2em}
\indent \href{https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way}{提问的智慧}
\section{Linux基础}
\setlength{\parindent}{2em}
\subsection{常用Linux命令}
\subsubsection{常用基础命令}
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=基础命令]
ls # 用来显示目标列表
cd [path] # 用来切换工作目录
pwd # 以绝对路径的方式显示用户当前工作目录
man [command] # 查看Linux中的指令帮助等信息
echo [string] # 打印一行文本,参数“-e”可激活转义字符
cat [file] # 连接文件并打印到标准输出设备上
less [file] # 允许用户向前或向后浏览文字档案的内容
mv [file1] [file2] # 对文件或目录重新命名,或者将文件从一个目录移到另一个目录
cp [file1] [file2] # 复制文件到指定的目的文件或目录
rm [file] # 可以删除一个目录中的一个或多个文件或目录
ps # 用于报告当前系统的进程状态
top # 实时查看系统的整体运行情况
kill # 杀死一个进程
ifconfig # 查看或设置网络设备
ping # 查看网络上的主机是否工作
netstat # 显示网络连接、路由表和网络接口信息
nc(netcat) # 建立 TCP 和 UDP 连接并监听
su # 切换当前用户身份到其他用户身份
touch [file] # 创建新的空文件
mkdir [dir] # 创建目录
chmod # 变更文件或目录的权限
chown # 变更某个文件或目录的所有者和所属组
nano / vim / emacs # 字符终端的文本编辑器
exit # 退出 shell
| # 将一个命令的标准输出作为另一个命令的标准输入
\end{lstlisting}
\subsubsection{Bash 快捷键}
\indent \setlength{\parindent}{2em}
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=Bash快捷键]
Up(Down) # 上(下)一条指令
Ctrl + c # 终止当前进程
Ctrl + z # 挂起当前进程使用“fg”可唤醒
Ctrl + d # 删除光标处的字符
Ctrl + l # 清屏
Ctrl + a # 移动到命令行首
Ctrl + e # 移动到命令行尾
Ctrl + b # 按单词后移(向左)
Ctrl + f # 按单词前移(向右)
Ctrl + Shift + c # 复制
Ctrl + Shift + v # 粘贴
\end{lstlisting}
\indent 更多细节请查看:\href{https://ss64.com/bash/syntax-keyboard.html}{bash keyboard shortcuts}
\subsubsection{根目录结构}
\indent \setlength{\parindent}{2em}
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=目录结构]
$ uname -a
Linux manjaro 4.11.5-1-ARCH #1 SMP PREEMPT Wed Jun 14 16:19:27 CEST 2017 x86_64 GNU/Linux
$ ls -al /
drwxr-xr-x 17 root root 4096 Jun 28 20:17 .
drwxr-xr-x 17 root root 4096 Jun 28 20:17 ..
lrwxrwxrwx 1 root root 7 Jun 21 22:44 bin -> usr/bin
drwxr-xr-x 4 root root 4096 Aug 10 22:50 boot
drwxr-xr-x 20 root root 3140 Aug 11 11:43 dev
drwxr-xr-x 101 root root 4096 Aug 14 13:54 etc
drwxr-xr-x 3 root root 4096 Apr 8 19:59 home
lrwxrwxrwx 1 root root 7 Jun 21 22:44 lib -> usr/lib
lrwxrwxrwx 1 root root 7 Jun 21 22:44 lib64 -> usr/lib
drwx------ 2 root root 16384 Apr 8 19:55 lost+found
drwxr-xr-x 2 root root 4096 Oct 1 2015 mnt
drwxr-xr-x 15 root root 4096 Jul 15 20:10 opt
dr-xr-xr-x 267 root root 0 Aug 3 09:41 proc
drwxr-x--- 9 root root 4096 Jul 22 22:59 root
drwxr-xr-x 26 root root 660 Aug 14 21:08 run
lrwxrwxrwx 1 root root 7 Jun 21 22:44 sbin -> usr/bin
drwxr-xr-x 4 root root 4096 May 28 22:07 srv
dr-xr-xr-x 13 root root 0 Aug 3 09:41 sys
drwxrwxrwt 36 root root 1060 Aug 14 21:27 tmp
drwxr-xr-x 11 root root 4096 Aug 14 13:54 usr
drwxr-xr-x 12 root root 4096 Jun 28 20:17 var
\end{lstlisting}
\indent 由于不同的发行版会有略微的不同,我们这里使用的是基于 Arch 的发行版 Manjaro以上就是根目录下的内容我们介绍几个重要的目录
\begin{itemize}
\item \verb+/bin+、\verb+/sbin+:链接到 \verb+/usr/bin+,存放 Linux 一些核心的二进制文件,其包含的命令可在 shell 上运行。
\item \verb+/boot+:操作系统启动时要用到的程序。
\item \verb+/dev+:包含了所有 Linux 系统中使用的外部设备。需要注意的是这里并不是存放外部设备的驱动程序,而是一个访问这些设备的端口。
\item \verb+/etc+:存放系统管理时要用到的各种配置文件和子目录。
\item \verb+/etc/rc.d+:存放 Linux 启动和关闭时要用到的脚本。
\item \verb+/home+:普通用户的主目录。
\item \verb+/lib+、\verb+/lib64+:链接到 \verb+/usr/lib+,存放系统及软件需要的动态链接共享库。
\item \verb+/mnt+:这个目录让用户可以临时挂载其他的文件系统。
\item \verb+/proc+:虚拟的目录,是系统内存的映射。可直接访问这个目录来获取系统信息。
\item \verb+/root+:系统管理员的主目录。
\item \verb+/srv+:存放一些服务启动之后需要提取的数据。
\item \verb+/sys+:该目录下安装了一个文件系统 sysfs。该文件系统是内核设备树的一个直观反映。当一个内核对象被创建时对应的文件和目录也在内核对象子系统中被创建。
\item \verb+/tmp+:公用的临时文件存放目录。
\item \verb+/usr+:应用程序和文件几乎都在这个目录下。
\item \verb+/usr/src+:内核源代码的存放目录。
\item \verb+/var+:存放了很多服务的日志信息。
\end{itemize}
\subsubsection{进程管理}
\indent \setlength{\parindent}{2em}
\begin{itemize}
\item \verb+top+ 可以实时动态地查看系统的整体运行情况。
\item \verb+ps+ 用于报告当前系统的进程状态。可以搭配 \verb+kill+ 指令随时中断、删除不必要的程序。
\item 查看某进程的状态:\verb+$ ps -aux | grep [file]+其中返回内容最左边的数字为进程号PID
\item \verb+kill+用来删除执行中的程序或工作。
\item 删除进程某 PID 指定的进程:\verb+$ kill [PID]+
\end{itemize}
\subsubsection{UID 和 GID}
\indent \setlength{\parindent}{2em}
\indent Linux 是一个支持多用户的操作系统,每个用户都有 User ID(UID) 和 Group ID(GID)UID 是对一个用户的单一身份标识,而 GID 则对应多个 UID。知道某个用户的 UID 和 GID 是非常有用的,一些程序可能就需要 UID/GID 来运行。可以使用 id 命令来查看:
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=查看uid]
$ id root
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),19(log)
$ id firmy
uid=1000(firmy) gid=1000(firmy) groups=1000(firmy),3(sys),7(lp),10(wheel),90(network),91(video),93(optical),95(storage),96(scanner),98(power),56(bumblebee)
\end{lstlisting}
\indent UID 为 0 的\verb+root+ 用户类似于系统管理员,它具有系统的完全访问权。我自己新建的用户 \verb+firmy+,其 UID 为 1000是一个普通用户。GID 的关系存储在 \verb+/etc/group+ 文件中:
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=查看gid]
$ cat /etc/group
root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,firmy
......
\end{lstlisting}
\indent 所有用户的信息(除了密码)都保存在 \verb+/etc/passwd+ 文件中,而为了安全起见,加密过的用户密码保存在 \verb+/etc/shadow+ 文件中,此文件只有\verb+root+权限可以访问。
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=查看shadow+文件]
$ sudo cat /etc/shadow
root:$6$root$wvK.pRXFEH80GYkpiu1tEWYMOueo4tZtq7mYnldiyJBZDMe.mKwt.WIJnehb4bhZchL/93Oe1ok9UwxYf79yR1:17264::::::
firmy:$6$firmy$dhGT.WP91lnpG5/10GfGdj5L1fFVSoYlxwYHQn.llc5eKOvr7J8nqqGdVFKykMUSDNxix5Vh8zbXIapt0oPd8.:17264:0:99999:7:::
\end{lstlisting}
\indent 由于普通用户的权限比较低,这里使用\verb+sudo+ 命令可以让普通用户以 root 用户的身份运行某一命令。使用\verb+su+ 命令则可以切换到一个不同的用户:
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=切换用户]
$ whoami
firmy
$ su root
# whoami
root
\end{lstlisting}
\indent \verb+whoami+用于打印当前有效的用户名称shell 中普通用户以\verb+$+开头,\verb+root+ 用户以\verb+#+开头。在输入密码后,我们已经从\verb+firmy+用户转换到 \verb+root+用户了。
\subsubsection{权限设置}
\indent \setlength{\parindent}{2em}
\intent 在Linux中文件或目录权限的控制分别以读取、写入、执行 3 种一般权限来区分,另有 3 种特殊权限可供运用。
\indent 使用\verb+ls -l [file]+来查看某文件或目录的信息:
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=查看文件目录信息]
$ ls -l /
lrwxrwxrwx 1 root root 7 Jun 21 22:44 bin -> usr/bin
drwxr-xr-x 4 root root 4096 Jul 28 08:48 boot
-rw-r--r-- 1 root root 18561 Apr 2 22:48 desktopfs-pkgs.txt
\end{lstlisting}
\indent 第一栏从第二个字母开始就是权限字符串,权限表示三个为一组,依次是所有者权限、组权限、其他人权限。每组的顺序均为 \verb+rwx+,如果有相应权限,则表示成相应字母,如果不具有相应权限,则用\verb+-+表示。
\begin{itemize}
\item \verb+r+:读取权限,数字代号为 “4”
\item \verb+w+:写入权限,数字代号为 “2”
\item \verb+x+:执行或切换权限,数字代号为 “1”
\end{itemize}
\indent 通过第一栏的第一个字母可知,第一行是一个链接文件 \verb+l+),第二行是个目录(\verb+d+),第三行是个普通文件(\verb+-+)。
\indent 用户可以使用\verb+chmod+ 指令去变更文件与目录的权限。权限范围被指定为所有者(\verb+u+)、所属组(\verb+g+)、其他人(\verb+o+)和所有人(\verb+a+)。
\begin{itemize}
\item \verb+-R+:递归处理,将指令目录下的所有文件及子目录一并处理;
\item <权限范围>+<权限设置>:开启权限范围的文件或目录的该选项权限设置
\item \verb|$ chmod a+r [file]|:赋予所有用户读取权限
\item <权限范围>-<权限设置>:关闭权限范围的文件或目录的该选项权限设置
\item \verb+$ chmod u-w [file]+:取消所有者写入权限
\item <权限范围>=<权限设置>:指定权限范围的文件或目录的该选项权限设置;
\item \verb+$ chmod g=x [file]+:指定组权限为可执行
\item \verb+$ chmod o=rwx [file]+:制定其他人权限为可读、可写和可执行
\end{itemize}
\indent \\
\indent
\begin{figure}[ht]
\includegraphics[width=0.6in]{images/content/1.3_file.png}
\captionof{figure}{文件描述符}
\label{fig:文件描述符}
\end{figure}
\subsubsection{字节序}
\indent \setlength{\parindent}{2em}
\indent 目前计算机中采用两种字节存储机制大端Big-endian和小端Little-endian
\indent Big-endian 规定 MSB 在存储时放在低地址在传输时放在流的开始LSB 存储时放在高地址在传输时放在流的末尾。Little-endian 则相反。
\indent 常见的 Intel 处理器使用 Little-endian而 PowerPC 系列处理器则使用 Big-endian另外 TCP/IP 协议和 Java 虚拟机的字节序也是 Big-endian。
\indent 例如十六进制整数 \verb+0x12345678+ 存入以 \verb+1000H+ 开始的内存中:
\indent \ \\
\indent \ \\
\indent \ \\
\indent \ \\
\indent \ \\
\indent \ \\
\indent \ \\
\begin{figure}[ht]
\indent \\
\includegraphics[width=0.8in]{images/content/1.3_byte_order.png}
\captionof{figure}{字节序}
\label{fig:字节序}
\end{figure}
\indent \\
\indent 我们在内存中实际地看一下,在地址 \verb+0xffffd584+ 处有字符 \verb+1234+,在地址 \verb+0xffffd588+处有字符 \verb+5678+。
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=内存中的字节]
gdb-peda$ x/w 0xffffd584
0xffffd584: 0x34333231
gdb-peda$ x/4wb 0xffffd584
0xffffd584: 0x31 0x32 0x33 0x34
gdb-peda$ python print('\x31\x32\x33\x34')
1234
gdb-peda$ x/w 0xffffd588
0xffffd588: 0x38373635
gdb-peda$ x/4wb 0xffffd588
0xffffd588: 0x35 0x36 0x37 0x38
gdb-peda$ python print('\x35\x36\x37\x38')
5678
gdb-peda$ x/2w 0xffffd584
0xffffd584: 0x34333231 0x38373635
gdb-peda$ x/8wb 0xffffd584
0xffffd584: 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38
gdb-peda$ python print('\x31\x32\x33\x34\x35\x35\x36\x37\x38')
123455678
db-peda$ x/s 0xffffd584
0xffffd584: "12345678"
\end{lstlisting}
\subsubsection{输入输出}
\indent \setlength{\parindent}{2em}
\begin{itemize}
\item 使用命令的输出作为可执行文件的输入参数
\item \verb|$ ./vulnerable 'your_command_here'|
\item \verb|$ ./vulnerable $(your_command_here)|
\item 使用命令作为输入
\item \verb+$ your_command_here | ./vulnerable+
\item 将命令行输出写入文件
\item \verb+$ your_command_here > filename+
\item 使用文件作为输入
\item \verb+$ ./vulnerable < filename+
\end{itemize}
\subsubsection{文件描述符}
\indent \setlength{\parindent}{2em}
\indent 在 Linux 系统中一切皆可以看成是文件文件又分为普通文件、目录文件、链接文件和设备文件。文件描述符file descriptor是内核管理已被打开的文件所创建的索引使用一个非负整数来指代被打开的文件。
\indent 标准文件描述符如下:
\indent \\
\begin{tabular}[ht]{|c|c|c|}
\hline
文件描述符 & 用途 & stdio 流 \\
\hline
0 & 标准输入 & stdin \\
\hline
1 & 标准输出 & stdout \\
\hline
2 & 标准错误 & stderr \\
\hline
\end{tabular}
\indent 当一个程序使用 \verb+fork+ 生成一个子进程后,子进程会继承父进程所打开的文件表,此时,父子进程使用同一个文件表,这可能导致一些安全问题。如果使用 \verb+fork()+,子进程虽然运行于父进程的空间,但拥有自己的进程表项。
\subsubsection{核心转储}
\indent \setlength{\parindent}{2em}
\indent 当程序运行的过程中异常终止或崩溃操作系统会将程序当时的内存、寄存器状态、堆栈指针、内存管理信息等记录下来保存在一个文件中这种行为就叫做核心转储Core Dump
\indent 会产生核心转储的信号:
\begin{tabular}{|c|c|c|}
\hline
Signal & Action & Comment \\
\hline
SIGQUIT & Core & Quit from keyboard \\
\hline
SIGILL & Core & Illegal Instruction \\
\hline
SIGABRT & Core & Abort signal from abort \\
\hline
SIGSEGV & Core & Invalid memory reference \\
\hline
SIGTRAP & Core & Trace/breakpoint trap \\
\hline
\end{tabular}
\indent 开启核心转储:
\indent \begin{itemize}
\item 输入命令 \verb+ulimit -c+,输出结果为 0说明默认是关闭的。
\item 输入命令 \verb+ulimit -c unlimited+ 即可在当前终端开启核心转储功能。
\item 如果想让核心转储功能永久开启,可以修改文件 \verb+/etc/security/limits.conf+,增加一行:
\item \verb+#<domain> <type> <item> <value>+
\item \verb+* soft core unlimited+
\end{itemize}
\indent
\indent 修改转储文件保存路径:
\begin{itemize}
\item 通过修改 \verb+/proc/sys/kernel/core_uses_pid+,可以使生成的核心转储文件名变为 \verb+core.[pid]+ 的模式:
\item \verb+# echo 1 > /proc/sys/kernel/core_uses_pid+
\item 还可以修改 \verb+/proc/sys/kernel/core_pattern+ 来控制生成核心转储文件的保存位置和文件名格式:
\item \verb+# echo /tmp/core-%e-%p-%t > /proc/sys/kernel/core_pattern+
\end{itemize}
\indent 此时生成的文件保存在 /tmp/ 目录下,文件名格式为 core-[filename]-[pid]-[time]。
\indent 例子:
\begin{lstlisting}[language=bash, style=customStyleBashDark, caption=内存转储示例]
$ cat core.c
#include <stdio.h>
void main(int argc, char **argv) {
char buf[5];
scanf("%s", buf);
}
$ gcc -m32 -fno-stack-protector core.c
$ ./a.out
AAAAAAAAAAAAAAAAAAAA
Segmentation fault (core dumped)
$ file /tmp/core-a.out-12444-1503198911
/tmp/core-a.out-12444-1503198911: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, from './a.out', real uid: 1000, effective uid: 1000, real gid: 1000, effective gid: 1000, execfn: './a.out', platform: 'i686'
$ gdb a.out /tmp/core-a.out-12444-1503198911 -q
Reading symbols from a.out...(no debugging symbols found)...done.
[New LWP 12444]
Core was generated by `./a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x5655559b in main ()
gdb-peda$ info frame
Stack level 0, frame at 0x41414141:
eip = 0x5655559b in main; saved eip = <not saved>
Outermost frame: Cannot access memory at address 0x4141413d
Arglist at 0x41414141, args:
Locals at 0x41414141, Previous frame's sp is 0x41414141
Cannot access memory at address 0x4141413d
\end{lstlisting}
\subsubsection{调用约定}
\indent \setlength{\parindent}{2em}
\indent 函数调用约定是对函数调用时如何传递参数的一种约定。关于它的约定有许多种,下面我们分别从内核接口和用户接口介绍 32 位和 64 位 Linux 的调用约定。
\indent 内核接口
\indent x86-32 系统调用约定Linux 系统调用使用寄存器传递参数。
\indent \verb+eax+ 为 \verb+syscall_number+\verb+ebx+、\verb+ecx+、\verb+edx+、\verb+esi+、\verb+ebp+ 用于将 6 个参数传递给系统调用。返回值保存在 eax 中。所有其他寄存器(包括 \verb+EFLAGS+)都保留在 \verb+int 0x80+ 中。
\indent x86-64 系统调用约定:内核接口使用的寄存器有:\verb+rdi+、\verb+rsi+、\verb+rdx+、\verb+r10+、\verb+r8+、\verb+r9+。系统调用通过 \verb+syscall+ 指令完成。除了 \verb+rcx+、\verb+r11+ 和 \verb+rax+,其他的寄存器都被保留。系统调用的编号必须在寄存器 \verb+rax+ 中传递。系统调用的参数限制为 6 个,不直接从堆栈上传递任何参数。返回时,\verb+rax+ 中包含了系统调用的结果。而且只有 \verb+INTEGER+ 或者 \verb+MEMORY+ 类型的值才会被传递给内核。
\indent 用户接口
\indent x86-32 函数调用约定:
\indent 参数通过栈进行传递。最后一个参数第一个被放入栈中,直到所有的参数都放置完毕,然后执行 \verb+call+ 指令。这也是 Linux 上 C 语言函数的方式。
\indent x86-64 函数调用约定:
\indent x86-64 下通过寄存器传递参数,这样做比通过栈有更高的效率。它避免了内存中参数的存取和额外的指令。根据参数类型的不同,会使用寄存器或传参方式。如果参数的类型是 \verb+MEMORY+,则在栈上传递参数。如果类型是 \verb+INTEGER+,则顺序使用 \verb+rdi+、\verb+rsi+、\verb+rdx+、\verb+rcx+、\verb+r8+ 和 \verb+r9+。所以如果有多于 6 个的 \verb+INTEGER+ 参数,则后面的参数在栈上传递。
\subsubsection{环境变量}
\indent \setlength{\parindent}{2em}
\subsubsection{/proc/[pid]}
\indent \setlength{\parindent}{2em}
\section{Web安全基础}
\indent \setlength{\parindent}{2em}
\section{逆向工程基础}
\indent \setlength{\parindent}{2em}
\section{现代密码学基础}
\indent \setlength{\parindent}{2em}
\section{Android安全基础}
\indent \setlength{\parindent}{2em}

View File

@ -1,23 +0,0 @@
\input{contents/ZH/introduction/introduction}
\newpage
\input{contents/ZH/chapter1_basic/chapter1_basic}
% \input{contents/ZH/snippets/snippets}
% \newpage
% \input{contents/ZH/useofabbreviations/useofabbreviations}
% \newpage
% \input{contents/ZH/useofbibliography/useofbibliography}
% \newpage
% \input{contents/ZH/useofindex/useofindex}
% \newpage
% \input{contents/ZH/tables/tables}
% \newpage
% \input{contents/ZH/footnotes/footnotes}
% \newpage
% \input{contents/ZH/japanese/japanese}
% \newpage
% \input{contents/ZH/images/images}
% \newpage
% \input{contents/ZH/landscape/landscape}
% \newpage
% \input{contents/ZH/mathematics/mathematics}

View File

@ -1,114 +0,0 @@
\chapter{前言}\index{前言}
\begin{quote}
“与其相信谣言,不如一起学习”。
\end{quote}
\section{常见问题}
\begin{itemize}\setlength{\parindent}{2em}
\item 什么是 CTF我为什么要学
CTF 是网络安全技术人员之间进行技术竞技的一种比赛形式,通过学习,可以在法律允许的范围内,快速地了解和掌握相关安全技术。
\item 阅读本书的预备知识是什么?
本书是为初学者准备的,不要求有预备知识,但如果对 Linux 操作系统,对编程有一定了解,肯定会有帮助。
\item 我可以买到纸质版吗?
抱歉,目前没有。除非对纸质书有偏好,你可以自行打印。否则由于内容整体尚未完成,且更新很快,作者更推荐使用电子版。
\item 本书有PDF/epub/mobi格式的吗
目前没有 epub/mobi 版本。暂时有 pdf可在 GitBook 页面下载,这群人正在努力学习 \LaTeX\␣ 的使用以提供更优雅的排版和PDF文件。
\item 我能打印本书或者作为教材教课吗?
太棒了!必须的!本书使用 Creative Commons license (CC BY-SA 4.0),大可随意使用。作为一个开源项目,我们当然希望更多的人了解并参与进来。
\item 本书为何免费,有何目的?
技术类书籍大多赚不到钱,只是作者的兴趣使然,顺便给自己打个广告。让更多的人了解并推广,才是我们的目的所在,也是开源精神之所在。
\item 我还有其他问题。
你也可以选择提交issue到本仓库也可以邮件联系我们。
\end{itemize}
\section{合作与贡献}
\indent \setlength{\parindent}{2em}
\indent 随着信息安全的迅速发展CTF 竞赛也在如火如荼的开展,有人说 “今天的 ACM 就是明天的 CTF” ,颇有几分道理。
\\目前市场上已经充斥着大量的 ACM 书籍,而 CTF 以其知识内容之分散、考察面之广泛、题目类型之多变,让许多新手不知所措,同时也加大了该方面书籍的编写难度。
\indent 此书本着开源之精神,以分享他人提高自己为目的,将是一本大而全的 CTF 领域指南。因本人能力和时间有限,不可能精通各个类别的知识,欢迎任何人提出任何建议,和我一起完成此书。千万不要觉得自己是初学者就不敢提交 PRissue千万不要担心自己提交的 PRissue 会有问题,毕竟最后合并的人是我,背锅的也是我:)
\indent 如果你还有关于本书的其他想法,请直接给我发邮件 firmianay@gmail.com。
\section{致谢}
\indent \setlength{\parindent}{2em}
\indent 感谢内容贡献者skyel1u、phantom0301
\indent 感谢 XDSEC把我引上了安全这条路认识了很多志同道合的小伙伴。
\indent 感谢 GitHub 上的朋友,是你们的 star 给我写作的动力。
\chapter{前言}\index{前言}
\begin{quote}
“与其相信谣言,不如一起学习”。
\end{quote}
\section{常见问题}
\begin{itemize}\setlength{\parindent}{2em}
\item 什么是 CTF我为什么要学
CTF 是网络安全技术人员之间进行技术竞技的一种比赛形式,通过学习,可以在法律允许的范围内,快速地了解和掌握相关安全技术。
\item 阅读本书的预备知识是什么?
本书是为初学者准备的,不要求有预备知识,但如果对 Linux 操作系统,对编程有一定了解,肯定会有帮助。
\item 我可以买到纸质版吗?
抱歉,目前没有。除非对纸质书有偏好,你可以自行打印。否则由于内容整体尚未完成,且更新很快,作者更推荐使用电子版。
\item 本书有PDF/epub/mobi格式的吗
目前没有 epub/mobi 版本。暂时有 pdf可在 GitBook 页面下载,这群人正在努力学习 \LaTeX\␣ 的使用以提供更优雅的排版和PDF文件。
\item 我能打印本书或者作为教材教课吗?
太棒了!必须的!本书使用 Creative Commons license (CC BY-SA 4.0),大可随意使用。作为一个开源项目,我们当然希望更多的人了解并参与进来。
\item 本书为何免费,有何目的?
技术类书籍大多赚不到钱,只是作者的兴趣使然,顺便给自己打个广告。让更多的人了解并推广,才是我们的目的所在,也是开源精神之所在。
\item 我还有其他问题。
你也可以选择提交issue到本仓库也可以邮件联系我们。
\end{itemize}
\section{合作与贡献}
\indent \setlength{\parindent}{2em}
\indent 随着信息安全的迅速发展CTF 竞赛也在如火如荼的开展,有人说 “今天的 ACM 就是明天的 CTF” ,颇有几分道理。
\\目前市场上已经充斥着大量的 ACM 书籍,而 CTF 以其知识内容之分散、考察面之广泛、题目类型之多变,让许多新手不知所措,同时也加大了该方面书籍的编写难度。
\indent 此书本着开源之精神,以分享他人提高自己为目的,将是一本大而全的 CTF 领域指南。因本人能力和时间有限,不可能精通各个类别的知识,欢迎任何人提出任何建议,和我一起完成此书。千万不要觉得自己是初学者就不敢提交 PRissue千万不要担心自己提交的 PRissue 会有问题,毕竟最后合并的人是我,背锅的也是我:)
\indent 如果你还有关于本书的其他想法,请直接给我发邮件 firmianay@gmail.com。
\section{致谢}
\indent \setlength{\parindent}{2em}
\indent 感谢内容贡献者skyel1u、phantom0301
\indent 感谢 XDSEC把我引上了安全这条路认识了很多志同道合的小伙伴。
\indent 感谢 GitHub 上的朋友,是你们的 star 给我写作的动力。

View File

@ -1,5 +0,0 @@
\IfFileExists{contents/\CONFIGLanguage/contents}{
\input{contents/\CONFIGLanguage/contents}
}{false-branch
Content: UNSUPPORTED LANGUAGE ,,\CONFIGLanguage ``
}

View File

@ -1,19 +0,0 @@
% Global definitions
\def\DICTDocDate{\today}
\def\DICTTableOfContents{Table of Contents}
\def\DICTListOfFigures{List of Figures}
\def\DICTFigureName{Figure}
\def\DICTListOfTables{List of Tables}
\def\DICTTableName{Table}
\def\DICTListOfCodeSnippets{List of Code Snippets}
\def\DICTListingName{Code Snippet}
\def\DICTAbbreviations{List of Abbreviations}
\def\DICTAppendix{Appendix}
\def\DICTTableOfAppendix{Table of Appendix}
\def\DICTReferences{References}
\def\DICTIndex{Index}
% Dict
\def\DICTDocTitle{CTF ALL IN ONE}
\def\DICTDocAuthor{firmianay | Skyel1u | phantom0301}
\def\DICTDocEmail{https://github.com/firmianay/CTF-All-In-One}

View File

@ -1,19 +0,0 @@
% Global definitions
\def\DICTDocDate{\today}
\def\DICTTableOfContents{目录}
\def\DICTListOfFigures{图片列表}
\def\DICTFigureName{图片}
\def\DICTListOfTables{表格列表}
\def\DICTTableName{列表}
\def\DICTListOfCodeSnippets{代码片段列表}
\def\DICTListingName{代码片段}
\def\DICTAbbreviations{缩略短语表}
\def\DICTAppendix{附录}
\def\DICTTableOfAppendix{附录表}
\def\DICTReferences{引用}
\def\DICTIndex{索引}
% Dict
\def\DICTDocTitle{CTF 从入门到放弃}
\def\DICTDocAuthor{ Firmianay | Phantom0301 | Skyel1u}
\def\DICTDocEmail{https://github.com/firmianay/CTF-All-In-One}

View File

@ -1,5 +0,0 @@
\IfFileExists{dictionary/\CONFIGLanguage}{
\input{dictionary/\CONFIGLanguage}
}{
Dictionary: UNSUPPORTED LANGUAGE ,,\CONFIGLanguage ``
}

View File

@ -1,3 +0,0 @@
\newpage
\thispagestyle{empty}
\mbox{}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -1,175 +0,0 @@
% The main document in ShareLaTeX is the file which LATEX will be told to compile first. It is the main file of the project, which all other parts (classes, packages, chapters etc.) will be inputted into. By default in ShareLaTeX, the main document will be set to be the document in the project which begins with the \documentclass[...]{...} command.
\documentclass[
a4paper, % a4 size 210x297 mm
12pt,
openany, % required to remove empty page after chapter
oneside % oneside or twoside
]{scrbook}
% initialize basic settings
\input{config/config}
% being document
\begin{document}
%required for appendix
\dominitoc
% adds only page number to page
\pagestyle{plain}
% change page numbering to arabic and start by page 1
\pagenumbering{Roman}
% Title page
%--------------------------------------
\ifthenelse{\equal{\CONFIGEnableTitlePage}{true}}
{
\input{base/titlepage/titlepage}
\setcounter{page}{3}
}{}
%--------------------------------------
% Second page with disclaimer and copyright
%--------------------------------------
% remove page number on this page
\ifthenelse{\equal{\CONFIGEnableDisclaimer}{true}}
{
\thispagestyle{empty}
}{
\ifthenelse{\equal{\CONFIGEnableCopyright}{true}}
{
\thispagestyle{empty}
}{}
}
\ifthenelse{\equal{\CONFIGEnableDisclaimer}{true}}
{
\input{base/disclaimer/disclaimer}
}{}
\ifthenelse{\equal{\CONFIGEnableDisclaimer}{true}}
{
\vfill
}{
\ifthenelse{\equal{\CONFIGEnableCopyright}{true}}
{
\phantom{}
\vfill
}{}
}
\ifthenelse{\equal{\CONFIGEnableCopyright}{true}}
{
\input{base/copyright/copyright}
}{}
\ifthenelse{\equal{\CONFIGEnableDisclaimer}{true}}
{
\newpage
}{
\ifthenelse{\equal{\CONFIGEnableCopyright}{true}}
{
\newpage
}{}
}
%--------------------------------------
% Table of contents
%-------------------------------------
\ifthenelse{\equal{\CONFIGEnableTableOfContents}{true}}
{
%\pagestyle{empty}
\input{base/tableofcontents/tableofcontents}
\newpage
}{}
%--------------------------------------
% List of Figures
%--------------------------------------
\ifthenelse{\equal{\CONFIGEnableListOfFigures}{true}}
{
\input{base/listoffigures/listoffigures}
\newpage
}{}
%--------------------------------------
% List of Tables
%--------------------------------------
\ifthenelse{\equal{\CONFIGEnableListOfTables}{true}}
{
\input{base/listoftables/listoftables}
\newpage
}{}
%--------------------------------------
% List of Listings
%--------------------------------------
\ifthenelse{\equal{\CONFIGEnableListOfSnippets}{true}}
{
\input{base/lstlistoflistings/lstlistoflistings}
\newpage
}{}
%--------------------------------------
% List of Abbreviations
%--------------------------------------
\ifthenelse{\equal{\CONFIGEnableListOfAbbreviations}{true}}
{
\input{base/abbreviations/abbreviations}
\newpage
}{}
%--------------------------------------
% change page numbering to arabic and start by page 1
\pagenumbering{arabic}
% Header & footer
%--------------------------------------
\input{base/headerfooter/headerfooter}
%--------------------------------------
% Content
%--------------------------------------
\input{contents/contents}
%--------------------------------------
% Appendix
%--------------------------------------
\ifthenelse{\equal{\CONFIGEnableAppendix}{true}}
{
\input{base/appendix/appendix}
\ifthenelse{\equal{\CONFIGEnableReferences}{true}}
{
\newpage
}{
\ifthenelse{\equal{\CONFIGEnableIndex}{true}}
{
\newpage
}{}
}
}{}
%--------------------------------------
% References
%-------------------------------------
\ifthenelse{\equal{\CONFIGEnableReferences}{true}}
{
\input{base/bibliography/bibliography}
\ifthenelse{\equal{\CONFIGEnableIndex}{true}}
{
\newpage
}{}
}{}
%--------------------------------------
% Index
%--------------------------------------
\ifthenelse{\equal{\CONFIGEnableIndex}{true}}
{
\input{base/index/index}
}{}
%--------------------------------------
\end{document}