halihalo,
habe gerade dieses script bekommen. aber auf meinem websrv (apache2.2.8/win32)
macht es mir probleme. ich denke es liegt wohl daran dass das modul template.pm
(perl/5.10.0) fehlt, denn in der error.conf steht:
[Fri Apr 18 11:56:21 2008] [error] [client 127.0.0.1] Premature end of script headers: enc.pl
[Fri Apr 18 11:56:21 2008] [error] [client 127.0.0.1] Can't locate HTML/Template.pm in @INC (@INC contains: C:/Programme/perl/site/lib C:/Programme/perl/lib .) at E:\\fsr\\htdocs\\enc.pl line 5.
[Fri Apr 18 11:56:21 2008] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at E:\\fsr\\htdocs\\enc.pl line 5.
habe so denk ich schon eine lösung welche hier zu finden ist. allerdings
funktioniert das installieren bei mir nicht wie beschrieben (kann auch
daran liegen dass mein ansatz total falsch ist).
dann ist da noch der andere fehler (Premature end...), dass liegt wohl ehr
am script oder?
hier also der code (ich hoffe ich verstoße damit nicht gegen das copyright,
sollte jemand das script weiterverwenden wollen bitte autor fragen!):
#!C:/Programme/perl
use strict;
use CGI;
use HTML::Template;
use Crypt::CBC;
my $supported = { des => "DES",
blowfish => "Blowfish",
twofish => "Twofish",
rijndael => "Rijndael",
gost => "GOST",
tea => "TEA",
null => "NULL",
idea => "IDEA",
};
### cgi preps
my $q = CGI->new();
my $type = "encrypt" if $q->param("encrypt");
$type = "decrypt" if $q->param("decrypt");
### collect data and construct cipher
my ($key, $text, $method, $cipher, $select);
foreach (sort keys %$supported) {
$select .= "<option value=\"" . $_ . "\"";
$select .= " selected" if $_ eq $q->param("method");
$select .= ">" . $supported->{$_} . "\n";
}
if ($type) {
$key = $q->param("key");
$method = $supported->{$q->param("method")} || "";
$text = $q->param("text");
if ($method && $key) {
$cipher = new Crypt::CBC($key,$method);
}
}
### template preps
my $tmpl = get_tmpl();
my $template = HTML::Template->new(scalarref => \$tmpl);
############################################################
if ($type eq "encrypt" && $cipher && $text) {
############################################################
$template->param(
cgi => $ENV{SCRIPT_NAME},
key => $key,
method => $select,
text => $cipher->encrypt_hex($text),
);
############################################################
} elsif ($type eq "decrypt" && $cipher && $text) {
############################################################
$template->param(
cgi => $ENV{SCRIPT_NAME},
key => $key,
method => $select,
text => $cipher->decrypt_hex($text),
);
############################################################
} else {
############################################################
$template->param(
cgi => $ENV{SCRIPT_NAME},
method => $select,
message => "", #$key . " - " . $method,
);
############################################################
}
############################################################
print $q->header();
print $template->output;
# sub land
############################################################
sub get_tmpl {
############################################################
return <<'EOT';
<html>
<head>
<title>Verschlüsselungsdemo</title>
<style type="text/css">
<!--
body {
background-color: #ffffff;
}
a:link, a:visited {
font-family: Verdana, Helvetica, Arial, sans-serif;
color: #333366;
font-weight: 100;
text-decoration: none;
}
a:active {
font-family: Verdana, Helvetica, Arial, sans-serif;
color: #333399;
font-weight: 700;
text-decoration: none;
}
a:hover {
font-family: Verdana, Helvetica, Arial, sans-serif;
color: #333366;
font-weight: 100;
text-decoration: underline;
}
h2 {
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 22px;
font-weight: 700;
text-decoration: none;
}
p,li {
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 12px;
text-decoration: none;
}
input {
overflow: hidden;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 12px;
vertical-align: middle;
}
input.i300 {
width: 300px;
height: 21px;
}
textarea {
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 12px;
overflow: auto;
width: 300px;
}
-->
</style>
</head>
<body onLoad='window.resizeTo(450,600);'>
<h2>Verschlüsselungsdemo</h2>
<p><TMPL_VAR NAME=message></p>
<form action="<TMPL_VAR NAME=cgi>" method="post">
<table border="0" width="400">
<tr>
<td colspan="2">
<p>In dieser kleinen Demonstration können Sie einen symmetrischen Verschlüsselungsalgorithmus auswählen und dann durch Eingabe eines Schlüssels einen beliebigen Text verschlüsseln. Der verschlüsselte Text ist hexadezimal kodiert.</p>
<p> </p>
</td>
</tr>
<tr>
<td><p>Cipher:</p></td>
<td><p>
<select rows="1" name="method">
<TMPL_VAR NAME=method>
</select></p>
</td>
</tr>
<tr>
<td><p>Schlüssel:</p></td>
<td><p><input class="i300" type="text" size="60" maxlength="500" name="key" value="<TMPL_VAR NAME=key>"></p></td>
</tr>
<tr>
<td valign="top"><p>Text:</p></td>
<td><p>
<textarea cols="60" rows="10" name="text" wrap="soft"><TMPL_VAR ESCAPE=HTML NAME=text></textarea></p></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="encrypt" value="verschlüsseln"> <input type="submit" name="decrypt" value="entschlüsseln"></td>
</tr>
<tr>
<td colspan="2">
<p> </p>
<p>© 2001 - <a target="_top" href="http://www.zeitform.de">zeitform Internet Dienste</a>. Quelltext auf <a href="mailto:zeitform@zeitform.de">Anfrage</a>.</p>
</td>
</tr>
</table>
</form>
</body>
</html>
EOT
}
ich bin in sachen perl absoluter neuling wenn was ich schrieb schwachsinn
ist dann weist mich bitte darauf hin.
cucu
zoidby