Live data from Hacker News

Stripe-CTF 3 Writeup

muehe.org

1–10 of 74 posts

Re: Stripe-CTF 3 Writeup

#2
I got stuck on Level 3, partially because Scala is a little wacky (but I learned to appreciate it!) and partially because their specs were super terrible. They didn't mention it required substring matching or was case-sensitive until I'd been working on it for 2-3 days and then was out of time. Given the bad debug output (the head of a diff which often didn't show anything and didn't include what term the failure was for) it was really frustrating to make any progress.

And he's right about the servers and scoring; that, too, was frustrating. I'd pass a test case locally then push and have it fail because it was slower for no apparent reason. Overall, it was awesome up until Level 3. I wish I'd made it to 4 because that strikes me as an actual distributed systems problem rather than a minor tweak to an existing example like the others.

It wasn't a bad experience and the system they have to manage it all is cool. I just wish a little more care had gone into making that level a bit smoother.

Re: Stripe-CTF 3 Writeup

#4

I got stuck on Level 3, partially because Scala is a little wacky (but I learned to appreciate it!) and partially because their specs were super terrible. They didn't mention it required substring matching or was case-sensitive until I'd been working on it for 2-3 days and then was out of time. Given the bad debug output (the head of a diff which often didn't show anything and didn't include what term the failure was…

Yeah same here. I wish I had given up on Scala and used something more familiar to me. I kept having my index serialization randomly die and it wasn't very clear what was going on. It was great to get a taste of the language, though.

Re: Stripe-CTF 3 Writeup

#5
Great article, I am really eager to see the solutions in github. I guess there won't be many with c++ solutions.

I only found the challenge two days before the end. My goal with the challenge was not to get the best solution, but rather use it as an exercise to practice the different languages and finding intuitive solutions.

Level 0 as you wrote was really just a two line change.

Level 1 was fun, because I tried to work with the existing bash structure as far as possible and just replaced the hot loop with inline python (something new learned). I found it interesting that this way I could directly inject the variables into the python program without having to load them as env variables (see [1]).

In Level 2 I did too much work, I did not think simple enough. I assumed that the different test cases would differ a lot and that a static divider would not help. My assumption was that the histogram of requests per second across the different IPs would have a bimodal distribution[2], thus I used the excellent "fast-stats" library to get a histogram and ban clients based on that. The library even offers approximate histograms, so even if there would be thousands of requests it would still scale.

To solve Level 3 with the given code required to changes:

-(i) Partitioning the data across the three server. I only loaded a subset of the files based on the server id (which was conveniently already available in the search servers) and

-(ii) Loading the files in memory so that they don't have to be read from disk for every search term. This was enough to pass this level. The code was too long for the gist but I can put it on github if someone wants to take a look at it. No fancy index structure required. I just scanned The files linearly on each request.

Mastering Level 4 was not possible for me, I tried working with the go-raft library and got the integration with unix sockets working, but somehow the system got unstable after a while. Fixing this was really frustrating and in the end I gave up because I could not find the problem and time was running out.

I congratulate all ~200 persons which also passed this last level. This was much more difficult than the other ones!

[1] https://gist.github.com/mkaufmann/8716922 [2] http://en.wikipedia.org/wiki/Bimodal_distribution

Re: Stripe-CTF 3 Writeup

#6

I got stuck on Level 3, partially because Scala is a little wacky (but I learned to appreciate it!) and partially because their specs were super terrible. They didn't mention it required substring matching or was case-sensitive until I'd been working on it for 2-3 days and then was out of time. Given the bad debug output (the head of a diff which often didn't show anything and didn't include what term the failure was…

Yeah, I ran into the same issue on Level 3 (the comment about Github search in the first edition of the readme threw me off since Github search does not do substring search). The worst part was that I knew what needed to be done from the very beginning but the simplest things were kinda hard to do in Scala and playing around with the setup to test things out was pretty frustrating since you had to recompile every time and the recompilation took aeons.

(This is not meant to be a critique of Scala, while working on the level I kind of understood the appeal)

Re: Stripe-CTF 3 Writeup

#7

Great article, I am really eager to see the solutions in github. I guess there won't be many with c++ solutions. I only found the challenge two days before the end. My goal with the challenge was not to get the best solution, but rather use it as an exercise to practice the different languages and finding intuitive solutions. Level 0 as you wrote was really just a two line change. Level 1 was fun, because I tried to…

well to level3 I can tell you, I just used grep embedded in a nodejs server application :D

Everything boiled down to this: "cd " + data_path + "; grep -rno " + key + " | cut -d: -f1,2 | sort | uniq"

I read the result from stdout and transformed the result into json that was enough to make it. I did not want at that time to spend more time on that level ;)

Re: Stripe-CTF 3 Writeup

#9

Great article, I am really eager to see the solutions in github. I guess there won't be many with c++ solutions. I only found the challenge two days before the end. My goal with the challenge was not to get the best solution, but rather use it as an exercise to practice the different languages and finding intuitive solutions. Level 0 as you wrote was really just a two line change. Level 1 was fun, because I tried to…

well to level3 I can tell you, I just used grep embedded in a nodejs server application :D Everything boiled down to this: "cd " + data_path + "; grep -rno " + key + " | cut -d: -f1,2 | sort | uniq" I read the result from stdout and transformed the result into json that was enough to make it. I did not want at that time to spend more time on that level ;)

Damn ok, so I also missed that opportunity. Great find!

Re: Stripe-CTF 3 Writeup

#10
I got stuck on level3 over the weekend and then had to put it down due to life stuff. But it was still a ton of fun, and I learned a lot.

If anyone from Stripe is here, do you plan to post the original problem statements and repos for the problems anywhere public now that it's done? I'd love to get a look at level 4... :)

Post reply on HN