> For the complete documentation index, see [llms.txt](https://kos0ng.gitbook.io/ctfs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kos0ng.gitbook.io/ctfs/write-up/2024/justctf/misc.md).

# Misc

<table><thead><tr><th width="347">Challenge</th><th>Link</th></tr></thead><tbody><tr><td>leaving soon (406 pts)</td><td><a href="#leaving-soon-406-pts">Here</a></td></tr></tbody></table>

## leaving soon (406 pts)

### Description

My friend wanted to rewatch this cool miniseries on Catflix but it looks like they removed it. Can you help him recover all episodes from the network capture?

### Solution

My solver during the competition.

```python
import glob
import re
import requests
import os

def get_key(pssh):
	burp0_url = "https://cdrm-project.com:443/"
	burp0_headers = {"Sec-Ch-Ua": "\"Not-A.Brand\";v=\"99\", \"Chromium\";v=\"124\"", "Sec-Ch-Ua-Platform": "\"macOS\"", "Sec-Ch-Ua-Mobile": "?0", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.118 Safari/537.36", "Content-Type": "application/json", "Accept": "*/*", "Origin": "https://cdrm-project.com", "Sec-Fetch-Site": "same-origin", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Dest": "empty", "Referer": "https://cdrm-project.com/", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "en-US,en;q=0.9", "Priority": "u=1, i", "Connection": "close"}
	burp0_json={"Cookies": "", "Data": "", "Headers": "", "JSON": "", "License URL": "https://proxy.uat.widevine.com/proxy", "Proxy": "", "PSSH": pssh}
	resp = requests.post(burp0_url, headers=burp0_headers, json=burp0_json)
	return resp.json()["Message"]

def split_key(data):
	key = []
	for i in data.split("\n"):
		key.append(i.split(":")[-1])
	return key


fmt = "ffmpeg -decryption_key {} -i {} -codec copy {}"
for i in glob.glob("mpd/*"):
	fn = i
	print(fn)
	tmp_fn = fn.split("/")[-1].split(".")[0]
	fn_video = f"video/{tmp_fn}_video.mp4"
	f = open(fn, "r").read()
	found = re.findall(r"<cenc:pssh>(.*?)</cenc:pssh>", f)[0]
	resp = get_key(found)
	list_key = split_key(resp)
	for j in list_key:
		fn_dec = f"dec/{tmp_fn}_video_{j}.mp4"
		# print(fn_dec)
		tmp_command = fmt.format(j, fn_video, fn_dec)
		os.system(tmp_command)
```

For detailed writeup, take a look on SKSD official writeup.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kos0ng.gitbook.io/ctfs/write-up/2024/justctf/misc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
