Skip to content

Commit

Permalink
Convert to mdbook and fix links (#65)
Browse files Browse the repository at this point in the history
* Convert to mdBook

* Add ToB favicon

* Clean up old `docs/` directory

* The book is now built and deployed via GitHub Actions

* Update contribution instructions with mdBook

* Revive links with Wayback Machine

* Update http -> https links

* Add link and spell checker
  • Loading branch information
elopez authored Nov 15, 2024
1 parent c700f51 commit 72f4625
Show file tree
Hide file tree
Showing 106 changed files with 290 additions and 13,945 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: Deploy GitHub Pages
on:
push:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
env:
CARGO_TERM_COLOR: always

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
persist-credentials: false

- name: Install mdbook
run: |
set -euxo pipefail
mkdir mdbook-bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=mdbook-bin
echo "dd131662665dd91880c8c23d867d36f6a8554286216c3a849b53a27d1a676917 mdbook-bin/mdbook" | sha256sum -c
echo "$PWD/mdbook-bin" >> "$GITHUB_PATH"
- name: Build artifacts
run: |
export MDBOOK_OUTPUT__HTML__GIT_REPOSITORY_URL="https://github.com/$REPO"
export MDBOOK_OUTPUT__HTML__EDIT_URL_TEMPLATE="https://github.com/$REPO/edit/master/{path}"
mdbook build
env:
REPO: "${{ github.repository }}"

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs

deploy:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
39 changes: 39 additions & 0 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Check Markdown files correctness

on:
push:
branches:
- master
pull_request:

jobs:
# Extract links from Markdown texts and check if they are alive
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # for v1.10.0
with:
args: --base . -a 100..=103,200..=299,429 --verbose --no-progress --cache --max-cache-age 1d --scheme http --scheme https './**/*.md'
fail: true

# Spellcheck Markdown files using `retext` and `remark`
# Uses: a custom dictionary file
spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: tbroadley/spellchecker-cli-action@v1
with:
# No need to use a dictionary file with the disabled spell plugin
# dictionaries: '.github/workflows/dictionary.txt'
files: "'**/*.md'"
quiet: true
plugins: "indefinite-article repeated-words syntax-mentions syntax-urls"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
docs/
_book/
.DS_Store
node_modules
11 changes: 11 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
https://vimeo.com/.*
https://web.archive.org/.*
https://.*.reddit.com/.*
https://www.researchgate.net/.*

# behind cloudflare
https://www.cgisecurity.com/.*

# network error from GH
https://csapp.cs.cmu.edu/.*
https://wiki.sei.cmu.edu/.*
6 changes: 5 additions & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Summary

[Introduction](README.md)

* [Capture the Flag](intro/README.md)
* [Find a CTF](intro/find.md)
* [Find a Job](intro/careers.md)
Expand All @@ -16,4 +18,6 @@
* [Toolkit Prep](toolkits/prep.md)
* [Operational Tradecraft](tradecraft/README.md)
* [Case Studies](tradecraft/case_studies.md)
* [Contributing](contrib.md)

---
[Contributing](contrib.md)
14 changes: 0 additions & 14 deletions book.json

This file was deleted.

16 changes: 16 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[book]
title = "CTF Field Guide"
description = "Getting and Using Other People's Computers"
authors = ["Trail of Bits"]
language = "en"
multilingual = false
src = "."

[build]
build-dir = "docs"

[output.html]
google-analytics = "UA-37017099-3"
git-repository-url = "https://github.com/trailofbits/ctf"
edit-url-template = "https://github.com/trailofbits/ctf/edit/master/{path}"
site-url = "/ctf/"
34 changes: 15 additions & 19 deletions contrib.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,26 @@ This book was built on a lot of hard work, most of which happened elsewhere. Wit

So, reader, when you’ve completed a few CTFs, and you’re ready for more, reach out to this list. They like to support ambition, and they just might know someone who needs some talent.

* [Andrew Ruef](http://www.mimisbrunnr.net/~munin/blog/) created the initial proposal and slides
* [Evan Jensen](https://github.com/wontonSlim) developed and refined nearly all of the lessons
* [Andrew Ruef](https://web.archive.org/web/20150219123305/http://www.mimisbrunnr.net:80/~munin/blog/) created the initial proposal and slides
* Evan Jensen developed and refined nearly all of the lessons
* [Nick Anderson](https://github.com/PoppySeedPlehzr) ran through the lessons and made numerous improvements
* [Alex Sotirov](http://www.phreedom.org/) delivered the ROP lecture and provided feedback
* [Jay Little](https://twitter.com/computerality) reviewed the binary exploitation modules
* [Brandon Edwards](https://twitter.com/drraid) delivered the source auditing lectures and the newspaper app
* [Marcin W](https://twitter.com/marcinw) and [Gotham Digital Science](http://www.gdssecurity.com/) delivered the web security lectures
* [Dino Dai Zovi](http://www.theta44.org/main.html) delivered the introductory exploitation lectures
* [Mike Myers](https://twitter.com/fristle) for contributing the chapter on forensics
* [Jay Little](https://x.com/computerality) reviewed the binary exploitation modules
* [Brandon Edwards](https://x.com/drraid) delivered the source auditing lectures and the newspaper app
* [Marcin W](https://x.com/marcinw) and [Gotham Digital Science](https://www.gdssecurity.com/) delivered the web security lectures
* [Dino Dai Zovi](https://theta44.org/) delivered the introductory exploitation lectures
* [Mike Myers](https://x.com/fristle) for contributing the chapter on forensics

If you're interested in taking a course like this one for credit, check out [NYU Poly](http://engineering.nyu.edu/academics/departments/computer/). They offer concentrations in cybersecurity and we collaborate with them frequently through their [Hacker in Residence](http://www.isis.poly.edu/hackers-in-residence) program.
If you're interested in taking a course like this one for credit, check out [NYU Poly](https://engineering.nyu.edu/academics/departments/computer-science-and-engineering). They offer concentrations in cybersecurity and we collaborate with them frequently through their [Hacker in Residence](https://web.archive.org/web/20170409054057/http://www.isis.poly.edu/hackers-in-residence) program.

# Contributing
If you want to make a contribution, simply commit your new markdown to the `master` branch and we'll take it from there. Gitbook has a fantastic [editor](https://github.com/GitbookIO/editor/releases) available to help preview your changes. We're always looking for new or refined content, so please send us your suggestions!
If you want to make a contribution, simply commit your new markdown to the `master` branch and we'll take it from there. We're always looking for new or refined content, so please send us your suggestions!

## Gitbook Usage
The CTF Field Guide is built with [Gitbook](https://github.com/GitbookIO/gitbook), a command line tool for building books with Git and Markdown. You can use Gitbook to output the CTF Field Guide as a PDF, an eBook or a single, printable HTML page. Make sure you have [NodeJS](http://nodejs.org/) and `npm` on your operating system, then install Gitbook and a few of its plugins:
## mdBook Usage
The CTF Field Guide is built with [mdBook](https://rust-lang.github.io/mdBook/), a command line tool for building books with Git and Markdown. Refer to [mdBook's installation page](https://rust-lang.github.io/mdBook/guide/installation.html) to get it set up.

```
npm install gitbook gitbook-plugin-ga gitbook-pdf ebook-convert -g
```
With mdBook installed, you can run any of these commands from within the book directory:
* Generate an interactive, static website: ```mdbook build```
* Serve the book via HTTP, to locally browse and edit it: ```mdbook serve```.

With Gitbook installed, you can run any of these commands from within the book directory:
* Generate an interactive, static website: ```gitbook build ./myrepo```
* Generate a single page website: ```gitbook build ./myrepo -f page```.
* Generate a PDF: ```gitbook pdf ./myrepo```. Requires [gitbook-pdf](https://github.com/GitbookIO/gitbook-pdf).
* Generate an eBook: ```gitbook ebook ./myrepo```. Requires [ebook-convert](http://manual.calibre-ebook.com/cli/ebook-convert.html).
Third-party plugins also exist if you wish to export the book as EPUB or PDF.
3 changes: 0 additions & 3 deletions docs/.gitignore

This file was deleted.

Loading

0 comments on commit 72f4625

Please sign in to comment.