1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Merge with git+ssh://pasky/srv/git/elinks.git

This commit is contained in:
Jonas Fonseca 2005-12-31 02:48:57 +01:00 committed by Jonas Fonseca
commit b2295572fe

View File

@ -135,41 +135,42 @@ B<bugmenot> or B<bn>
{
($current_url) = $current_url =~ /^.*:\/\/(.*)/;
my $bugmenot = 'http://bugmenot.com/view.php?url=' . $current_url;
my $tempfile = $ENV{'HOME'} . '/.elinks/elinks';
my $matrix = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
for (0..int(rand(7) + 9))
{
$tempfile = $tempfile . substr($matrix, (length($matrix) - 1) - rand(length($matrix) + 1), 1);
}
my ($message, $login, $password);
system('elinks -no-home -source "' . $bugmenot . '" >' . $tempfile . ' 2>/dev/null');
open FILE, "<$tempfile" or return $bugmenot;
$message = <FILE>;
while (<FILE>)
{
next unless (m/^<dd>(.*)<br \/>(.*)<\/dd><\/dl>$/);
$login = $1;
$password = $2;
}
$login =~ s/(^\s*|\n|\s*$)//g if $login;
$password =~ s/(^\s*|\n|\s*$)//g if $password;
close FILE;
unlink $tempfile;
return $bugmenot unless $message =~ /[a-z]+/ and $message !~ /404/;
unless ($message =~ s/.*(No accounts found\.).*/${1}/)
{
if ($login and $password)
{
$message = "Login: " . $login . "\nPassword: " . $password;
}
else
{
$message = 'No accounts found';
}
}
system('elinks -remote "infoBox\(' . $message . ')" >/dev/null 2>&1 &');
return $current_url; #FIXME
# return;
#my $tempfile = $ENV{'HOME'} . '/.elinks/elinks';
#my $matrix = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
#for (0..int(rand(7) + 9))
#{
#$tempfile = $tempfile . substr($matrix, (length($matrix) - 1) - rand(length($matrix) + 1), 1);
#}
#my ($message, $login, $password);
#system('elinks -no-home -source "' . $bugmenot . '" >' . $tempfile . ' 2>/dev/null');
#open FILE, "<$tempfile" or return $bugmenot;
#$message = <FILE>;
#while (<FILE>)
#{
#next unless (m/^<dd>(.*)<br \/>(.*)<\/dd><\/dl>$/);
#$login = $1;
#$password = $2;
#}
#$login =~ s/(^\s*|\n|\s*$)//g if $login;
#$password =~ s/(^\s*|\n|\s*$)//g if $password;
#close FILE;
#unlink $tempfile;
#return $bugmenot unless $message =~ /[a-z]+/ and $message !~ /404/;
#unless ($message =~ s/.*(No accounts found\.).*/${1}/)
#{
#if ($login and $password)
#{
#$message = "Login: " . $login . "\nPassword: " . $password;
#}
#else
#{
#$message = 'No accounts found';
#}
#}
#system('elinks -remote "infoBox\(' . $message . ')" >/dev/null 2>&1 &');
#return $current_url; #FIXME
##return;
return $bugmenot . $current_url;
}