foreach $confline (@domconf) { chomp($confline); my $resend2 = "no"; my $waitforok2 = "yes"; while ($waitforok2 eq "yes") { my $checkhash2 = GenerateMD5("confline: $confline"); if (defined($resend2) && $resend2 eq "yes") { print "$verify - Rebuilding Encryption Table: "; $cipher = new Crypt::CBC("$verify", 'Blowfish_PP'); } my $response2 = $cipher->encrypt("confline: $confline"); print $client "$checkhash2 $response2\n"; ($waitforok2, $resend2) = FinishUp2($client); } } #### UNF: while ($waitforit eq "yes") { $cipher = new Crypt::CBC("$cipherkey", 'Blowfish_PP'); $ciphertext = $cipher->encrypt("$msg"); $hash = GenerateMD5("$msg"); print $client "$hash $ciphertext\n"; my ($argh) =0; while (<$client>) { my ($line) = $_; chomp($line); $argh++; if ($line =~ /Resend/) { next UNF; $resend = "yes";} $inhash = substr($line, 0, 32); $encrypted = substr($line, 33, length($_)-33); $plaintext = $cipher->decrypt($encrypted); $checkhash = GenerateMD5($plaintext); if ($inhash eq $checkhash) { if ($plaintext =~ /!!beginresponse/) { print $client "OK\n"; @data=(); next; } if ($plaintext =~ /!!endresponse/) { print $client "Finished\n"; print "Number: $argh\n"; return @data; } if ($plaintext =~ /confline:\s+(.*)/) { print $client "OK\n"; push(@data, $1); } } else { $plaintext = ""; $inhash=""; $encrypted=""; $checkhash=""; print $client "Resend\n"; } } }