crossfire/agent-deployment/crossfire-agent.rkt

48 lines
1.8 KiB
Racket

#lang racket/base
;; crossfire: distributed brute force infrastructure
;;
;; Copyright (C) 2020 haskal
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
(require racket/fasl racket/file racket/match racket/port racket/string
"../crossfire/static-support.rkt"
"../crossfire/not-crypto.rkt" "../crossfire/comms.rkt")
; (crypto-sign-public-key #"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
;
; (define key (crypto-lock-make-key))
; (define nonce (crypto-lock-make-nonce))
; (define pt #"hello world")
;
; (define-values [ct mac] (crypto-lock key nonce pt))
;
; (displayln (crypto-unlock key nonce mac ct))
; (displayln (crypto-unlock key nonce mac (bytes-append ct #"abcd")))
(define (get-config.linux-gnu)
(call-with-input-file "/proc/self/exe"
(lambda (in)
(file-position in eof)
(define len (file-position in))
(file-position in (- len 4))
(define offset (integer-bytes->integer (port->bytes in) #f #t))
(file-position in (- len offset))
(fasl->s-exp in))))
(match (string-split (static-ffi-arch) "-")
[(list _ ... "linux" "gnu") (get-config.linux-gnu)]
[arch (error "XXX: don't know how to get config on arch" arch)])