mirror of
https://github.com/hak5/nano-tetra-modules.git
synced 2025-10-29 16:58:09 +00:00
Add modules to repository
This commit is contained in:
59
Papers/includes/scripts/genSSHKeys.sh
Executable file
59
Papers/includes/scripts/genSSHKeys.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Author: sud0nick
|
||||
# Date: Jan 2016
|
||||
|
||||
help() {
|
||||
echo "Usage: ./genSSHKeys.sh <opts>";
|
||||
echo '';
|
||||
echo 'Required Parameters:';
|
||||
echo -e '\t-k,--keyName:\tName of exported key files';
|
||||
echo '';
|
||||
echo 'Optional Parameters:';
|
||||
echo '';
|
||||
echo -e '\t-b,--bitSize:\tBitsize of keys (Default: 2048)';
|
||||
echo -e '\t-p,--pass:\tPassword for private key';
|
||||
echo -e '\t-c,--comment:\tInclude a comment in the public key (Default: root@Pineapple)';
|
||||
echo '';
|
||||
}
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
help;
|
||||
exit;
|
||||
fi
|
||||
|
||||
# Defaults
|
||||
BITSIZE=2048;
|
||||
PASSWORD='';
|
||||
SSH_STORE="/pineapple/modules/Papers/includes/ssh/";
|
||||
COMMENT='root@Pineapple';
|
||||
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
|
||||
if [[ "$1" == "-k" || "$1" == "--keyName" ]]; then
|
||||
KEYNAME="$2";
|
||||
fi
|
||||
|
||||
if [[ "$1" == "-b" || "$1" == "--bitSize" ]]; then
|
||||
BITSIZE="$2";
|
||||
fi
|
||||
|
||||
if [[ "$1" == "-p" || "$1" == "--pass" ]]; then
|
||||
PASSWORD="$2";
|
||||
fi
|
||||
|
||||
if [[ "$1" == "-c" || "$1" == "--comment" ]]; then
|
||||
COMMENT="$2"
|
||||
fi
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ -z $KEYNAME ]]; then
|
||||
help;
|
||||
exit;
|
||||
fi
|
||||
|
||||
ssh-keygen -q -b $BITSIZE -t rsa -N "$PASSWORD" -f $SSH_STORE$KEYNAME.pem -C $COMMENT
|
||||
mv $SSH_STORE$KEYNAME.pem.pub $SSH_STORE$KEYNAME.pub
|
||||
Reference in New Issue
Block a user