4 ms·
Spoiler alert - don't read more of this comment if you want to solve it yourself. Almost all of the solution in Haskell (except for the bit about extracting th
by A1kmm 16y ago
Spoiler alert - don't read more of this comment if you want to solve it yourself.
Almost all of the solution in Haskell (except for the bit about extracting the actual answer from the Javascript); it's probably not what they intended, since the job is for a web-dev, but most of us here are probably just doing it for fun. I found the bit about guessing what string was hashed to make the MD5 the hardest, because it was basically just pure brute force (I didn't know what timezone it was in or what date format was used - so the hint wasn't very helpful).
import Network.URI
import Network.HTTP
import Data.Maybe
import Data.Time.Clock.POSIX
import Data.Time.LocalTime.TimeZone.Olson
import Data.Time.LocalTime.TimeZone.Series
import Data.Time.Clock
import Data.Time.LocalTime
import Data.Time.Calendar
import Text.Printf
import Control.Monad
import Codec.Binary.Base64.String
main = do
-- Is there a more portable way to do this?
pdtTZS <- getTimeZoneSeriesFromOlsonFile "/usr/share/zoneinfo/America/Los_Angeles"
pdtTime <- liftM (utcToLocalTime' pdtTZS) getCurrentTime
let next = printf "w%02d%02d" ((\(_, _, d) -> d) . toGregorian . localDay $ pdtTime) (todHour $ localTimeOfDay pdtTime)
ts <- getPOSIXTime
let str = urlEncodeVars [("pos", "solvepuzzle"),
("auth", show ts),
("msg", "SYN/ACK"),
("next", next)]
r <- simpleHTTP (Request (fromJust $ parseURI "http://www.weebly.com/weebly/publicBackend.php")
POST
[Header HdrContentLength (show $ length str),
Header (HdrCustom "X-Requested-With") "XMLHttpRequest",
Header (HdrCustom "X-Prototype-Version") "1.7_rc1",
Header HdrContentType "application/x-www-form-urlencoded"]
str
)
case r
of
Left err -> print err
Right b -> do
putStrLn (decode . rspBody $ b)
- quadhome 16y agoDidn't notice the pattern on "next." I presumed it was based on the time but after cracking it I moved on. Nice. :-)
- bluesmoon 16y agoyou could just search Yahoo! for the md5 sum and it gives you the answer on the search results page. Also, it's easier to just do the whole thing in firebug by rewriting the javascript on the page. The only thing I couldn't figure out was, what do you do when you get to 42?
- ithkuil 16y agobesides that 42 would be all you need to know about everything, searching yahoo only works for well known hashes, it won't work for an arbitrary hash like this.