diff --git a/README.md b/README.md index 7e42011..d4fb66d 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,21 @@ # goCaptcha -captcha server, with own datasets, to train own machine learning AI +captcha server, with own datasets ## 0 - Why? Captcha systems are useful to avoid bots posting data on databases. But modern captcha systems are from enterprises to train machine learning algorithms, and monetize results. When user answers a captcha, is training the AI from the enterprise. -This project, aims to be a self hosted captcha system, that trains own AI. +This project, aims to be a self hosted captcha system. A future plan is add a functionallity that trains own AI. To avoid feeding AI from companies. ## 1 - How to use? +### 1.0 - Requirements +- backend server with + - goCaptcha binary + - MongoDB +- frontend with the goCaptcha.js and goCaptcha.css inserted + + ### 1.1 - Frontend Insert this lines in the html file: ```html @@ -201,7 +208,7 @@ If the selection is correct, returns 'true', if the selection is not correct, re ## 4 - Security - If the captcha is resolved in less than 1 second, it's not valid. -- If the captcha is resolved in more than 1 minute, it's not valid. +- If the captcha is resolved in more than X seconds, it's not valid. - The images url, are UUIDs generated each time, in order to give different names for the images each time. - The ip of requested captcha and answered captcha petitions must be the same. - Each time a user fails answering the captcha, the server adds a counter to the IP and stores in to MongoDB. When the counter on that IP is greather than the value 'suspiciousIPCountLimit' defined in serverConfig.json, the IP is blocked for 'timeBan' seconds, also defined in serverConfig.json. diff --git a/goCaptcha b/goCaptcha index 677fab3..5ae9761 100755 Binary files a/goCaptcha and b/goCaptcha differ diff --git a/serverRoutes.go b/serverRoutes.go index f46475d..681ac63 100644 --- a/serverRoutes.go +++ b/serverRoutes.go @@ -136,6 +136,13 @@ func AnswerCaptcha(w http.ResponseWriter, r *http.Request) { } } + // delete the captchaSolution from MongoDB + captchaSolCollection.RemoveAll(bson.M{"id": captchaAnswer.CaptchaId}) + check(err) + // delete the fakepaths from MongoDB + imgFakePathCollection.RemoveAll(bson.M{"captchaid": captchaAnswer.CaptchaId}) + check(err) + jsonResp, err := json.Marshal(resp) check(err) fmt.Fprintln(w, string(jsonResp)) diff --git a/web/goCaptcha.js b/web/goCaptcha.js index ef8a643..ce84836 100644 --- a/web/goCaptcha.js +++ b/web/goCaptcha.js @@ -31,7 +31,7 @@ function getCaptcha() { function showCaptcha(captcha) { var html; html = ""; - html += "

Select all " + captcha.question + "s

"; + html += "

Select all " + captcha.question + "

"; for (k in captcha.imgs) { html += ""; }