Fossil SCM

Simplified interaction on the honeypot. Humans can prove themselves with just two simple clicks when the auto-captcha setting is enabled.

drh 2024-07-27 17:28 trunk
Commit 0e675ad32cb71c6b5dfeae97f41c08b61d16c1674bff5b9478a26b7a266302c0
2 files changed +1 -1 +34 -9
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1916,11 +1916,11 @@
19161916
blob_appendf(&url, "%c%t", cSep, p->zName);
19171917
}
19181918
cSep = '&';
19191919
}
19201920
}
1921
- return blob_str(&url);
1921
+ return blob_str(&url);
19221922
}
19231923
19241924
/*
19251925
** Tag query parameter zName so that it is not exported by
19261926
** cgi_query_parameters_to_hidden(). Or if zName==0, then
19271927
--- src/cgi.c
+++ src/cgi.c
@@ -1916,11 +1916,11 @@
1916 blob_appendf(&url, "%c%t", cSep, p->zName);
1917 }
1918 cSep = '&';
1919 }
1920 }
1921 return blob_str(&url);
1922 }
1923
1924 /*
1925 ** Tag query parameter zName so that it is not exported by
1926 ** cgi_query_parameters_to_hidden(). Or if zName==0, then
1927
--- src/cgi.c
+++ src/cgi.c
@@ -1916,11 +1916,11 @@
1916 blob_appendf(&url, "%c%t", cSep, p->zName);
1917 }
1918 cSep = '&';
1919 }
1920 }
1921 return blob_str(&url);
1922 }
1923
1924 /*
1925 ** Tag query parameter zName so that it is not exported by
1926 ** cgi_query_parameters_to_hidden(). Or if zName==0, then
1927
+34 -9
--- src/style.c
+++ src/style.c
@@ -1372,22 +1372,47 @@
13721372
/*
13731373
** WEBPAGE: honeypot
13741374
** This page is a honeypot for spiders and bots.
13751375
*/
13761376
void honeypot_page(void){
1377
+ unsigned int uSeed = captcha_seed();
1378
+ const char *zDecoded = captcha_decode(uSeed);
1379
+ int bAutoCaptcha = db_get_boolean("auto-captcha", 0);
1380
+ char *zCaptcha = captcha_render(zDecoded);
13771381
style_header("I think you are a robot");
13781382
@ <p>You seem like a robot.</p>
13791383
@
1380
- @ <p>Is this wrong? Are you really a human? If so, please prove it
1381
- @ by <a href="%R/login">logging in</a>.
1382
- if( g.anon.Hyperlink ){
1383
- @ You can <a href="%R/login?anon=1">log in anonymously</a> if you
1384
- @ prefer.
1385
- }
1386
- @ <p>Sorry for the inconvenience. The point of this is to prevent
1387
- @ robots from following the countless of hyperlinks in this site and
1388
- @ soaking up all the available CPU time and network bandwidth.
1384
+ @ <p>Is that incorrect? Are you really human?
1385
+ @ If so, please prove it by transcribing the captcha text
1386
+ @ into the entry box below and pressing "Submit".
1387
+ @ <form action="%R/login" method="post">
1388
+ @ <input type="hidden" id="u" name="u" value="anonymous">
1389
+ @ <p>
1390
+ @ Captcha: <input type="text" id="p" name="p" value="">
1391
+ @ <input type="submit" name="in" value="Submit">
1392
+ @
1393
+ @ <p>Alternatively, you can <a href="%R/login">log in</a> using an
1394
+ @ existing userid.
1395
+ @
1396
+ @ <p><input type="hidden" name="cs" value="%u(uSeed)">
1397
+ @ <div class="captcha"><table class="captcha"><tr><td>\
1398
+ @ <pre class="captcha">
1399
+ @ %h(zCaptcha)
1400
+ @ </pre></td></tr></table>
1401
+ if( bAutoCaptcha ) {
1402
+ @ <input type="button" value="Fill out captcha" id='autofillButton' \
1403
+ @ data-af='%s(zDecoded)'>
1404
+ builtin_request_js("login.js");
1405
+ }
1406
+ @ </div>
1407
+ free(zCaptcha);
1408
+ @
1409
+ @ <p>We regret this inconvenience. However, robots have become so
1410
+ @ prolific and so aggressive that they will soak up too much CPU time
1411
+ @ and network bandwidth on our servers if allowed to run unchecked.
1412
+ @ Your cooperation in demonstrating that you are human is
1413
+ @ appreciated.
13891414
style_finish_page();
13901415
}
13911416
13921417
/*
13931418
** Webpages that encounter an error due to missing or incorrect
13941419
--- src/style.c
+++ src/style.c
@@ -1372,22 +1372,47 @@
1372 /*
1373 ** WEBPAGE: honeypot
1374 ** This page is a honeypot for spiders and bots.
1375 */
1376 void honeypot_page(void){
 
 
 
 
1377 style_header("I think you are a robot");
1378 @ <p>You seem like a robot.</p>
1379 @
1380 @ <p>Is this wrong? Are you really a human? If so, please prove it
1381 @ by <a href="%R/login">logging in</a>.
1382 if( g.anon.Hyperlink ){
1383 @ You can <a href="%R/login?anon=1">log in anonymously</a> if you
1384 @ prefer.
1385 }
1386 @ <p>Sorry for the inconvenience. The point of this is to prevent
1387 @ robots from following the countless of hyperlinks in this site and
1388 @ soaking up all the available CPU time and network bandwidth.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1389 style_finish_page();
1390 }
1391
1392 /*
1393 ** Webpages that encounter an error due to missing or incorrect
1394
--- src/style.c
+++ src/style.c
@@ -1372,22 +1372,47 @@
1372 /*
1373 ** WEBPAGE: honeypot
1374 ** This page is a honeypot for spiders and bots.
1375 */
1376 void honeypot_page(void){
1377 unsigned int uSeed = captcha_seed();
1378 const char *zDecoded = captcha_decode(uSeed);
1379 int bAutoCaptcha = db_get_boolean("auto-captcha", 0);
1380 char *zCaptcha = captcha_render(zDecoded);
1381 style_header("I think you are a robot");
1382 @ <p>You seem like a robot.</p>
1383 @
1384 @ <p>Is that incorrect? Are you really human?
1385 @ If so, please prove it by transcribing the captcha text
1386 @ into the entry box below and pressing "Submit".
1387 @ <form action="%R/login" method="post">
1388 @ <input type="hidden" id="u" name="u" value="anonymous">
1389 @ <p>
1390 @ Captcha: <input type="text" id="p" name="p" value="">
1391 @ <input type="submit" name="in" value="Submit">
1392 @
1393 @ <p>Alternatively, you can <a href="%R/login">log in</a> using an
1394 @ existing userid.
1395 @
1396 @ <p><input type="hidden" name="cs" value="%u(uSeed)">
1397 @ <div class="captcha"><table class="captcha"><tr><td>\
1398 @ <pre class="captcha">
1399 @ %h(zCaptcha)
1400 @ </pre></td></tr></table>
1401 if( bAutoCaptcha ) {
1402 @ <input type="button" value="Fill out captcha" id='autofillButton' \
1403 @ data-af='%s(zDecoded)'>
1404 builtin_request_js("login.js");
1405 }
1406 @ </div>
1407 free(zCaptcha);
1408 @
1409 @ <p>We regret this inconvenience. However, robots have become so
1410 @ prolific and so aggressive that they will soak up too much CPU time
1411 @ and network bandwidth on our servers if allowed to run unchecked.
1412 @ Your cooperation in demonstrating that you are human is
1413 @ appreciated.
1414 style_finish_page();
1415 }
1416
1417 /*
1418 ** Webpages that encounter an error due to missing or incorrect
1419

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button