1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

bugmenot.com changed their format. Back to the old method of handling it.

This commit is contained in:
Russ Rowan 2005-12-30 20:04:48 -05:00
parent 9a0bf83756
commit c3066a4076

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;
}