This is the team hackpack for the Clemson Cyber Defense Team. It is a resource for blue teams competing in red vs blue cyber defense completions.
We will use the following tools to maintain and build the hackpack:
git- for tracking changesawk- text processing tool needed for version directivespdflatex- The Hackpack body is written in LaTeXmake- Make is to automate compilation and testing of the documentsperl- required to support renaming in version directivesfind- the gnu version of find is required supporting extended posix regular expressions for supporting version directives. On OSX thefindutilspackage from homebrew can be used
For all projects and improvements:
- Clone the repo
- Choose an issue from the issue tracker
- Checkout a new branch with the topic as the name
- Push the branch to the repo
- When the branch is complete, create a pull request in Bitbucket
- When the pull request is reviewed and approved, the code will be merged by one of the admins into master.
If you have any questions related to the issues in the tracker, comment on the issues and CC one of the admins.
All examples assume a topic called foo and a sample script bar on operating
system os:
General guidelines:
- All file names should be lowercase with
-(hyphens) separating the words in a file. For example,ten-commandments.texinstead ofTenCommandments.tex - All scripts should be in a subdirectory called
scriptsand in a further subdirectory based on the script name. For example if the topicfoohas a scriptbarthe path to the code sample could befoo/problems/bar/bar.sh. - In the rare circumstance that your finished product is only one
texfile, place it ingeneralinstead - See how the
firewallmaterial is laid out for reference. It is infirewalls/directory
Naming conventions:
foothe name of the branch wherefoois being worked onfoo.texthe hackpack documentation on the algorithmbar.shA script written in bash.bar.ps1A script written in Microsoft Powershell.bar.pyA script written in python. Scripts should be written in Python 3.bar.insample input forfoo.{sh,ps1,py}if applicablebar.outsample output forfoo.{sh,ps1,py}if applicablebar.examplefiles such as.vimrcthat do not have an extension normallybar.batsAutomated test case written in bats for the scriptbarthat shows that it is correct Do Not Include ISO Images In The Repo. This is to make them easier to spot them in the gitignore.Dockerfile-bar-osDocker environment that can be used to test bar on os.Vagrentfile-bar-osVagerantfile that defines an environment that could be use to test bar on os.
For each item in the Hackpack, please include the following in clearly delineated subsections:
-
Name and Brief Description of the topic
-
A list of possible uses, applications, and best practices.
-
Sample scripts and con fig files where applicable
-
Please use the
\acmlistingfor code listings. A caption and label should be specified. If applicable, line ranges should be specified to limit the amount of text displayed. -
It would be preferred if each set of sample code had some lessons learned to point out some key elements of the implementation
-
References using BibTeX where applicable
-
Should be "compiled" properly by make
-
Each sentence must be on a separate line.
-
The condensed version of the hackpack should have the following removed:
- Introductions to the topic.
- Guidelines directing the reader to different sections of the hackpack.
- As much as possible, index tags should NOT be removed.
Code Must meet the following standards:
-
Code should be indented with tabs and not exceed 80 characters per line.
-
Code must be delivered with the passing unit tests. where applicable
-
Code must be concise but not at the expense of readability
-
Source code must solve a problem: It should solve a specific problem and include all relevant IO and supporting code. The script should not be in a vacuum.
-
The condensed hackpack version should have the following removed:
- Comments that are not critical to the readers understanding understanding
All code must have tests that meet the following requirements
-
All tests should be written using the bats framework See the
firewalls/iptablessection for an example. -
Testing files should be postfixed by
-testprior to the extension. For example,foo.cpptest files should be calledfoo-test.cppandfoo-test.inrespectively -
Tests should be runnable by calling
make testin the directory of the source- The tests should return 0 in the case that all test cases passed
- The tests should return 2 in the case that any test cases failed
-
For destructive tests such as applying configurations: a Dockerfile or Vagrentfile should be included along side tests, and tests should be run in this enviroment.
The hack pack is from one source built into two versions: one slim (hackpack)
and one tome-like (hackpack++, or as denoted in the build scripts,
hackpackpp). But how? By a combination of awk and dark magicks, authors can
use an extremely limited set of C-preprocessor-like #ifdefs to denote a block
of text or code as part of one version or the other. Here's an example:
// #ifdef hackpackpp
cout << "This is the Hack Pack: plusplus edition!" << endl;
// #endif
// #ifdef hackpack
cout << "This is just the regular hack pack." << endl;
// #endif
The first cout will only appear in the hackpack++'s code listing, and the
second will only appear in the normal hackpack. Note that the #ifdefs are
commented out: as long as the line ends with the if directive, they'll work
properly. You might want to comment them out so that they don't break the compilers.
Make sure you have a new line after each directive somewhere!
Here's a list of filetypes where the if directives will work:
.tex.cpp.pyexample
The hack pack uses a Makefile for building our PDF output. Here's a rundown of the make rules you'll probably be using:
make cleanwipes out the build directory if you don't have a version oflatexmkthat supports the-outdirflag, and cleans it up withlatexmk -cif you do.make hackpackbuilds the slim version of the hackpack intobuild/hackpack.pdf.make hackpackppbuilds the bulky version of the hackpack intobuild/hackpack.pdf.make showlaunchesevince(a pdf viewer) to preview the hackpack.