CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
perl memory ?

 



flaq1991
Novice

Nov 3, 2013, 3:29 AM

Post #1 of 5 (1518 views)
perl memory ? Can't Post

perl have a memory ? or history? I noticed that when my skryp work for more than five minutes to significantly slows... or is it any way?


Laurent_R
Veteran / Moderator

Nov 3, 2013, 10:46 AM

Post #2 of 5 (1511 views)
Re: [flaq1991] perl memory ? [In reply to] Can't Post

It depends on what your script is doing.

Perl can run as fast after an hour as during the first 10 seconds, but if you are constantly loading things into memory, it might become slower and slower to retrieve the data.

I can't say more without seeing what your script is doing.


flaq1991
Novice

Nov 3, 2013, 11:46 PM

Post #3 of 5 (1500 views)
Re: [Laurent_R] perl memory ? [In reply to] Can't Post

this code search a correctly login in my test php script. Thanks for reply.


Code
#!/usr/bin/perl 

use LWP::UserAgent;

$ua = LWP::UserAgent->new;
$ua->agent("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)");
Start();


print "Wybierz plik : ";
$plik = <>;
open(FILE, $plik) or die("Nie moge otworzy&#263; pliku.\n");
my @lista = <FILE>;
close(FILE);
foreach $hasla (@lista)
{
$hasla =~ s/^\s+//;
$hasla =~ s/\s+$//;

unless($hasla =~ m/(.*?):(.*?)(\ |$)/g){next;}
my $uzytkownik = $1;
my $haslo = $2;

powtorz:
print "Login: $uzytkownik\nHaslo: $haslo\n\n";

$ua->default_headers->push_header('Referer' => 'http://127.0.0.1/test.php');
my $response = $ua->post( "http://127.0.0.1/test.php", {"account_login" => $uzytkownik, "password_login" => $haslo });
if ($response->is_success) {

if ($response->content =~ m/login failed/i) {
print "login not found\n\n";
}
else
{
print "login found\n\n";
open(FILE, ">>working.txt");
print FILE "$hasla\n";
close(FILE);
}
sub Start() {
system(cls);
print "\n\n"
}
}
}



Zhris
Enthusiast

Nov 4, 2013, 12:51 AM

Post #4 of 5 (1494 views)
Re: [flaq1991] perl memory ? [In reply to] Can't Post

I shouldn't really be helping because others have pointed out that this appears to be a script designed to brute force login to a website. But heres some pointers since you already have your code up and running...

1) You probably don't want to keep setting the referrer header per iteration.

2) Don't pull the entire file into an array. Read it line by line.

Chris


flaq1991
Novice

Nov 4, 2013, 12:29 PM

Post #5 of 5 (1474 views)
Re: [Zhris] perl memory ? [In reply to] Can't Post

the point is?

Code
 print "Login: $uzytkownik\nHaslo: $haslo\n\n";


Edit : now it works! thank you all for helping me :)


(This post was edited by flaq1991 on Nov 4, 2013, 2:18 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives