dovecotpwコマンドを実行してハッシュ値を取得するWebアプリケーションを作成します。
<html>
<head>
</head>
<body>
<?php
$btn=$_POST['button_submit'];
if ($btn != ""){
$mail=$_POST['textbox_mail'];
$password=$_POST['textbox_password'];
$result=shell_exec("/usr/sbin/dovecotpw -u $mail -p $password");
}
?>
<form method="post" action="">
<div>Exec dovecotpw</div>
Mail Address <input type="text" name="textbox_mail" /><br/>
Password <input type="text" name="textbox_password" /><br/>
<input type="submit" name="button_submit" value="Exec" /><br/>
</form>
<div>Output</div>
Mail Address <input type="text" size="50" onfocus="this.select();"
value="<?php echo($mail); ?>" ></textbox><br/>
Password <input type="text" size="50" onfocus="this.select();"
value="<?php echo($password); ?>" ></textbox><br/>
Hash <input type="text" size="120" onfocus="this.select();"
value="<?php echo($result); ?>" ></textbox><br/>
<div> </div>
<div><a href="index.php">Back</a><div>
</body>
</html>
実行結果
フォームにユーザー名とパスワードを入力してExecボタンをクリックすると、ハッシュ値が表示されます。
著者
iPentecのプログラマー、最近はAIの積極的な活用にも取り組み中。
とっても恥ずかしがり。
最終更新日: 2024-01-06
作成日: 2011-05-29