Find flag

This commit is contained in:
xenia 2020-04-10 23:17:20 -04:00
parent 4baeabb263
commit e1af5acd3f
1 changed files with 21 additions and 0 deletions

View File

@ -1,8 +1,12 @@
#!/usr/bin/env racket
#lang racket
; vim: ft=racket
(require xml)
(require smol-http)
;; scheme is bad and it should feel bad
(define member? member)
(define DEFAULT-HDRS '((user-agent . "🦈 hash-lang-uwu crawler v1.0")
;; christo pls do not track thanks
(dnt . "1")))
@ -28,6 +32,23 @@
(define (cookie-jar->header jar)
(call-with-semaphore (cj-sema jar) (curry unbox (cj-cache jar))))
(define test-data
(xml->xexpr
(document-element
(read-xml (open-input-string
"<doc><bold>hi<h2 class='secret_flag' style='color:red'>FLAG: 64-characters-of-random-alphanumerics</h2></bold> there!</doc>")))))
(define (find-flag xexpr)
(match xexpr
[(list _ (? (curry member? '(class "secret_flag"))) str)
str]
[(list tag params rst ...)
(ormap find-flag rst)]
[_ #f]))
(find-flag test-data)
(define debug-mode? (make-parameter #f))
(define current-cookie-jar (make-parameter (make-cookie-jar)))