Random Bits of Open Code

Check-in [67253f99d7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added primitive obfuscation mechanism for text based scripting languages (e.g. perl).
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:67253f99d71b26dcb18520c81b7fa2a5a4436678
User & Date: mrwellan 2018-06-07 20:41:32
Context
2018-06-15
22:20
Added the old finasim code (renamed to finsim) check-in: 11f16e41ff user: mrwellan tags: trunk
2018-06-07
20:41
Added primitive obfuscation mechanism for text based scripting languages (e.g. perl). check-in: 67253f99d7 user: mrwellan tags: trunk
2018-05-22
05:53
Removed dependency on sql-de-lite in mtcommon. Switched mtdb to sqlite3 from sql-de-lite as it seems to work better. check-in: 36337aa670 user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added trivial-perl-encryption/Makefile.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
all : epl epl-enc

epl : epl.scm pw.scm
	csc -optimize-level 0 epl.scm
	strip epl

epl-enc : epl-enc.scm pw.scm
	csc epl-enc.scm
	strip epl-enc

Added trivial-perl-encryption/epl-enc.scm.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14

(use posix rabbit)

(include "pw.scm")

(let* ((indat     (read-lines))
       (indat-str (string-intersperse indat "\n"))
       (key       (string->blob *pw*))
       (data      (string->blob indat-str))
       (ctx       (rabbit-make key)))
  ;; (print (blob->string (rabbit-decode! ctx (rabbit-encode! ctx data))))
  (display (blob->string (rabbit-encode! ctx data))))


Added trivial-perl-encryption/epl.scm.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

;; (use aes)

(use rabbit posix)
(define *myname* (car (argv)))
(include "pw.scm")

(define *encdat* (conc (pathname-directory *myname*) "/." (pathname-file *myname*) ".dat"))
(if (file-exists? *encdat*)
    (let* ((key  (string->blob *pw*))
	   (datain (with-input-from-file *encdat* read-string))
	   (data   (string->blob datain))
	   (ctx (rabbit-make key)))
     (with-output-to-pipe
        "/usr/bin/perl"
        (lambda ()
	  (print (blob->string
		  (rabbit-decode! ctx data)))
	  )))
    (print "ERROR: " *encdat* " not found."))

Added trivial-perl-encryption/pw.scm.



























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
(define p1 '("B" "n" "d" "a"))
(define p2 '("o" "e" "e" "d"))

(define *pw* (let loop ((a  (car p1))
			(t1 (cdr p1))
			(b  (car p2))
			(t2 (cdr p2))
			(r  ""))
	       (if (null? t1)
		   r
		   (loop (car t1)(cdr t1)(car t2)(cdr t2)(conc r a b)))))

	       

Added trivial-perl-encryption/test.pl.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
#



print "Hello world!";

print "\n\n\n";

foreach $a (1,2,3,4,5,6) {
    print "Hello number $a\n";
}