Advertisement
Guest User

zerochan antiwipe script 2

a guest
Nov 20th, 2011
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use 5.010;
  3. use strict;
  4. use Time::HiRes qw(gettimeofday);
  5.  
  6. #die "Usage: $0 thread [board]"
  7. #unless @ARGV;
  8.  
  9. my $thread = "9033412";
  10. my $board = "b";
  11. my $delay = 5;
  12. my $n = 20;
  13. my $pages = 5;
  14. my $cur_status_bin = 0;
  15. my $cur_status = 0;
  16. my @text = ("Status: "," Warning!!! ","#","[New post]. "," High congestion! "," Very high congestion! ");
  17. ######
  18. my $wipe_detect = 5;
  19. my $wipe_time_detect_high = 0.6;
  20. my $wipe_time_detect_very_high = 0.7;
  21. ######
  22. my $count = 0;
  23. my @nx=(65,72);
  24. my @delta_time;
  25. my $time_temp;
  26. print @text[0];
  27. while (1)
  28. {
  29. $time_temp = gettimeofday;
  30. my $_ = `curl -G "http://www.0chan.ru/b/catalog.html"`;
  31. $time_temp = gettimeofday - $time_temp;
  32. push @delta_time, $time_temp;
  33. if ($time_temp >= $wipe_time_detect_high) {
  34. print "@text[4]\n";
  35. } else {
  36. if ($time_temp >= $wipe_time_detect_very_high) {
  37. print "@text[5]\n";
  38. $cur_status_bin = 1;
  39. }
  40. }
  41. unless (/$thread/)
  42. {
  43. print "THREAD DIED!!!!!11T_T\n";
  44. exit;
  45. }
  46. my $link = 0;
  47. while (++$link < $n*$pages)
  48. {
  49. m!(href="/$board/res/\d+\.html">)!g;
  50. last if $1 =~ /$thread/;
  51. }
  52. if (($link >= $n)or((($link - $cur_status) >= $wipe_detect)and($count != 0)and($cur_status >= 3)))
  53. {
  54. my $thread_url = "http://www.0chan.ru/$board/res/$thread.html";
  55. print "BUMP THREAD NOW!!!11\n";
  56. system("mplayer.exe alert.wav");
  57. print "\n",@text[0],@text[2]x@nx[0],@text[1],@text[2]x@nx[1],"\n",@text[0];
  58. $cur_status_bin = 1;
  59. }
  60. sleep($delay);
  61. $count++;
  62. if ($link > $cur_status) {
  63. $cur_status = $link;
  64. print "[$cur_status].";
  65. } else {
  66. if ($cur_status - $link > 1) {
  67. $cur_status_bin = 1;
  68. print @text[3];
  69. }
  70. }
  71. if ($cur_status_bin == 1) {
  72. $cur_status = 0;
  73. $cur_status_bin = 0;
  74. }
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement