SVN: toys/rsget.pl: Get/BadongoCom Get/BitRoad Get/EasyShare Get/GigaSize Get/RapidShare Get/SendSpa...

sparky sparky at pld-linux.org
Tue Oct 27 12:36:05 CET 2009


Author: sparky
Date: Tue Oct 27 12:36:04 2009
New Revision: 10871

Modified:
   toys/rsget.pl/Get/BadongoCom
   toys/rsget.pl/Get/BitRoad
   toys/rsget.pl/Get/EasyShare
   toys/rsget.pl/Get/GigaSize
   toys/rsget.pl/Get/RapidShare
   toys/rsget.pl/Get/SendSpace
   toys/rsget.pl/Get/SharePlace
   toys/rsget.pl/Get/SharingMatrix
   toys/rsget.pl/Get/UploadingCom
   toys/rsget.pl/Get/zSHARE
   toys/rsget.pl/RSGet/Captcha.pm
   toys/rsget.pl/RSGet/Get.pm
   toys/rsget.pl/RSGet/Tools.pm
   toys/rsget.pl/RSGet/Wait.pm
Log:
- introduced irand - returns random integer in [$min, $max) interval


Modified: toys/rsget.pl/Get/BadongoCom
==============================================================================
--- toys/rsget.pl/Get/BadongoCom	(original)
+++ toys/rsget.pl/Get/BadongoCom	Tue Oct 27 12:36:04 2009
@@ -111,7 +111,7 @@
 	DOWNLOAD( $-{file_uri} );
 
 	MULTI() if m{<h3>FREE MEMBER WAITING PERIOD</h3>};
-	RESTART( -(60 + int rand 300), "free limit reached" )
+	RESTART( - irand( 60, 300 ), "free limit reached" )
 		if /You have exceeded your Download Quota/;
 
 

Modified: toys/rsget.pl/Get/BitRoad
==============================================================================
--- toys/rsget.pl/Get/BitRoad	(original)
+++ toys/rsget.pl/Get/BitRoad	Tue Oct 27 12:36:04 2009
@@ -19,7 +19,7 @@
 	m#<div class="content_text"><h1>(.*?)\s*\[ ($STDSIZE) \]</h1>#;
 	INFO( name => $1, asize => $2 );
 
-	RESTART( -(60 + int rand 300), "free limit reached" )
+	RESTART( - irand( 60, 300 ), "free limit reached" )
 		if /Downloading is in process from your IP-Address/;
 
 	$-{form} = $self->form( match => { action => qr{^/download3\.php$} } );

Modified: toys/rsget.pl/Get/EasyShare
==============================================================================
--- toys/rsget.pl/Get/EasyShare	(original)
+++ toys/rsget.pl/Get/EasyShare	Tue Oct 27 12:36:04 2009
@@ -22,7 +22,7 @@
 	! m{<p class="pt15 pb0 px18 txtgray family2 c">You are requesting\s+(.*?) \(($STDSIZE)\)</p>};
 	INFO( name => $1, asize => $2 );
 
-	RESTART( - ( 60 + int rand 300 ), "free limit reached" )
+	RESTART( - irand( 60, 300 ), "free limit reached" )
 		if m#You have downloaded over.*?during last hour#;
 
 	unless ( m#<script type="text/javascript">\s*u='(.*?)';\s*w='(\d+)';# ) {
@@ -37,7 +37,7 @@
 	GET( $-{uri}, keep_referer => 1 );
 stage_captcha:
 
-	RESTART( - ( 60 + int rand 300 ), "free limit reached" )
+	RESTART( - irand( 60, 300 ), "free limit reached" )
 		if m#You have downloaded over.*?during last hour#;
 
 	if ( m#<script type="text/javascript">\s*u='(.*?)';\s*w='(\d+)';# ) {

Modified: toys/rsget.pl/Get/GigaSize
==============================================================================
--- toys/rsget.pl/Get/GigaSize	(original)
+++ toys/rsget.pl/Get/GigaSize	Tue Oct 27 12:36:04 2009
@@ -40,7 +40,7 @@
 		CAPTCHA_RESULT( "FAIL" );
 		GOTO stage_captcha;
 	}
-	RESTART( -180 - int rand 360, "free limit reached, waiting time unknown" )
+	RESTART( - irand( 60, 300 ), "free limit reached, waiting time unknown" )
 		if /YOU HAVE REACHED YOUR FREE DOWNLOAD LIMIT/;
 
 	! $-{form} = $self->form( id => "formDownload" );

Modified: toys/rsget.pl/Get/RapidShare
==============================================================================
--- toys/rsget.pl/Get/RapidShare	(original)
+++ toys/rsget.pl/Get/RapidShare	Tue Oct 27 12:36:04 2009
@@ -43,8 +43,8 @@
 
 	! $-{form} = $self->form( name => "dlf" );
 	$-{form}->set( mirror => "on" );
-	$-{form}->set( x => int rand 108 );
-	$-{form}->set( y => int rand 108 );
+	$-{form}->set( x => irand 5, 103 );
+	$-{form}->set( y => irand 5, 103 );
 
 	! /var c=(\d+);/;
 	WAIT( $1, "starting download" );

Modified: toys/rsget.pl/Get/SendSpace
==============================================================================
--- toys/rsget.pl/Get/SendSpace	(original)
+++ toys/rsget.pl/Get/SendSpace	Tue Oct 27 12:36:04 2009
@@ -30,7 +30,7 @@
 
 	CLICK_DOWNLOAD( $file_uri );
 
-	RESTART( -(60 + int rand 300), "servers overloaded" )
+	RESTART( - irand( 60, 300 ), "servers overloaded" )
 		if /Sorry, the free service is at full capacity/;
 	RESTART( 0, "empty page" ) unless /\S/;
 	MULTI() if /You cannot download more than one file at a time/;

Modified: toys/rsget.pl/Get/SharePlace
==============================================================================
--- toys/rsget.pl/Get/SharePlace	(original)
+++ toys/rsget.pl/Get/SharePlace	Tue Oct 27 12:36:04 2009
@@ -24,7 +24,7 @@
 	! m#<b>Filename: </b>(.*)<b><br>\s*File size: </b>($STDSIZE)<b><br>#s;
 	INFO( name => $1, asize => $2 );
 
-	RESTART( - ( 60 + int rand 300 ), "limit reached" )
+	RESTART( - irand( 60, 300 ), "limit reached" )
 		if /You have got max allowed download sessions from the same IP/;
 
 	! m#var cgcsccccsccrctcc = unescape\(\s*([a-zA-Z0-9_]+?)\s*\);#;

Modified: toys/rsget.pl/Get/SharingMatrix
==============================================================================
--- toys/rsget.pl/Get/SharingMatrix	(original)
+++ toys/rsget.pl/Get/SharingMatrix	Tue Oct 27 12:36:04 2009
@@ -47,7 +47,7 @@
 	$-{img_base} = $1;
 
 stage_captcha:
-	$-{img} = $-{img_base} . (int rand 1000) . 1;
+	$-{img} = $-{img_base} . (irand 1000) . 1;
 	GET( $-{img}, keep_referer => 1 );
 
 	CAPTCHA(

Modified: toys/rsget.pl/Get/UploadingCom
==============================================================================
--- toys/rsget.pl/Get/UploadingCom	(original)
+++ toys/rsget.pl/Get/UploadingCom	Tue Oct 27 12:36:04 2009
@@ -18,7 +18,7 @@
 start:
 	GET( $-{_uri} );
 
-	RESTART( 60 + int rand 180, "temporarily unavailable" )
+	RESTART( irand( 60, 300 ), "temporarily unavailable" )
 		if m{<h1>Service Not Available</h1>};
 	ERROR( "file not found" ) if /Requested file not found/;
 

Modified: toys/rsget.pl/Get/zSHARE
==============================================================================
--- toys/rsget.pl/Get/zSHARE	(original)
+++ toys/rsget.pl/Get/zSHARE	Tue Oct 27 12:36:04 2009
@@ -23,8 +23,8 @@
 	INFO( name => $name, asize => $1 );
 
 	! my $form = $self->form( name => "form1" );
-	$form->set( "imageField.x" => 10 + int rand 180 );
-	$form->set( "imageField.y" => 10 + int rand 37 );
+	$form->set( "imageField.x" => irand 10, 190 );
+	$form->set( "imageField.y" => irand 10, 37 );
 	$form->set( "imageField" => "" );
 
 	CLICK( $form->post() );

Modified: toys/rsget.pl/RSGet/Captcha.pm
==============================================================================
--- toys/rsget.pl/RSGet/Captcha.pm	(original)
+++ toys/rsget.pl/RSGet/Captcha.pm	Tue Oct 27 12:36:04 2009
@@ -129,7 +129,7 @@
 
 	$self->linedata( wait => "delay" );
 	$self->{captcha_response} = $captcha;
-	my $wait = 5 + int rand 10;
+	my $wait = irand 5, 15;
 	unless ( defined $captcha ) {
 		$wait /= 4;
 		$self->captcha_result( undef );

Modified: toys/rsget.pl/RSGet/Get.pm
==============================================================================
--- toys/rsget.pl/RSGet/Get.pm	(original)
+++ toys/rsget.pl/RSGet/Get.pm	Tue Oct 27 12:36:04 2009
@@ -179,7 +179,7 @@
 	my $self = shift;
 	my @opts = @_;
 	$self->{_click_opts} = \@opts;
-	return $self->wait( \&click_start_get, 3 + int rand 10,
+	return $self->wait( \&click_start_get, irand( 2, 10 ),
 		"clicking link", "delay" );
 }
 
@@ -226,7 +226,7 @@
 	my $self = shift;
 	my @opts = @_;
 	$self->{_click_opts} = \@opts;
-	return $self->wait( \&click_start_download, 3 + int rand 10,
+	return $self->wait( \&click_start_download, irand( 2, 10 ),
 		"clicking download link", "delay" );
 }
 

Modified: toys/rsget.pl/RSGet/Tools.pm
==============================================================================
--- toys/rsget.pl/RSGet/Tools.pm	(original)
+++ toys/rsget.pl/RSGet/Tools.pm	Tue Oct 27 12:36:04 2009
@@ -9,10 +9,13 @@
 use warnings;
 use vars qw(@ISA @EXPORT @EXPORT_OK);
 
+sub set_rev($);
+set_rev qq$Id$;
+
 require Exporter;
 @ISA = qw(Exporter);
 @EXPORT = qw(set_rev s2string bignum de_ml hadd hprint p isotime require_prog
-	jstime def_settings setting verbose
+	irand jstime def_settings setting verbose
 	data_file dump_to_file randomize %getters);
 @EXPORT_OK = qw();
 
@@ -27,7 +30,6 @@
 	$pm =~ s/\.pm$//;
 	$revisions{ $pm } = 0 | $rev;
 }
-set_rev qq$Id$;
 
 sub s2string($)
 {
@@ -89,6 +91,13 @@
 	return sort { 0.5 <=> rand } @_;
 }
 
+sub irand($;$)
+{
+	my $arg = shift;
+	return int rand $arg unless @_;
+
+	return int ( $arg + rand ( (shift) - $arg ) );
+}
 
 sub isotime()
 {
@@ -98,7 +107,7 @@
 
 sub jstime()
 {
-	return time * 1000 + int rand 1000;
+	return time * 1000 + irand 1000;
 }
 
 sub de_ml

Modified: toys/rsget.pl/RSGet/Wait.pm
==============================================================================
--- toys/rsget.pl/RSGet/Wait.pm	(original)
+++ toys/rsget.pl/RSGet/Wait.pm	Tue Oct 27 12:36:04 2009
@@ -24,7 +24,7 @@
 	my $time = time;
 	delete $self->{wait_until_should};
 
-	my $rnd_wait = int rand ( 5 * 60 ) + 2 * 60;
+	my $rnd_wait = irand 120, 300;
 	if ( $wait > $rnd_wait + 1 * 60 ) {
 		$self->{wait_until_should} = $time + $wait;
 		$wait = $rnd_wait;


More information about the pld-cvs-commit mailing list