summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2007-10-21 04:55:19 +0000
committererdgeist <>2007-10-21 04:55:19 +0000
commit0de8b53fdde212b291cdd406c59a80d1814f8184 (patch)
tree17189685e95a9e0d15b89347fe666951e027c151
parent6b2307015fb25caf0322b534135f64ba3d7c8136 (diff)
Now the Holzhammer: GET /an is announce, GET /sc is scrape. Period.
-rw-r--r--opentracker.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/opentracker.c b/opentracker.c
index a4c6304..8378824 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -248,6 +248,8 @@ static void httpresponse( const int64 s, char *data, size_t l ) {
248 * S Y N C * 248 * S Y N C *
249 ******************************/ 249 ******************************/
250 case 4: /* sync ? */ 250 case 4: /* sync ? */
251 if( !byte_diff( data, 2, "an" ) ) goto ANNOUNCE_WORKAROUND;
252 if( !byte_diff( data, 2, "sc" ) ) goto SCRAPE_WORKAROUND;
251 if( byte_diff( data, 4, "sync") ) HTTPERROR_404; 253 if( byte_diff( data, 4, "sync") ) HTTPERROR_404;
252 if( NOTBLESSED( h ) ) HTTPERROR_403_IP; 254 if( NOTBLESSED( h ) ) HTTPERROR_403_IP;
253 255
@@ -288,6 +290,8 @@ LOG_TO_STDERR( "sync: %d.%d.%d.%d\n", h->ip[0], h->ip[1], h->ip[2], h->ip[3] );
288 * S T A T S * 290 * S T A T S *
289 ******************************/ 291 ******************************/
290 case 5: /* stats ? */ 292 case 5: /* stats ? */
293 if( !byte_diff( data, 2, "an" ) ) goto ANNOUNCE_WORKAROUND;
294 if( !byte_diff( data, 2, "sc" ) ) goto SCRAPE_WORKAROUND;
291 if( byte_diff(data,5,"stats")) HTTPERROR_404; 295 if( byte_diff(data,5,"stats")) HTTPERROR_404;
292 scanon = 1; 296 scanon = 1;
293 mode = STATS_MRTG; 297 mode = STATS_MRTG;
@@ -376,6 +380,7 @@ LOG_TO_STDERR( "stats: %d.%d.%d.%d - mode: s24s old\n", h->ip[0], h->ip[1], h->i
376 * S C R A P E * 380 * S C R A P E *
377 ******************************/ 381 ******************************/
378 case 6: /* scrape ? */ 382 case 6: /* scrape ? */
383 if( !byte_diff( data, 2, "an" ) ) goto ANNOUNCE_WORKAROUND;
379 if( byte_diff( data, 6, "scrape") ) HTTPERROR_404; 384 if( byte_diff( data, 6, "scrape") ) HTTPERROR_404;
380 385
381 /* Full scrape... you might want to limit that */ 386 /* Full scrape... you might want to limit that */
@@ -429,12 +434,8 @@ SCRAPE_WORKAROUND:
429/****************************** 434/******************************
430 * A N N O U N C E * 435 * A N N O U N C E *
431 ******************************/ 436 ******************************/
432 case 7:
433 if( !byte_diff( data, 7, "announc" ) ) goto ANNOUNCE_WORKAROUND;
434 if( !byte_diff( data, 7, "anounce" ) ) goto ANNOUNCE_WORKAROUND;
435 if( !byte_diff( data, 7, "annouce" ) ) goto ANNOUNCE_WORKAROUND;
436 HTTPERROR_404;
437 case 8: 437 case 8:
438 if( !byte_diff( data, 2, "sc" ) ) goto SCRAPE_WORKAROUND;
438 if( byte_diff( data, 8, "announce" ) ) HTTPERROR_404; 439 if( byte_diff( data, 8, "announce" ) ) HTTPERROR_404;
439 440
440ANNOUNCE_WORKAROUND: 441ANNOUNCE_WORKAROUND:
@@ -531,13 +532,9 @@ ANNOUNCE_WORKAROUND:
531 } 532 }
532 ot_overall_tcp_successfulannounces++; 533 ot_overall_tcp_successfulannounces++;
533 break; 534 break;
534 case 9:
535 if( !byte_diff( data, 8, "announce" ) ) goto ANNOUNCE_WORKAROUND;
536 HTTPERROR_404;
537 case 10:
538 if( byte_diff( data, 10, "scrape.php" ) ) HTTPERROR_404;
539 goto SCRAPE_WORKAROUND;
540 case 11: 535 case 11:
536 if( !byte_diff( data, 2, "an" ) ) goto ANNOUNCE_WORKAROUND;
537 if( !byte_diff( data, 2, "sc" ) ) goto SCRAPE_WORKAROUND;
541 if( byte_diff( data, 11, "mrtg_scrape" ) ) HTTPERROR_404; 538 if( byte_diff( data, 11, "mrtg_scrape" ) ) HTTPERROR_404;
542 539
543 t = time( NULL ) - ot_start_time; 540 t = time( NULL ) - ot_start_time;
@@ -545,10 +542,9 @@ ANNOUNCE_WORKAROUND:
545 "%llu\n%llu\n%i seconds (%i hours)\nopentracker - Pretuned by german engineers, currently handling %llu connections per second.", 542 "%llu\n%llu\n%i seconds (%i hours)\nopentracker - Pretuned by german engineers, currently handling %llu connections per second.",
546 ot_overall_tcp_connections+ot_overall_udp_connections, ot_overall_tcp_successfulannounces+ot_overall_udp_successfulannounces, (int)t, (int)(t / 3600), (ot_overall_tcp_connections+ot_overall_udp_connections) / ( (unsigned int)t ? (unsigned int)t : 1 ) ); 543 ot_overall_tcp_connections+ot_overall_udp_connections, ot_overall_tcp_successfulannounces+ot_overall_udp_successfulannounces, (int)t, (int)(t / 3600), (ot_overall_tcp_connections+ot_overall_udp_connections) / ( (unsigned int)t ? (unsigned int)t : 1 ) );
547 break; 544 break;
548 case 12: 545 default:
549 if( byte_diff( data, 12, "announce.php" ) ) HTTPERROR_404; 546 if( !byte_diff( data, 2, "an" ) ) goto ANNOUNCE_WORKAROUND;
550 goto ANNOUNCE_WORKAROUND; 547 if( !byte_diff( data, 2, "sc" ) ) goto SCRAPE_WORKAROUND;
551 default: /* neither *scrape nor announce */
552 HTTPERROR_404; 548 HTTPERROR_404;
553 } 549 }
554 550