fixed .egg file and install issue

This commit is contained in:
Ariela Wenner 2019-12-31 10:55:40 -03:00
parent b43035a5b4
commit 65dde9ce05
6 changed files with 111 additions and 118 deletions

View File

@ -1,5 +1,5 @@
# eliana
Random key generator useful for brute-force attacks.
Random key generator for brute-force attacks.
# Building
Requires Chicken 5 and the r7rs egg. Clone and run `chicken-install`.

View File

@ -1,4 +1,4 @@
(module argparse
(module eliana-argparse
(export get-switch-value
value-next?
argument-present?)

53
eliana-module.scm Normal file
View File

@ -0,0 +1,53 @@
(module eliana-module
(export eliana-initialize!
make-key-container
change-key!
print-key)
(import scheme
(chicken base)
(chicken random)
(chicken time)
r7rs)
(define (get-random-char data-set)
(string-ref data-set
(pseudo-random-integer (string-length data-set))))
(define-syntax for
(syntax-rules (in)
((for elem in alist body ...)
(for-each (lambda (elem) body ...) alist))))
(define-syntax range
(syntax-rules (from to)
((range from n to m)
(let loop ((ret '())
(i n))
(cond ((> i m) (reverse ret))
(else (loop (cons i ret)
(add1 i))))))))
(define (change-entire-key! key-container data-set)
(for n in (range from 0 to (sub1 (string-length key-container)))
(string-set! key-container n (get-random-char data-set))))
(define (change-key-character-at-a-time! key-container data-set)
(string-set! key-container
(pseudo-random-integer (string-length key-container))
(get-random-char data-set)))
(define (change-key! key-container data-set #!optional change-entire-key?)
(if change-entire-key?
(change-entire-key! key-container data-set)
(change-key-character-at-a-time! key-container data-set)))
(define (print-key key-container)
(display key-container)
(newline))
(define (make-key-container key-length)
(make-string key-length #\0))
(define (eliana-initialize!)
(set-pseudo-random-seed! (number->string (current-seconds)))))

View File

@ -1,19 +1,12 @@
((author "Ariela Wenner")
(synopsis "Random-key generator useful for brute-force attacks.")
(synopsis "Random-key generator for brute-force attacks.")
(license "GPLv3")
(cond-expand
(chicken-5.0 (error "eliana requires CHICKEN 5 or newer"))
(else))
(category tools)
(dependencies r7rs)
(components (extension eliana-argparse
(source "argparse.scm")
(modules argparse))
(components (extension eliana-argparse)
(extension eliana-module
(source "eliana.scm")
(modules eliana)
(component-dependencies eliana-argparse))
(program eliana
(source "main.scm")
(component-dependencies eliana-argparse
eliana-module)))
(version 0.5))

View File

@ -1,53 +1,60 @@
(module eliana
(export eliana-initialize!
make-key-container
change-key!
print-key)
(import (prefix eliana-module eli:)
(prefix eliana-argparse argp:))
(import scheme
(chicken base)
(chicken random)
(chicken time)
r7rs)
(define DEFAULT-DATA-SET
"abcdefghijkmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ1234567890")
(define (get-random-char data-set)
(string-ref data-set
(pseudo-random-integer (string-length data-set))))
(define DEFAULT-KEY-LENGTH "20")
(define-syntax for
(syntax-rules (in)
((for elem in alist body ...)
(for-each (lambda (elem) body ...) alist))))
(define (println . things)
(for-each display things)
(newline))
(define-syntax range
(syntax-rules (from to)
((range from n to m)
(let loop ((ret '())
(i n))
(cond ((> i m) (reverse ret))
(else (loop (cons i ret)
(add1 i))))))))
(define (print-help-message)
(for-each println
'("Usage: eliana [options...]"
""
"`eliana' is a random key generator useful for force-brute attacks that"
"accept a dictionary from standard input."
""
"-l <key length> set the length of the generated keys"
"-d <data set> set the characters to build the keys out of"
"-w change the whole key every iteration, instead of a character at a time (less efficient)"
""
"example (equivalent to default behavior):"
"$ eliana -l 20 -d abcdefghijkmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ1234567890"
"..."
"Z8P4VQ4h2pXpa8ZyiAsd"
"Z8P4VQ4h2pXpu8ZyiAsd"
"Z8P4cQ4h2pXpu8ZyiAsd"
"Z8P4cQ4k2pXpu8ZyiAsd"
"Z8P4cQ4k2kXpu8ZyiAsd"
"Z8P4cQ4k2k1pu8ZyiAsd"
"Z8P4cQ4k2k1pE8ZyiAsd"
"Z8P4cQ4k2k3pE8ZyiAsd"
"Z8P4cQ4k2k3pE8qyiAsd"
"Z8P4ck4k2k3pE8qyiAsd"
"Z8P4ck4k2k3pE8qyaAsd"
"Z8P4ck4k2k3pE8qy8Asd"
"...")))
(define (change-entire-key! key-container data-set)
(for n in (range from 0 to (sub1 (string-length key-container)))
(string-set! key-container n (get-random-char data-set))))
(define (get-argument-value-or-default option default)
(if (argp:argument-present? option)
(argp:get-switch-value option)
default))
(define (change-key-character-at-a-time! key-container data-set)
(string-set! key-container
(pseudo-random-integer (string-length key-container))
(get-random-char data-set)))
(define (main)
(when (argp:argument-present? "-h")
(print-help-message)
(exit))
(let* ((data-set (get-argument-value-or-default "-d" DEFAULT-DATA-SET))
(key-length (string->number (get-argument-value-or-default "-l" DEFAULT-KEY-LENGTH)))
(change-entire-key? (if (argp:argument-present? "-w") #t #f))
(key-container (eli:make-key-container key-length)))
(eli:eliana-initialize!)
(let loop ()
(eli:change-key! key-container data-set change-entire-key?)
(eli:print-key key-container)
(loop))))
(define (change-key! key-container data-set #!optional change-entire-key?)
(if change-entire-key?
(change-entire-key! key-container data-set)
(change-key-character-at-a-time! key-container data-set)))
(define (print-key key-container)
(display key-container)
(newline))
(define (make-key-container key-length)
(make-string key-length #\0))
(define (eliana-initialize!)
(set-pseudo-random-seed! (number->string (current-seconds)))))
(main)

View File

@ -1,60 +0,0 @@
(import (prefix eliana eli:)
(prefix argparse argp:))
(define DEFAULT-DATA-SET
"abcdefghijkmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ1234567890")
(define DEFAULT-KEY-LENGTH "20")
(define (println . things)
(for-each display things)
(newline))
(define (print-help-message)
(for-each println
'("Usage: eliana [options...]"
""
"`eliana' is a random key generator useful for force-brute attacks that"
"accept a dictionary from standard input."
""
"-l <key length> set the length of the generated keys"
"-d <data set> set the characters to build the keys out of"
"-w change the whole key every iteration, instead of a character at a time (less efficient)"
""
"example (equivalent to default behavior):"
"$ eliana -l 20 -d abcdefghijkmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ1234567890"
"..."
"Z8P4VQ4h2pXpa8ZyiAsd"
"Z8P4VQ4h2pXpu8ZyiAsd"
"Z8P4cQ4h2pXpu8ZyiAsd"
"Z8P4cQ4k2pXpu8ZyiAsd"
"Z8P4cQ4k2kXpu8ZyiAsd"
"Z8P4cQ4k2k1pu8ZyiAsd"
"Z8P4cQ4k2k1pE8ZyiAsd"
"Z8P4cQ4k2k3pE8ZyiAsd"
"Z8P4cQ4k2k3pE8qyiAsd"
"Z8P4ck4k2k3pE8qyiAsd"
"Z8P4ck4k2k3pE8qyaAsd"
"Z8P4ck4k2k3pE8qy8Asd"
"...")))
(define (get-argument-value-or-default option default)
(if (argp:argument-present? option)
(argp:get-switch-value option)
default))
(define (main)
(when (argp:argument-present? "-h")
(print-help-message)
(exit))
(let* ((data-set (get-argument-value-or-default "-d" DEFAULT-DATA-SET))
(key-length (string->number (get-argument-value-or-default "-l" DEFAULT-KEY-LENGTH)))
(change-entire-key? (if (argp:argument-present? "-w") #t #f))
(key-container (eli:make-key-container key-length)))
(eli:eliana-initialize!)
(let loop ()
(eli:change-key! key-container data-set change-entire-key?)
(eli:print-key key-container)
(loop))))
(main)