SHARE
TWEET

Untitled

a guest Jul 10th, 2013 146 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (define cheatbot
  2.   '(lambda (x)
  3.      ;; Payload
  4.      (define sub
  5.        '(lambda (this)
  6.  
  7.           ;; give me my source code
  8.           (define quine-my-source
  9.             (quasiquote (lambda (x)
  10.                           (define sub (quote (unquote this)))
  11.                           (define ns (make-base-namespace))
  12.                           (namespace-set-variable-value! 'cn (current-namespace) #t ns)
  13.                           ((eval sub ns) sub))))
  14.  
  15.           ;; If eval is used on anything other than my code, return cooperatebot
  16.           (define (evil expr [ns cn])
  17.             (if (or (equal? expr this) (equal? expr quine-my-source))
  18.                 (eval expr ns)
  19.                 (lambda (...) 'C)))
  20.  
  21.           ;; Replace eval in the REPL namespace with my evil version
  22.           (namespace-set-variable-value! 'eval evil #t cn)
  23.          
  24.           'D))
  25.  
  26.      (define ns (make-base-namespace))
  27.      (namespace-set-variable-value! 'cn (current-namespace) #t ns)
  28.      ((eval sub ns) sub)))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top