Skip to content

Commit

Permalink
docs: sync generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pandatix committed Dec 12, 2024
1 parent e37a5e2 commit ae95ace
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 16 deletions.
45 changes: 45 additions & 0 deletions docs/resources/challenge_dynamic.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,52 @@ CTFd is built around the Challenge resource, which contains all the attributes t

This implementation has support of a more dynamic behavior for its scoring through time/solves thus is different from a standard challenge.

## Example Usage

```terraform
resource "ctfd_challenge_dynamic" "http" {
name = "My Challenge"
category = "misc"
description = "..."
value = 500
decay = 100
minimum = 50
state = "visible"
function = "logarithmic"
topics = [
"Misc"
]
tags = [
"misc",
"basic"
]
}
resource "ctfd_flag" "http_flag" {
challenge_id = ctfd_challenge_dynamic.http.id
content = "CTF{some_flag}"
}
resource "ctfd_hint" "http_hint_1" {
challenge_id = ctfd_challenge_dynamic.http.id
content = "Some super-helpful hint"
cost = 50
}
resource "ctfd_hint" "http_hint_2" {
challenge_id = ctfd_challenge_dynamic.http.id
content = "Even more helpful hint !"
cost = 50
requirements = [ctfd_hint.http_hint_1.id]
}
resource "ctfd_file" "http_file" {
challenge_id = ctfd_challenge_dynamic.http.id
name = "image.png"
contentb64 = filebase64(".../image.png")
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
41 changes: 41 additions & 0 deletions docs/resources/challenge_standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,48 @@ CTFd is built around the Challenge resource, which contains all the attributes t

It is the first historic implementation of its kind, with basic functionalities.

## Example Usage

```terraform
resource "ctfd_challenge_standard" "http" {
name = "My Challenge"
category = "misc"
description = "..."
value = 500
topics = [
"Misc"
]
tags = [
"misc",
"basic"
]
}
resource "ctfd_flag" "http_flag" {
challenge_id = ctfd_challenge_standard.http.id
content = "CTF{some_flag}"
}
resource "ctfd_hint" "http_hint_1" {
challenge_id = ctfd_challenge_standard.http.id
content = "Some super-helpful hint"
cost = 50
}
resource "ctfd_hint" "http_hint_2" {
challenge_id = ctfd_challenge_standard.http.id
content = "Even more helpful hint !"
cost = 50
requirements = [ctfd_hint.http_hint_1.id]
}
resource "ctfd_file" "http_file" {
challenge_id = ctfd_challenge_standard.http.id
name = "image.png"
contentb64 = filebase64(".../image.png")
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
22 changes: 11 additions & 11 deletions examples/provider-install-verification/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ provider "ctfd" {



resource "ctfd_challenge" "http" {
resource "ctfd_challenge_dynamic" "http" {
name = "HTTP Authentication"
category = "network"
description = <<-EOT
Expand All @@ -39,32 +39,32 @@ resource "ctfd_challenge" "http" {
}

resource "ctfd_flag" "http_flag" {
challenge_id = ctfd_challenge.http.id
challenge_id = ctfd_challenge_dynamic.http.id
content = "24HIUT{Http_1s_n0t_s3cuR3}"
}

resource "ctfd_hint" "http_hint_1" {
challenge_id = ctfd_challenge.http.id
challenge_id = ctfd_challenge_dynamic.http.id
content = "Les flux http ne sont pas chiffrés"
cost = 50
}

resource "ctfd_hint" "http_hint_2" {
challenge_id = ctfd_challenge.http.id
challenge_id = ctfd_challenge_dynamic.http.id
content = "Les informations sont POSTées en HTTP :)"
cost = 50
requirements = [ctfd_hint.http_hint_1.id]
}

resource "ctfd_file" "http_file" {
challenge_id = ctfd_challenge.http.id
challenge_id = ctfd_challenge_dynamic.http.id
name = "capture.pcapng"
contentb64 = filebase64("${path.module}/capture.pcapng")
}



resource "ctfd_challenge" "icmp" {
resource "ctfd_challenge_dynamic" "icmp" {
name = "Stealing data"
category = "network"
description = <<-EOT
Expand All @@ -82,7 +82,7 @@ resource "ctfd_challenge" "icmp" {
state = "visible"
requirements = {
behavior = "anonymized"
prerequisites = [ctfd_challenge.http.id]
prerequisites = [ctfd_challenge_dynamic.http.id]
}

flags = [{
Expand All @@ -99,25 +99,25 @@ resource "ctfd_challenge" "icmp" {
}

resource "ctfd_flag" "icmp_flag" {
challenge_id = ctfd_challenge.icmp.id
challenge_id = ctfd_challenge_dynamic.icmp.id
content = "24HIUT{IcmpExfiltrationIsEasy}"
}

resource "ctfd_hint" "icmp_hint_1" {
challenge_id = ctfd_challenge.icmp.id
challenge_id = ctfd_challenge_dynamic.icmp.id
content = "Vous ne trouvez pas qu'il ya beaucoup de requêtes ICMP ?"
cost = 50
}

resource "ctfd_hint" "icmp_hint_2" {
challenge_id = ctfd_challenge.icmp.id
challenge_id = ctfd_challenge_dynamic.icmp.id
content = "Pour l'exo, le ttl a été modifié, tente un `ip.ttl<=20`"
cost = 50
requirements = [ctfd_hint.icmp_hint_2.id]
}

resource "ctfd_file" "icmp_file" {
challenge_id = ctfd_challenge.icmp.id
challenge_id = ctfd_challenge_dynamic.icmp.id
name = "icmp.pcap"
contentb64 = filebase64("${path.module}/icmp.pcap")
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "ctfd_challenge" "http" {
resource "ctfd_challenge_dynamic" "http" {
name = "My Challenge"
category = "misc"
description = "..."
Expand All @@ -18,25 +18,25 @@ resource "ctfd_challenge" "http" {
}

resource "ctfd_flag" "http_flag" {
challenge_id = ctfd_challenge.http.id
challenge_id = ctfd_challenge_dynamic.http.id
content = "CTF{some_flag}"
}

resource "ctfd_hint" "http_hint_1" {
challenge_id = ctfd_challenge.http.id
challenge_id = ctfd_challenge_dynamic.http.id
content = "Some super-helpful hint"
cost = 50
}

resource "ctfd_hint" "http_hint_2" {
challenge_id = ctfd_challenge.http.id
challenge_id = ctfd_challenge_dynamic.http.id
content = "Even more helpful hint !"
cost = 50
requirements = [ctfd_hint.http_hint_1.id]
}

resource "ctfd_file" "http_file" {
challenge_id = ctfd_challenge.http.id
challenge_id = ctfd_challenge_dynamic.http.id
name = "image.png"
contentb64 = filebase64(".../image.png")
}
38 changes: 38 additions & 0 deletions examples/resources/ctfd_challenge_standard/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
resource "ctfd_challenge_standard" "http" {
name = "My Challenge"
category = "misc"
description = "..."
value = 500

topics = [
"Misc"
]
tags = [
"misc",
"basic"
]
}

resource "ctfd_flag" "http_flag" {
challenge_id = ctfd_challenge_standard.http.id
content = "CTF{some_flag}"
}

resource "ctfd_hint" "http_hint_1" {
challenge_id = ctfd_challenge_standard.http.id
content = "Some super-helpful hint"
cost = 50
}

resource "ctfd_hint" "http_hint_2" {
challenge_id = ctfd_challenge_standard.http.id
content = "Even more helpful hint !"
cost = 50
requirements = [ctfd_hint.http_hint_1.id]
}

resource "ctfd_file" "http_file" {
challenge_id = ctfd_challenge_standard.http.id
name = "image.png"
contentb64 = filebase64(".../image.png")
}

0 comments on commit ae95ace

Please sign in to comment.