Skip to content

Commit 979bb17

Browse files
author
Duke B
committed
add integrity
1 parent 018c357 commit 979bb17

1 file changed

Lines changed: 53 additions & 14 deletions

File tree

‎index.html‎

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -863,10 +863,12 @@
863863
subh "all $1"
864864
echo "$2"
865865

866-
subh "filtered $1"
867-
echo "$2" | grep -v "$3"
866+
if [[ -n "$3" ]]; then
867+
echo
868+
subh "filtered $1"
869+
echo "$2" | grep -v "$3"
870+
fi
868871

869-
echo
870872
get_key
871873
}
872874

@@ -877,40 +879,77 @@
877879

878880
stty -echo -icanon min 1 time 0
879881
trap $(stty sane) EXIT
880-
#hostname="$(hostname)"
882+
if [[ -z $1 ]]; then
883+
hostname="$(hostname)"
884+
else
885+
hostname="$1"
886+
fi
881887
services="${hostname}Services"
882888
pkgs="${hostname}Pkgs"
889+
if [[ "$hostname" == 'bigbang' || "$hostname" == 'chernobyl' ]]; then
890+
os='redhat'
891+
elif [[ "$hostname" == 'dinoasteroid' || "$hostname" == 'enlightenment' || "$hostname" == 'vikingraids' ]]; then
892+
os='debian'
893+
else
894+
os='INVALID'
895+
fi
883896
finished=false
884897

885898
while [[ $finished == false ]]; do
886-
select_option 'services' 'users' 'packages' 'clone' 'exit'
899+
select_option 'services' 'users' 'packages' 'integrity' 'clone' 'test' 'exit'
887900
clear
888901
case "$selection" in
889902
'services')
890-
if [[ "$hostname" == 'bigbang' || "$hostname" == 'chernobyl' || "$hostname" == 'dinoasteroid' || "$hostname" == 'enlightenment' || "$hostname" == 'vikingraids' ]]; then
891-
display 'services' "$(systemctl list-units --type=service --state=running --no-pager --quiet | cut -d " " -f 3)" "${!services}"
892-
else
893-
error
894-
fi
903+
display 'services' "$(systemctl list-units --type=service --state=running --no-pager --quiet | cut -d " " -f 3)" "${!services}"
895904
;;
896905
'users')
897-
display 'users' "$(sudo passwd -S -a | awk '$2!="L" {print $1}')" "$users"
906+
display 'users' "$(sudo cat /etc/shadow | grep -v '!' | cut -d ':' -f 1)" "$users"
898907
;;
899908
'packages')
900-
if [[ "$hostname" == 'bigbang' || "$hostname" == 'chernobyl' ]]; then
909+
if [[ "$os" == 'redhat' ]]; then
901910
display 'packages' "$(dnf repoquery --userinstalled | cut -d ':' -f 1 | sed 's/..$//')" "${!pkgs}"
902-
elif [[ "$hostname" == 'dinoasteroid' || "$hostname" == 'enlightenment' || "$hostname" == 'vikingraids' ]]; then
911+
elif [[ "$os" == 'debian' ]]; then
903912
display 'packages' "$(apt-mark showmanual)" "${!pkgs}"
904913
else
905914
error
906915
fi
907916
;;
917+
'integrity')
918+
if [[ "$os" == 'redhat' ]]; then
919+
rpm -Va
920+
elif [[ "$os" == 'debian' ]]; then
921+
debsums
922+
923+
if [[ "$?" != 0 ]]; then
924+
echo 'debsums not found! Please install it before continuing'
925+
fi
926+
fi
927+
get_key
928+
;;
908929
'clone')
909930
header 'cloning..'
910931
git clone https://github.com/pix-code/pix-code.github.io
911-
echo -e '\ndone!\n'
932+
echo -e '\ndone!'
912933
get_key
913934
;;
935+
'test')
936+
header 'diagnostic info'
937+
echo "detected os: $os"
938+
echo "detected hostname: $hostname"
939+
echo
940+
echo 'press m for more'
941+
if [[ "$(get_key)" == 'm' ]]; then
942+
subh 'user filter'
943+
echo "$users"
944+
echo
945+
subh 'service filter'
946+
echo "${!services}"
947+
echo
948+
subh 'pkg filter'
949+
echo "${!pkgs}"
950+
get_key
951+
fi
952+
;;
914953
'exit')
915954
header 'HACK THE PLANET'
916955
finished=true

0 commit comments

Comments
 (0)