This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathssk_init.sh
87 lines (65 loc) · 2.25 KB
/
ssk_init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
### Begin define variables ###
home=$(sh -c "echo ~$(whoami)") # Great idea to safely define home by Ben Hoskings, author of "babushka" https://github.com/benhoskings/babushka
ostype=$(uname -s) # Checks OS type
from="https://github.com/phoenixweiss/sskit/archive/master.tar.gz" # Source
to="$home/.sskit" # Destination
### End define variables ###
# TODO gather full information about release
# lsb_release -i # ID
# lsb_release -r # Version release
# lsb_release -c # Codename
### Begin define functions ###
logo() {
cat <<"LOGO"
███████╗███████╗██╗ ██╗██╗████████╗
██╔════╝██╔════╝██║ ██╔╝██║╚══██╔══╝
███████╗███████╗█████╔╝ ██║ ██║
╚════██║╚════██║██╔═██╗ ██║ ██║
███████║███████║██║ ██╗██║ ██║
╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
by Paul Phönixweiß aka phoenixweiss
LOGO
}
currtime() {
date "+%d.%m.%Y %H:%M:%S" # Shows current time in "dd.mm.YYYY HH:MM:SS" format
}
say() {
printf "\e[1m$1\e[0m\n\n" # Pre-format script messages
}
important() {
echo -e "\e[7m $1 \e[27m" # Show importance of some info such as passwords
}
warn() {
echo -e "\e[31m$1\e[39m" # Text for warnings
}
hr() {
say "- - - - - - - - - - - - - - -"
sleep 1.5s
}
any() {
type "$1" >/dev/null 2>&1 # Check availibility of something
}
pass_gen() {
echo "$(date +%s | md5sum | base64 | head -c $1)" # Generates N-character-based random password
}
oscodename() {
echo "$(lsb_release -c)" | sed 's/.*:\t//' # Extracts release codename
}
ramsizemb() {
echo "$(grep MemTotal /proc/meminfo)" | sed -n 's/.*:\s *//gp' | sed 's/\s.*//' | bc <<< "$(xargs echo) / 1024"
}
canonize() {
echo "$1" | sed 's/[^a-zA-Z0-9]//g' # Canonization for any string
}
rootonly() {
if [ $EUID -ne 0 ]; then
say "The script $0 must run under $(important root) privileges!"
say "$(currtime)"
exit 1 # Exit with error
fi
}
got_ssk() {
true # Check SSKit availible in current session
}
### End define functions ###