Skip to content

Commit

Permalink
fix byoc_commit cost calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ShyftXero committed Sep 23, 2023
1 parent 4e86975 commit 262dd6e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
17 changes: 16 additions & 1 deletion byoctf_discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,23 @@ def renderChallenge(result: dict, preview=False):

avg_flag_val = sum([f["flag_value"] for f in result["flags"]])/len(result["flags"])

break_even_solves = result["cost"] / avg_flag_val
flag_vals = [f["flag_value"] for f in result["flags"]]
num_flags = len(flag_vals)
flag_vals.sort()

least_middle_most = flag_vals[num_flags//2 - 1]


# break_even_solves = result["cost"] / avg_flag_val

# In [28]: vals = [100, 225, 250, 350, 400, 475, 600]

# In [29]: vals.sort();vals[len(vals)//2 - 1]
# Out[29]: 250

# This is the minimum number of solves of a obtainable flag to recoup cost.
break_even_solves = result["cost"] / least_middle_most


# break_even_solves = result['cost'] / (avg_flag_val * byoc_rate)

Expand Down
15 changes: 15 additions & 0 deletions example_challenges/xss_in_desc_test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
author = "shyft_xero"
challenge_title = "xss in desc test"
uuid = "b42881f8-284d-47aa-9a7e-e2fde4c25d7f"
challenge_description = "<script> alert(document.cookie)</script>"
tags = [ "hack",]
depends_on = []
[[flags]]
flag_title = "123"
flag_value = 123
flag_flag = "FLAG{xss_me_daddy}"

[[hints]]
hint_cost = 1
hint_text = "<script> alert(document.cookie)</script>"

0 comments on commit 262dd6e

Please sign in to comment.