From 0d2d99ed1d641e405cf39b65fbbff5fbdff7e040 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:42:52 -0500 Subject: [PATCH] Generate random session tokens --- kaptchapelo.lisp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kaptchapelo.lisp b/kaptchapelo.lisp index 3a3fd9c..8e063fc 100644 --- a/kaptchapelo.lisp +++ b/kaptchapelo.lisp @@ -1,4 +1,4 @@ -;;; Copyright 2023, Jaidyn Ann + ;;; Copyright 2023, Jaidyn Ann ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU Affero General Public License @@ -19,6 +19,11 @@ (in-package #:kaptchapelo) +(defun random-string () + "Create a random string consisting of at least 19 characters: Random numbers." + (apply #'str:concat + (mapcar (lambda (a) (format nil "~A" a)) + (loop for i from 0 upto 19 collect (random 16))))) (defun byte-array-to-hex-string (simple-array) "Given an array of bytes (integers), return an equivalent string in hex." @@ -45,7 +50,7 @@ (list "md5" (byte-array-to-hex-string captcha-text-file) "url" captcha-image-uri ;; I don’t know what Kocaptcha’s token does! :P - "token" "This_isnt_actually_used_lol")))) + "token" (random-string))))) (defun new-captcha-response (captcha-dir)