arnaucube
arnaucube/goCaptchaPublic Self-hosted repository
added remove of mongodb data after captcha response, fixed typo in js, updated readme
arnaucode arnaucode@gmail.com
Sun, 02 Sep 2018 13:20:38 +0200
commit

5d1a3493d7407fddca256afd815ce601e2b26d84

parent

9262080f5424fbfbef936b7f494dd0daa436a13c

4 files changed, 18 insertions(+), 4 deletions(-)

jump to
M README.md → 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 @@

## 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.
M serverRoutes.go → serverRoutes.go

@@ -136,6 +136,13 @@ check(err)

} } + // 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))
M web/goCaptcha.js → web/goCaptcha.js

@@ -31,7 +31,7 @@

function showCaptcha(captcha) { var html; html = ""; - html += "<h2>Select all " + captcha.question + "s</h2>"; + html += "<h2>Select all " + captcha.question + "</h2>"; for (k in captcha.imgs) { html += "<img id='" + k + "' onclick='selectCaptchaImg(this)' src='" + goCaptchaURL + "/image/" + captcha.imgs[k] + "' style='width:120px;cursor:pointer;' class='g_unselected' />"; }