Skip to content

Commit 7631cba

Browse files
committed
Added password generation script
1 parent 3f8005d commit 7631cba

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

cli/generate-passwd.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
echo 'WARNING: Password will be visible on the command line and will be stored in your history.' . PHP_EOL;
4+
echo 'Don\'t use this script if other people have access to your shell (history)!' . PHP_EOL . PHP_EOL;
5+
6+
echo 'Enter your password: ';
7+
8+
$password = trim(fgets(STDIN));
9+
10+
if (empty($password)) {
11+
echo 'ERROR: Password empty...';
12+
exit;
13+
}
14+
15+
echo password_hash($argv[0], PASSWORD_DEFAULT, ['cost' => 12]) . PHP_EOL;

0 commit comments

Comments
 (0)