Emdee five for life - always too slow, is my script broken or is the challenge?

I have spent an entire day attempting emdeefiveforlife, and it is always too slow… however I noticed you’ll get a ‘too slow’ message even if you type any old garbage in, so my script may be incorrect.

I tried it with wget first, it was a bit all over the place, but I hoped the flag would be in wget2.txt:

#!/bin/bash

wget --keep-session-cookies --save-cookies cookies.txt http://emdeeIP:PORT/
mv index.html wget1.txt
cat wget1.txt | grep h1 > grep.txt
cut grep.txt -c 67-86 > input.txt
md5sum input.txt > output.txt
cut output.txt -d "i" -f 1 > cut.txt | sed 's/ //g' > cut.txt
md5=`cat cut.txt`
echo $md5
wget --load-cookies cookies.txt --post-data="hash=$md5" http://emdeeIP:PORT/
mv index.html wget2.txt

I thought I may need to tidy things up, so I opted for:

#!/bin/bash
 
wget --keep-session-cookies --save-cookies cookies.txt http://emdeeIP:PORT/
cat index.html | grep h1 | cut -c 67-86 > input.txt
md5sum input.txt | cut -d "i" -f 1 | sed 's/ //g' >  sed.txt
md5=`cat sed.txt`
wget --load-cookies cookies.txt --post-data="hash=$md5" http://emdeeIP:PORT/

Still ‘too slow’… So now I try curl?

#!/bin/bash

curl -s -c cookies.txt http://emdeeIP:PORT/ > html.txt
cat html.txt | grep h1 | cut -c 67-86 | md5sum | cut -c 1-32 > hash.txt
md5=`cat hash.txt`
curl -s -b cookies.txt http://emdeeIP:PORT/ -d "hash=$md5"

Still ‘too slow’. I notice that my md5 hash has a wc -m of 33, not 32. So I tidy that up a little bit with some echo -n’s.

#!/bin/bash

echo -n `curl -s -c cookies.txt http://emdeeIP:PORT/ | grep h1 | cut -c 67-86` | md5sum | cut -c 1-32 > hash.txt
md5=`echo -n hash.txt`
curl -s -b cookies.txt http://emdeeIP:PORT/ -d "hash=$md5"

STILL ‘too slow’! This is absolutely killing me. I noted that someone suggested doing this challenge through the VPN connection will slow it down enough to warrant being too slow, so I have also tried everything on my host with a direct connection and still no luck. When I break everything down I can’t see how it’s not working. Please help!

Are you sure? Read, think, think harder, maybe make some tests.

Thank you @xtal for your words of perseverance, I started again with a fresh outlook today and have cracked it. I broke it down into chunks and tested each chunk individually, every step of the way. I noticed that my logic was way off on some, and those pesky newline characters were everywhere. A note to other users who may be stuck - your code doesn’t need to be streamlined, add as many lines and comments as you like, just make sure it works.

1 Like