From e39a8f26d14b8f01362af9d16b450bf25271735b Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Mon, 14 Aug 2023 09:39:34 +0200 Subject: [PATCH] Scalenie katalogu tools - mdrr --- tools/0/001/immudex_crypt | 132 ----------------------- tools/0/001/morketsmerke | 50 --------- tools/0/001/padlock | 66 ------------ tools/0/001/ytplay | 120 --------------------- tools/0/003/create_media | 90 ---------------- tools/0/003/immudex_crypt | 132 ----------------------- tools/0/003/immudex_install | 140 ------------------------ tools/0/003/ytplay | 120 --------------------- tools/0/006/immudex_upgrade | 155 -------------------------- tools/0/006/motd2 | 49 --------- tools/0/006/ytplay | 135 ----------------------- tools/0/011/immudex_upgrade | 82 -------------- tools/0/011/library.sh | 49 --------- tools/0/011/motd2 | 49 --------- tools/0/012/immudex_upgrade | 82 -------------- tools/0/012/library.sh | 49 --------- tools/0/013/create_media | 90 ---------------- tools/0/013/immudex_crypt | 132 ----------------------- tools/0/013/immudex_install | 140 ------------------------ tools/0/013/immudex_upgrade | 82 -------------- tools/0/013/import_gpgkeys | 8 -- tools/0/013/library.sh | 49 --------- tools/0/013/morketsmerke | 70 ------------ tools/0/013/motd2 | 49 --------- tools/0/013/newsfeed | 108 ------------------- tools/0/013/notifier | 18 ---- tools/0/013/padlock | 71 ------------ tools/0/013/secured-firefox | 9 -- tools/0/013/ytplay | 135 ----------------------- tools/0/014/ytplay | 135 ----------------------- tools/0/016/library.sh | 49 --------- tools/0/017/run-thunderbird | 4 - tools/0/020/immudex_crypt | 144 ------------------------- tools/0/020/immudex_install | 143 ------------------------ tools/0/020/immudex_upgrade | 125 --------------------- tools/0/021/create_media | 94 ---------------- tools/0/021/immudex_install | 145 ------------------------- tools/0/021/meteo | 30 ------ tools/0/022/immudex_install | 146 ------------------------- tools/0/023/create_media | 94 ---------------- tools/0/023/immudex_branch | 7 -- tools/0/023/immudex_crypt | 144 ------------------------- tools/0/023/immudex_upgrade | 151 -------------------------- tools/0/023/import_gpgkeys | 8 -- tools/0/023/import_sshkeys | 12 --- tools/0/023/library.sh | 49 --------- tools/0/023/meteo | 30 ------ tools/0/023/morketsmerke | 70 ------------ tools/0/023/motd2 | 49 --------- tools/0/023/newsfeed | 108 ------------------- tools/0/023/notifier | 18 ---- tools/0/023/padlock | 71 ------------ tools/0/023/run-thunderbird | 4 - tools/0/023/secured-firefox | 9 -- tools/0/023/shoutcasts | 28 ----- tools/0/023/sync.sh | 39 ------- tools/0/023/ytplay | 135 ----------------------- tools/0/025/immudex_hostname | 25 ----- tools/0/025/meteo | 22 ---- tools/0/025/pl | 32 ------ tools/0/immudex_crypt | 131 ---------------------- tools/0/immudex_install | 135 ----------------------- tools/0/immudex_upgrade | 109 ------------------- tools/0/import_gpgkeys | 8 -- tools/0/import_sshkeys | 12 --- tools/0/motd | 21 ---- tools/0/motd2 | 49 --------- tools/0/newsfeed | 108 ------------------- tools/0/padlock | 66 ------------ tools/0/protected | 29 ----- tools/0/shoutcasts | 28 ----- tools/0/ytplay | 98 ----------------- tools/100/autostart-x4notes | 4 - tools/100/create_media | 94 ---------------- tools/100/immudex_crypt | 162 ---------------------------- tools/100/immudex_hostname | 25 ----- tools/100/immudex_install | 146 ------------------------- tools/100/immudex_upgrade | 151 -------------------------- tools/100/import_sshkeys | 12 --- tools/100/morketsmerke | 70 ------------ tools/100/motd2 | 49 --------- tools/100/newsfeed | 108 ------------------- tools/100/notifier | 18 ---- tools/100/pl | 52 --------- tools/100/secured-firefox | 9 -- tools/100/shoutcasts | 28 ----- tools/100/sync.sh | 39 ------- tools/100/ytplay | 135 ----------------------- tools/101/immudex_hostname | 41 ------- tools/101/pl | 57 ---------- tools/105/pl | 58 ---------- tools/{0/024 => }/autostart-x4notes | 0 tools/{106 => }/create_media | 0 tools/{108 => }/idle-clic | 0 tools/{101 => }/immudex_addons | 0 tools/{100 => }/immudex_branch | 0 tools/{0/025 => }/immudex_crypt | 0 tools/{106 => }/immudex_hostname | 0 tools/{0/023 => }/immudex_install | 0 tools/{0/021 => }/immudex_upgrade | 0 tools/{100 => }/import_gpgkeys | 0 tools/{0/013 => }/import_sshkeys | 0 tools/{100 => }/library.sh | 0 tools/{100 => }/meteo | 0 tools/{0/003 => }/morketsmerke | 0 tools/{0/012 => }/motd2 | 0 tools/{103 => }/newsfeed | 0 tools/{0/011 => }/notifier | 0 tools/{100 => }/padlock | 0 tools/{108 => }/pl | 0 tools/{0/008 => }/secured-firefox | 0 tools/{0/013 => }/shoutcasts | 0 tools/{0/022 => }/sync.sh | 0 tools/{0/025 => }/ytplay | 0 114 files changed, 6633 deletions(-) delete mode 100755 tools/0/001/immudex_crypt delete mode 100755 tools/0/001/morketsmerke delete mode 100755 tools/0/001/padlock delete mode 100755 tools/0/001/ytplay delete mode 100755 tools/0/003/create_media delete mode 100755 tools/0/003/immudex_crypt delete mode 100755 tools/0/003/immudex_install delete mode 100755 tools/0/003/ytplay delete mode 100755 tools/0/006/immudex_upgrade delete mode 100755 tools/0/006/motd2 delete mode 100755 tools/0/006/ytplay delete mode 100755 tools/0/011/immudex_upgrade delete mode 100755 tools/0/011/library.sh delete mode 100755 tools/0/011/motd2 delete mode 100755 tools/0/012/immudex_upgrade delete mode 100755 tools/0/012/library.sh delete mode 100755 tools/0/013/create_media delete mode 100755 tools/0/013/immudex_crypt delete mode 100755 tools/0/013/immudex_install delete mode 100755 tools/0/013/immudex_upgrade delete mode 100755 tools/0/013/import_gpgkeys delete mode 100755 tools/0/013/library.sh delete mode 100755 tools/0/013/morketsmerke delete mode 100755 tools/0/013/motd2 delete mode 100755 tools/0/013/newsfeed delete mode 100755 tools/0/013/notifier delete mode 100755 tools/0/013/padlock delete mode 100755 tools/0/013/secured-firefox delete mode 100755 tools/0/013/ytplay delete mode 100755 tools/0/014/ytplay delete mode 100755 tools/0/016/library.sh delete mode 100755 tools/0/017/run-thunderbird delete mode 100755 tools/0/020/immudex_crypt delete mode 100755 tools/0/020/immudex_install delete mode 100755 tools/0/020/immudex_upgrade delete mode 100755 tools/0/021/create_media delete mode 100755 tools/0/021/immudex_install delete mode 100755 tools/0/021/meteo delete mode 100755 tools/0/022/immudex_install delete mode 100755 tools/0/023/create_media delete mode 100755 tools/0/023/immudex_branch delete mode 100755 tools/0/023/immudex_crypt delete mode 100755 tools/0/023/immudex_upgrade delete mode 100755 tools/0/023/import_gpgkeys delete mode 100755 tools/0/023/import_sshkeys delete mode 100755 tools/0/023/library.sh delete mode 100755 tools/0/023/meteo delete mode 100755 tools/0/023/morketsmerke delete mode 100755 tools/0/023/motd2 delete mode 100755 tools/0/023/newsfeed delete mode 100755 tools/0/023/notifier delete mode 100755 tools/0/023/padlock delete mode 100755 tools/0/023/run-thunderbird delete mode 100755 tools/0/023/secured-firefox delete mode 100755 tools/0/023/shoutcasts delete mode 100644 tools/0/023/sync.sh delete mode 100755 tools/0/023/ytplay delete mode 100755 tools/0/025/immudex_hostname delete mode 100755 tools/0/025/meteo delete mode 100755 tools/0/025/pl delete mode 100755 tools/0/immudex_crypt delete mode 100755 tools/0/immudex_install delete mode 100755 tools/0/immudex_upgrade delete mode 100755 tools/0/import_gpgkeys delete mode 100755 tools/0/import_sshkeys delete mode 100755 tools/0/motd delete mode 100755 tools/0/motd2 delete mode 100755 tools/0/newsfeed delete mode 100755 tools/0/padlock delete mode 100755 tools/0/protected delete mode 100755 tools/0/shoutcasts delete mode 100755 tools/0/ytplay delete mode 100755 tools/100/autostart-x4notes delete mode 100755 tools/100/create_media delete mode 100755 tools/100/immudex_crypt delete mode 100755 tools/100/immudex_hostname delete mode 100755 tools/100/immudex_install delete mode 100755 tools/100/immudex_upgrade delete mode 100755 tools/100/import_sshkeys delete mode 100755 tools/100/morketsmerke delete mode 100755 tools/100/motd2 delete mode 100755 tools/100/newsfeed delete mode 100755 tools/100/notifier delete mode 100755 tools/100/pl delete mode 100755 tools/100/secured-firefox delete mode 100755 tools/100/shoutcasts delete mode 100644 tools/100/sync.sh delete mode 100755 tools/100/ytplay delete mode 100755 tools/101/immudex_hostname delete mode 100755 tools/101/pl delete mode 100755 tools/105/pl rename tools/{0/024 => }/autostart-x4notes (100%) rename tools/{106 => }/create_media (100%) rename tools/{108 => }/idle-clic (100%) rename tools/{101 => }/immudex_addons (100%) rename tools/{100 => }/immudex_branch (100%) rename tools/{0/025 => }/immudex_crypt (100%) rename tools/{106 => }/immudex_hostname (100%) rename tools/{0/023 => }/immudex_install (100%) rename tools/{0/021 => }/immudex_upgrade (100%) rename tools/{100 => }/import_gpgkeys (100%) rename tools/{0/013 => }/import_sshkeys (100%) rename tools/{100 => }/library.sh (100%) rename tools/{100 => }/meteo (100%) rename tools/{0/003 => }/morketsmerke (100%) rename tools/{0/012 => }/motd2 (100%) rename tools/{103 => }/newsfeed (100%) rename tools/{0/011 => }/notifier (100%) rename tools/{100 => }/padlock (100%) rename tools/{108 => }/pl (100%) rename tools/{0/008 => }/secured-firefox (100%) rename tools/{0/013 => }/shoutcasts (100%) rename tools/{0/022 => }/sync.sh (100%) rename tools/{0/025 => }/ytplay (100%) diff --git a/tools/0/001/immudex_crypt b/tools/0/001/immudex_crypt deleted file mode 100755 index dfae10e..0000000 --- a/tools/0/001/immudex_crypt +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash - -function help() { - - echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " list - displaing list of opened and available crypt_LUKS devices"; - echo " open - opening crypt_LUKS device, after this device is ready to mount"; - echo " close - unmount and closing crypt_LUKS devices"; - echo "Using:"; - echo "$ immudex_crypt list"; - echo "$ immudex_crypt open "; - echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]"; -} - -function list() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "Opened devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint"; - else - echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted"; - fi - fi - done - else - echo -e "No opened crypt devices was found"; - fi - echo "=============================================================="; - - luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "crypt_LUKS devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$luksDevicesList" ]; then - for lDevice in $luksDevicesList; do - echo -e "$lDevice"; - done - else - echo "No crypt device was found"; - fi - echo "=============================================================="; -} - -function open() { - - if [ $# -lt 1 ]; then help; exit 1; - else - index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1); - if [ "$index" ]; then - index=$((index + 1)); - else - index=0; - fi - sudo cryptsetup open $1 immudex_crypt${index}; - sudo mkdir -p /media/${USER}/immudex_crypt${index}; - dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2); - if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then - echo "Could not determine filesystem of unlocked device."; - echo -n "Format this device to ext4? (y/n): " - read format; - if [ "$format" = "y" ]; then - sudo mkfs.ext4 /dev/mapper/immudex_crypt${index}; - else - echo "Refuse to mount."; - sudo cryptsetup close immudex_crypt${index}; - exit 1; - fi - fi - sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index}; - if [ ! -e /ic${index} ]; then - sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index}; - fi - fi - -} - -function close() { - - if [ $# -lt 1 ]; then help; exit 1; - else - if [ $1 -ge 0 ] 2> /dev/null; then - cryptfsName="immudex_crypt${1}"; - elif echo $1 | grep -q 'ic'; then - cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')"; - else - cryptfsName=$1; - fi - if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - sudo umount -R $mountPoint; - sudo cryptsetup close ${cryptfsName}; - else - sudo cryptsetup close ${cryptfsName}; - fi - else - echo "Given devices isn't opened crypt device or it was closed before"; - fi - fi -} - -if [ "$1" ]; then - - case $1 in - "list") list;; - "open") if [ "$2" ]; then open $2; - else help; exit 1; - fi;; - "close") if [ "$2" ]; then close $2; - else help; exit 1; - fi;; - *) help;; - esac -else - help; exit 1; -fi diff --git a/tools/0/001/morketsmerke b/tools/0/001/morketsmerke deleted file mode 100755 index 8605a41..0000000 --- a/tools/0/001/morketsmerke +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -function R() { - - if [ "$path" ]; then path=${path}/${1}; - else path=$1; - fi - - fileList=$(ls $path); - for file in $fileList; do - if [ -d ${path}/${file} ]; then R ${file}; - else - sed -i 's@https://morketsmerke.github.io/@/usr/share/doc/morketsmerke/index.html@' ${path}/${file}; - sed -i 's@https://morketsmerke.github.io@/usr/share/doc/morketsmerke/index.html@' ${path}/${file}; - sed -i 's@/style.css@/usr/share/doc/morketsmerke/style.css@' ${path}/${file}; - fi - done - path=$(echo $path | sed "s@/$1@@") - -} - -function install_morketsmerke() { - - if [ -d morketsmerke.github.io ]; then rm -rf morketsmerke.github.io; fi - if [ ! -d morketsmerke.github.io ]; then - git clone https://github.com/morketsmerke/morketsmerke.github.io; - else - exit 1; - fi - - R morketsmerke.github.io - - if [ -d /usr/share/doc/morketsmerke ]; then - sudo rm -rf /usr/share/doc/morketsmerke; - fi - - sudo mv morketsmerke.github.io /usr/share/doc/morketsmerke - -} - -/usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1; -if [ $? -eq 0 ]; then install_morketsmerke; fi - -morketsmerke_path=/usr/share/doc/morketsmerke; - -if [ "$1" ] && [ "$1" = "--browser" ]; then - xdg-open ${morketsmerke_path}/index.html; -else - w3m -M ${morketsmerke_path}/index.html; -fi diff --git a/tools/0/001/padlock b/tools/0/001/padlock deleted file mode 100755 index 6bcc10e..0000000 --- a/tools/0/001/padlock +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -launcher="/home/${USER}/.config/xfce4/panel/launcher-24/16713025402.desktop"; - -function main_unlock() { - /usr/local/bin/immudex_crypt open $1; - index=$(basename $(/usr/local/bin/immudex_crypt list | grep "$1" | head -1 | awk '{printf $2}' | grep -o '[0-9]')); - #sudo mkdir -p /media/${USER}/$devName; - #sudo mount /dev/mapper/$devName /media/${USER}/$devName; - - xfce4-terminal --default-working-directory=/ic${index}; - sed -i 's/--unlock/--lock/' ${launcher}; - sed -i 's/padlock.png/unlocked.png/' ${launcher}; -} - -function unlock() { - - cryptParts=$(sudo blkid | grep 'LUKS' | sed 's/://g' | awk '{printf $1" "}'); - if [ "$cryptParts" ]; then - if [ $(echo $cryptParts | wc -w) -gt 1 ]; then - select cryptPart in $cryptParts; do - main_unlock $cryptPart; - break; - done - else - main_unlock $cryptParts; - fi - else - echo -e "\e[31mThere is no LUKS partition to open.\e[0m"; - sleep 3; - fi -} - -function lock() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - if [ "$mountPoint" ]; then - if $(sudo lsof $mountPoint > /dev/null 2>&1); then - notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error; - else - sudo umount $mountPoint; - if [ $? -ne 0 ]; then - notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error; - fi - sudo cryptsetup close /dev/mapper/${dmDevice}; - fi - else - sudo cryptsetup close /dev/mapper/${dmDevice}; - fi - fi - done - fi - if ! $(df -h | grep -q '/dev/mapper'); then - sed -i 's/--lock/--unlock/' ${launcher}; - sed -i 's/unlocked.png/padlock.png/' ${launcher}; - fi -} - -if [ "$1" ] && [ "$1" = "--unlock" ]; then unlock; -elif [ "$1" ] && [ "$1" = "--lock" ]; then lock; -fi diff --git a/tools/0/001/ytplay b/tools/0/001/ytplay deleted file mode 100755 index 142ba4b..0000000 --- a/tools/0/001/ytplay +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "ytplay - script which could play a video or audio track from youtube"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " -s - search given keyword on youtube."; - echo " -v - play youtube video." - echo " -a - play only youtube video audiotrack"; - echo "Ommiting -s option, assume you are give a yt video link."; - echo "You have to put -v or -a before you paste a yt video link"; - echo "When you put keywords in -s option, you need to choose"; - echo "that you want listening an audiotrack (-a) oraz watch video (-v)"; - echo "Usage:"; - echo " $ ytplay -s -a [-f ytdl-format] 'lofi'"; - echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]"; - echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]"; -} - -if [ "$1" ]; then - if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then - mode=$1; - shift; - link=$(echo $1 | sed 's@https://@@'); - if [ $# -gt 1 ]; then - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--ytdl-format=bestaudio"; - else - format="--ytdl-format=${1}"; - fi - fi - fi - elif [ "$1" = "-s" ]; then - if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi - if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi - - shift; - mode=$1; - if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--ytdl-format=bestaudio"; - else - format="--ytdl-format=${1}"; - fi - fi - query=$(echo $* | sed 's/ /+/g'); - echo -n "Getting youtube site with search results..."; - wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - - sed -i 's/,/\n/g' /tmp/yt.html; - - listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}'); - - numberOfListElements=$(echo $listOfVideos | wc -w); - i=1; - lp=1; - while [ $i -le $numberOfListElements ]; do - if [ $i -eq $numberOfListElements ]; then - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2='$'; - else - j=$((i + 1)); - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2=$(echo $listOfVideos | cut -d " " -f $j); - fi - #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then - # i=$((i + 1)); continue; - #else - title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8); - channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8); - duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4); - if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi - videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4); - if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then - echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}"; - echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv; - else - i=$((i + 1)); continue; - fi - #fi - i=$((i + 1)); - lp=$((lp + 1)); - done - echo -n "Put number of which video you want to hear/watch: "; - read numberOfVideo; - title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3); - channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4); - duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5); - videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2); - clear; - echo -e "Title: ${GREEN}${title}${ENDCOLOR}"; - echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "===================================================================="; - link=${videoId}; - else - help; - exit 1; - fi - - if [ "$mode" = "-a" ]; then - if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi - mpv ${format} ytdl://${link}; - elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi -else - help; - exit 1; -fi diff --git a/tools/0/003/create_media b/tools/0/003/create_media deleted file mode 100755 index ea78a90..0000000 --- a/tools/0/003/create_media +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "create_media - script used for write iso image to usb drive(mainly)"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " --i386-efi - creating 32-bit EFI usb drive with iso image"; - echo " (comapatible with immudex only iso images)"; - echo "Usage:"; - echo " $ create_media [--i386-efi] "; -} - -if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi -if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then - disk=$1; shift; -else - help; - exit 1; -fi -if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then - iso=$1; -else - help; - exit 1; -fi - -if [ "$target" ]; then - echo -n "Writing zeros to 1st megabyte on disk..."; - sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating MS-DOS partitionig scheme on disk..."; - sudo parted $disk mklabel msdos > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating FAT-32 partition..."; - sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating VFAT filesystem on partition..."; - sudo mkfs.vfat ${disk}1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/usb directory..."; - sudo mkdir /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting VFAT partition on /mnt/usb..."; - sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Instalation GRUB on disk..."; - sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/iso directory..."; - sudo mkdir /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting iso file on /mnt/iso..."; - sudo mount $iso /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying grub config files to the disk..."; - sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1; - sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying immudex files to the disk..."; - sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating empty DEBIAN file..."; - sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Umounting all mounted filesystems..."; - sudo umount /mnt/* > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -else - echo -n "Writing iso image to the disk..." - sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -fi diff --git a/tools/0/003/immudex_crypt b/tools/0/003/immudex_crypt deleted file mode 100755 index dfae10e..0000000 --- a/tools/0/003/immudex_crypt +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash - -function help() { - - echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " list - displaing list of opened and available crypt_LUKS devices"; - echo " open - opening crypt_LUKS device, after this device is ready to mount"; - echo " close - unmount and closing crypt_LUKS devices"; - echo "Using:"; - echo "$ immudex_crypt list"; - echo "$ immudex_crypt open "; - echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]"; -} - -function list() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "Opened devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint"; - else - echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted"; - fi - fi - done - else - echo -e "No opened crypt devices was found"; - fi - echo "=============================================================="; - - luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "crypt_LUKS devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$luksDevicesList" ]; then - for lDevice in $luksDevicesList; do - echo -e "$lDevice"; - done - else - echo "No crypt device was found"; - fi - echo "=============================================================="; -} - -function open() { - - if [ $# -lt 1 ]; then help; exit 1; - else - index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1); - if [ "$index" ]; then - index=$((index + 1)); - else - index=0; - fi - sudo cryptsetup open $1 immudex_crypt${index}; - sudo mkdir -p /media/${USER}/immudex_crypt${index}; - dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2); - if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then - echo "Could not determine filesystem of unlocked device."; - echo -n "Format this device to ext4? (y/n): " - read format; - if [ "$format" = "y" ]; then - sudo mkfs.ext4 /dev/mapper/immudex_crypt${index}; - else - echo "Refuse to mount."; - sudo cryptsetup close immudex_crypt${index}; - exit 1; - fi - fi - sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index}; - if [ ! -e /ic${index} ]; then - sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index}; - fi - fi - -} - -function close() { - - if [ $# -lt 1 ]; then help; exit 1; - else - if [ $1 -ge 0 ] 2> /dev/null; then - cryptfsName="immudex_crypt${1}"; - elif echo $1 | grep -q 'ic'; then - cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')"; - else - cryptfsName=$1; - fi - if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - sudo umount -R $mountPoint; - sudo cryptsetup close ${cryptfsName}; - else - sudo cryptsetup close ${cryptfsName}; - fi - else - echo "Given devices isn't opened crypt device or it was closed before"; - fi - fi -} - -if [ "$1" ]; then - - case $1 in - "list") list;; - "open") if [ "$2" ]; then open $2; - else help; exit 1; - fi;; - "close") if [ "$2" ]; then close $2; - else help; exit 1; - fi;; - *) help;; - esac -else - help; exit 1; -fi diff --git a/tools/0/003/immudex_install b/tools/0/003/immudex_install deleted file mode 100755 index 5d3363f..0000000 --- a/tools/0/003/immudex_install +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -ENDCOLOR="\e[0m"; - -while [ true ]; do - echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}"; - echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}"; - echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}"; - read ans; - if [ "$ans" = "y" ]; then break; fi -done - -set -e - -function selectDisk() { - disks=$(lsblk | grep 'disk' | awk '{printf $1" "}'); - if [ $(echo $disks | wc -w) -gt 1 ]; then - select drive in $disks; do - echo $drive; - break; - done - else - echo $disks | awk '{printf $1}'; - fi -} - -if $(sudo efibootmgr > /dev/null 2>&1); then -#uefi installation - #partitioning - echo -n "Installation immudex in EFI mode ... "; - disk=$(selectDisk); - originDisk=$disk; - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1; - sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1; - - #Setting label for partition - sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1; - - #mount root partition - sudo mount /dev/${disk}2 /media > /dev/null 2>&1; - - #creating directories for efi partition - sudo mkdir -p /media/boot/efi > /dev/null 2>&1; - - #mount efi partition - sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying whole iso image to the second partition - sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1; - - #removing unnecessary directories from second partition - sudo rm -rf /media/isolinux > /dev/null 2>&1; - sudo rm -rf /media/EFI > /dev/null 2>&1; - - #GRUB Installation - if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then - target="i386-efi"; - else - target="x86_64-efi"; - fi - sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1; - - #Adding entry to EFI Firmware - sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1; - - #Umount all mounted filesystems - sudo umount -R /media > /dev/null 2>&1; - - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - -else -#mbr installation - echo -n "Installation immudex in BIOS mode ... "; - - #partitioning - disk=$(selectDisk); - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1; - - #Setting label for partition is necessary for extlinux bootloader - sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1; - - #mount partition in /media directory - sudo mount /dev/${disk}1 /media > /dev/null 2>&1; - - #Creating directory for extlinux - sudo mkdir /media/extlinux > /dev/null 2>&1; - - #Instalation extlinux files in abovementioned directory - sudo extlinux --install /media/extlinux > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying live directory from iso image to partition - sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1; - - #installation extlinux MBR on first sector of hard drive (whole device) - sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1; - - #creating extlinux configuration file - cat > extlinux.conf < /dev/null 2>&1; - - #Unmounting filesystems - sudo umount /media > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi -fi diff --git a/tools/0/003/ytplay b/tools/0/003/ytplay deleted file mode 100755 index 142ba4b..0000000 --- a/tools/0/003/ytplay +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "ytplay - script which could play a video or audio track from youtube"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " -s - search given keyword on youtube."; - echo " -v - play youtube video." - echo " -a - play only youtube video audiotrack"; - echo "Ommiting -s option, assume you are give a yt video link."; - echo "You have to put -v or -a before you paste a yt video link"; - echo "When you put keywords in -s option, you need to choose"; - echo "that you want listening an audiotrack (-a) oraz watch video (-v)"; - echo "Usage:"; - echo " $ ytplay -s -a [-f ytdl-format] 'lofi'"; - echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]"; - echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]"; -} - -if [ "$1" ]; then - if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then - mode=$1; - shift; - link=$(echo $1 | sed 's@https://@@'); - if [ $# -gt 1 ]; then - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--ytdl-format=bestaudio"; - else - format="--ytdl-format=${1}"; - fi - fi - fi - elif [ "$1" = "-s" ]; then - if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi - if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi - - shift; - mode=$1; - if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--ytdl-format=bestaudio"; - else - format="--ytdl-format=${1}"; - fi - fi - query=$(echo $* | sed 's/ /+/g'); - echo -n "Getting youtube site with search results..."; - wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - - sed -i 's/,/\n/g' /tmp/yt.html; - - listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}'); - - numberOfListElements=$(echo $listOfVideos | wc -w); - i=1; - lp=1; - while [ $i -le $numberOfListElements ]; do - if [ $i -eq $numberOfListElements ]; then - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2='$'; - else - j=$((i + 1)); - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2=$(echo $listOfVideos | cut -d " " -f $j); - fi - #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then - # i=$((i + 1)); continue; - #else - title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8); - channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8); - duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4); - if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi - videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4); - if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then - echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}"; - echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv; - else - i=$((i + 1)); continue; - fi - #fi - i=$((i + 1)); - lp=$((lp + 1)); - done - echo -n "Put number of which video you want to hear/watch: "; - read numberOfVideo; - title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3); - channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4); - duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5); - videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2); - clear; - echo -e "Title: ${GREEN}${title}${ENDCOLOR}"; - echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "===================================================================="; - link=${videoId}; - else - help; - exit 1; - fi - - if [ "$mode" = "-a" ]; then - if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi - mpv ${format} ytdl://${link}; - elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi -else - help; - exit 1; -fi diff --git a/tools/0/006/immudex_upgrade b/tools/0/006/immudex_upgrade deleted file mode 100755 index 312c1b3..0000000 --- a/tools/0/006/immudex_upgrade +++ /dev/null @@ -1,155 +0,0 @@ -#!/bin/bash - -set -e - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; -root="/run/live/medium"; - -function help() { - echo "immudex_upgrade - script for searching upgrades and upgrade immudex"; - echo "morketsmerke.net @ 2022"; - echo "Options:"; - echo " --check --print - check there are upgrades for immudex"; - echo " --upgrade - check there are upgrades for immudex and install them."; - echo " If there is no new version, script will propose refreshing"; - echo " current immudex installation, its helpful when you tried"; - echo " remaster immudex and you get any trouble with this". -} - -function get_debian_branch() { - if grep -q '\/sid' /etc/os-release; then - echo "testing"; - else - echo "stable"; - fi -} - -function get_machine_arch() { - arch=$(uname -m); - if [ "$arch" = "i686" ]; then - echo "32"; - else - echo "64"; - fi -} - -function main_upgrade() { - set -e - ARCH=$(get_machine_arch); - BRANCH=$(get_debian_branch); - rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}'); - sudo mount $rootPart $1 -o remount,rw; - sudo rm -f ${1}/live/*; - sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs/download -O ${1}/live/filesystem.squashfs; - sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd/download -O ${1}/live/initrd; - sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz/download -O ${1}/live/vmlinuz; - echo "$2" > /tmp/version; - sudo cp /tmp/version ${1}/live; -} - -#function check(){ -# set -e -# if [ -d ${root}/live ]; then -# if [ -f ${root}/live/version ]; then -# version=$(cat ${root}/live/version | sed 's/\.//g'); -# else version="000"; -# fi -# if [ ! -f /tmp/feed.xml ]; then -# wget -q https://sourceforge.net/p/immudex/activity/feed -O /tmp/feed.xml -# fi -# if [ ! -s /tmp/feed.xml ]; then sudo rm /tmp/feed.xml; return 255; fi; -# newVersionTxt=$(grep -o "[0-9]\.[0-9]\.[0-9]" /tmp/feed.xml | head -1); -# newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); -# if [ $version -lt $newVersionInt ]; then -# exitcode=0; -# else -# exitcode=1; -# fi -# else -# exitcode=255; -# fi -# if [ "$1" ] && [ "$1" = "--print" ]; then -# echo $newVersionTxt; -# return 0; -# fi -# return $exitcode; -#} - -function check() { - set -e - if [ -d ${root}/live ]; then - if [ -f ${root}/live/version ]; then - version=$(cat ${root}/live/version | sed 's/\.//g'); - else version="000"; - fi - BRANCH=$(get_debian_branch); - ARCH=$(get_machine_arch); - if [ ! -f /tmp/ltver ]; then - wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver; - fi - if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi; - newVersionTxt=$(cat /tmp/ltver); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if [ $version -lt $newVersionInt ]; then - exitcode=0; - else - exitcode=1; - fi - else - exitcode=255; - fi - if [ "$1" ] && [ "$1" = "--print" ]; then - echo $newVersionTxt; - return 0; - fi - return $exitcode; -} - -if [ "$1" ] && [ "$1" = "--check" ]; then - if [ "$2" ] && [ "$2" = "--print" ]; then - newVersion=$(check --print); - if check; then - echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}"; - else - echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}"; - fi - fi -elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - newVersionTxt=$(check --print); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if check; then - echo -en "${YELLOW}New version " - echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) " - echo -e "of immudex is available.${ENDCOLOR}"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Upgrading immudex to the newest version..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}"; - echo -e "${YELLOW}but you can copy fresh system files from latest iso image"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Refreshing immudex to the latest iso image..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - exit 0; - fi -else - help; - exit 1; -fi diff --git a/tools/0/006/motd2 b/tools/0/006/motd2 deleted file mode 100755 index 48337a1..0000000 --- a/tools/0/006/motd2 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -/usr/bin/figlet immudex; -echo; -echo "Today is: $(date)"; -echo; -echo "System summary: "; -cpuIdle=$(vmstat | tail -1 | awk '{printf $15}'); -cpuUsage=$((100 - $cpuIdle)); -echo -e " \tCPU: ${cpuUsage}%"; -echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free"; -if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then - i=1; - echo -e " \tCRYPT_PARTi: Free/Total (Usage%)"; - amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}'); - while [ $i -le $amountOfDisks ]; do - diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}'); - diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}'); - diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}'); - #FCP = First Crypt Partition - echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)"; - i=$((i + 1)); - done -else - echo -e " \tCRYPT_PART: N/A"; -fi -echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')"; -utime=$(uptime | awk '{printf $3}' | sed 's/,//'); -if $(echo $utime | grep -q ":"); then - echo -e " \tUPTIME: ${utime}"; -else - echo -e " \tUPTIME: 0:${utime}"; -fi -echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])"; -echo; -echo -e "morketsmerke.net @ 2023 https://github.com/xf0r3m/immudex"; -echo; -/usr/local/bin/immudex_upgrade --check --print; -if [ $? -ne 0 ]; then - echo -e "\e[31mThere is no internet connection or internal error.\e[0m"; - if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then - rm -f /tmp/feed.xml; - fi -else - if [ "$USER" = "xf0r3m" ]; then - sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log; - fi -fi -echo "===================================================================="; diff --git a/tools/0/006/ytplay b/tools/0/006/ytplay deleted file mode 100755 index 41ea516..0000000 --- a/tools/0/006/ytplay +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "ytplay - script which could play a video or audio track from youtube"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " -s - search given keyword on youtube."; - echo " -v - play youtube video." - echo " -a - play only youtube video audiotrack"; - echo "Ommiting -s option, assume you are give a yt video link."; - echo "You have to put -v or -a before you paste a yt video link"; - echo "When you put keywords in -s option, you need to choose"; - echo "that you want listening an audiotrack (-a) oraz watch video (-v)"; - echo "Usage:"; - echo " $ ytplay -s -a [-f ytdl-format] 'lofi'"; - echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]"; - echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]"; - echo "You can search again the same keywords puting 'r' or 'R' instead"; - echo "of video numer"; -} - -function yt_search() { - query=$(echo $* | sed 's/ /+/g'); - echo -n "Getting youtube site with search results..."; - wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - - sed -i 's/,/\n/g' /tmp/yt.html; - - listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}'); - - numberOfListElements=$(echo $listOfVideos | wc -w); - i=1; - lp=1; - while [ $i -le $numberOfListElements ]; do - if [ $i -eq $numberOfListElements ]; then - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2='$'; - else - j=$((i + 1)); - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2=$(echo $listOfVideos | cut -d " " -f $j); - fi - #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then - # i=$((i + 1)); continue; - #else - title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8); - channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8); - duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4); - if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi - videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4); - if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then - echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}"; - echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv; - else - i=$((i + 1)); continue; - fi - #fi - i=$((i + 1)); - lp=$((lp + 1)); - done -} - -if [ "$1" ]; then - if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then - mode=$1; - shift; - link=$(echo $1 | sed 's@https://@@'); - if [ $# -gt 1 ]; then - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--ytdl-format=bestaudio"; - else - format="--ytdl-format=${1}"; - fi - fi - fi - elif [ "$1" = "-s" ]; then - if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi - if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi - - shift; - mode=$1; - if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--ytdl-format=bestaudio"; - else - format="--ytdl-format=${1}"; - fi - fi - while [ true ]; do - yt_search $*; - echo -n "Put number of which video you want to hear/watch: "; - read numberOfVideo; - if [[ $numberOfVideo -gt 0 ]]; then break; - elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then - continue; - else - help; - exit 1; - fi - done - title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3); - channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4); - duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5); - videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2); - clear; - echo -e "Title: ${GREEN}${title}${ENDCOLOR}"; - echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "===================================================================="; - link=${videoId}; - else - help; - exit 1; - fi - - if [ "$mode" = "-a" ]; then - if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi - mpv ${format} ytdl://${link}; - elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi -else - help; - exit 1; -fi diff --git a/tools/0/011/immudex_upgrade b/tools/0/011/immudex_upgrade deleted file mode 100755 index dc170b3..0000000 --- a/tools/0/011/immudex_upgrade +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -set -e - -source library.sh - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; -root="/run/live/medium"; - -function help() { - echo "immudex_upgrade - script for searching upgrades and upgrade immudex"; - echo "morketsmerke.net @ 2022"; - echo "Options:"; - echo " --check --print - check there are upgrades for immudex"; - echo " --upgrade - check there are upgrades for immudex and install them."; - echo " If there is no new version, script will propose refreshing"; - echo " current immudex installation, its helpful when you tried"; - echo " remaster immudex and you get any trouble with this". -} - -function main_upgrade() { - set -e - ARCH=$(get_machine_arch); - BRANCH=$(get_debian_branch); - rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}'); - sudo mount $rootPart $1 -o remount,rw; - sudo rm -f ${1}/live/*; - sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs/download -O ${1}/live/filesystem.squashfs; - sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd/download -O ${1}/live/initrd; - sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz/download -O ${1}/live/vmlinuz; - echo "$2" > /tmp/version; - sudo cp /tmp/version ${1}/live; -} - -if [ "$1" ] && [ "$1" = "--check" ]; then - if [ "$2" ] && [ "$2" = "--print" ]; then - newVersion=$(check_distro_version --print); - if check_distro_version; then - echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}"; - else - echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}"; - fi - fi -elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - newVersionTxt=$(check_distro_version --print); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if check_distro_version; then - echo -en "${YELLOW}New version " - echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) " - echo -e "of immudex is available.${ENDCOLOR}"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Upgrading immudex to the newest version..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}"; - echo -e "${YELLOW}but you can copy fresh system files from latest iso image"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Refreshing immudex to the latest iso image..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - exit 0; - fi -else - help; - exit 1; -fi diff --git a/tools/0/011/library.sh b/tools/0/011/library.sh deleted file mode 100755 index 3d5c93c..0000000 --- a/tools/0/011/library.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -function get_debian_branch() { - if grep -q '\/sid' /etc/os-release; then - echo "testing"; - else - echo "stable"; - fi -} - -function get_machine_arch() { - arch=$(uname -m); - if [ "$arch" = "i686" ]; then - echo "32"; - else - echo "64"; - fi -} - -function check_distro_version() { - set -e - root="/run/live/medium"; - if [ -d ${root}/live ]; then - if [ -f ${root}/live/version ]; then - version=$(cat ${root}/live/version | sed 's/\.//g'); - else version="000"; - fi - BRANCH=$(get_debian_branch); - ARCH=$(get_machine_arch); - if [ ! -f /tmp/ltver ]; then - wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver; - fi - if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi; - newVersionTxt=$(cat /tmp/ltver); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if [ $version -lt $newVersionInt ]; then - exitcode=0; - else - exitcode=1; - fi - else - exitcode=255; - fi - if [ "$1" ] && [ "$1" = "--print" ]; then - echo $newVersionTxt; - return 0; - fi - return $exitcode; -} diff --git a/tools/0/011/motd2 b/tools/0/011/motd2 deleted file mode 100755 index b187aaa..0000000 --- a/tools/0/011/motd2 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -/usr/bin/figlet immudex; -echo; -echo "Today is: $(date)"; -echo; -echo "System summary: "; -cpuIdle=$(vmstat | tail -1 | awk '{printf $15}'); -cpuUsage=$((100 - $cpuIdle)); -echo -e " \tCPU: ${cpuUsage}%"; -echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free"; -if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then - i=1; - echo -e " \tCRYPT_PARTi: Free/Total (Usage%)"; - amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}'); - while [ $i -le $amountOfDisks ]; do - diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}'); - diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}'); - diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}'); - #FCP = First Crypt Partition - echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)"; - i=$((i + 1)); - done -else - echo -e " \tCRYPT_PART: N/A"; -fi -echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')"; -utime=$(uptime | awk '{printf $3}' | sed 's/,//'); -if $(echo $utime | grep -q ":"); then - echo -e " \tUPTIME: ${utime}"; -else - echo -e " \tUPTIME: 0:${utime}"; -fi -echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])"; -echo; -echo -e "morketsmerke.net @ 2023 https://github.com/xf0r3m/immudex"; -echo; -#/usr/local/bin/immudex_upgrade --check --print; -#if [ $? -ne 0 ]; then -# echo -e "\e[31mThere is no internet connection or internal error.\e[0m"; -# if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then -# rm -f /tmp/feed.xml; -# fi -#else -# if [ "$USER" = "xf0r3m" ]; then -# sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log; -# fi -#fi -echo "===================================================================="; diff --git a/tools/0/012/immudex_upgrade b/tools/0/012/immudex_upgrade deleted file mode 100755 index 7b1b3b0..0000000 --- a/tools/0/012/immudex_upgrade +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -set -e - -source library.sh - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; -root="/run/live/medium"; - -function help() { - echo "immudex_upgrade - script for searching upgrades and upgrade immudex"; - echo "morketsmerke.net @ 2022"; - echo "Options:"; - echo " --check --print - check there are upgrades for immudex"; - echo " --upgrade - check there are upgrades for immudex and install them."; - echo " If there is no new version, script will propose refreshing"; - echo " current immudex installation, its helpful when you tried"; - echo " remaster immudex and you get any trouble with this". -} - -function main_upgrade() { - set -e - ARCH=$(get_machine_arch); - BRANCH=$(get_debian_branch); - rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}'); - sudo mount $rootPart $1 -o remount,rw; - sudo rm -f ${1}/live/*; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz; - echo "$2" > /tmp/version; - sudo cp /tmp/version ${1}/live; -} - -if [ "$1" ] && [ "$1" = "--check" ]; then - if [ "$2" ] && [ "$2" = "--print" ]; then - newVersion=$(check_distro_version --print); - if check_distro_version; then - echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}"; - else - echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}"; - fi - fi -elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - newVersionTxt=$(check_distro_version --print); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if check_distro_version; then - echo -en "${YELLOW}New version " - echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) " - echo -e "of immudex is available.${ENDCOLOR}"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Upgrading immudex to the newest version..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}"; - echo -e "${YELLOW}but you can copy fresh system files from latest iso image"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Refreshing immudex to the latest iso image..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - exit 0; - fi -else - help; - exit 1; -fi diff --git a/tools/0/012/library.sh b/tools/0/012/library.sh deleted file mode 100755 index 599c023..0000000 --- a/tools/0/012/library.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -function get_debian_branch() { - if grep -q '\/sid' /etc/os-release; then - echo "testing"; - else - echo "stable"; - fi -} - -function get_machine_arch() { - arch=$(uname -m); - if [ "$arch" = "i686" ]; then - echo "32"; - else - echo "64"; - fi -} - -function check_distro_version() { - set -e - root="/run/live/medium"; - if [ -d ${root}/live ]; then - if [ -f ${root}/live/version ]; then - version=$(cat ${root}/live/version | sed 's/\.//g'); - else version="000"; - fi - BRANCH=$(get_debian_branch); - ARCH=$(get_machine_arch); - if [ ! -f /tmp/ltver ]; then - wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver; - fi - if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi; - newVersionTxt=$(cat /tmp/ltver); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if [ $version -lt $newVersionInt ]; then - exitcode=0; - else - exitcode=1; - fi - else - exitcode=255; - fi - if [ "$1" ] && [ "$1" = "--print" ]; then - echo $newVersionTxt; - return 0; - fi - return $exitcode; -} diff --git a/tools/0/013/create_media b/tools/0/013/create_media deleted file mode 100755 index ea78a90..0000000 --- a/tools/0/013/create_media +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "create_media - script used for write iso image to usb drive(mainly)"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " --i386-efi - creating 32-bit EFI usb drive with iso image"; - echo " (comapatible with immudex only iso images)"; - echo "Usage:"; - echo " $ create_media [--i386-efi] "; -} - -if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi -if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then - disk=$1; shift; -else - help; - exit 1; -fi -if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then - iso=$1; -else - help; - exit 1; -fi - -if [ "$target" ]; then - echo -n "Writing zeros to 1st megabyte on disk..."; - sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating MS-DOS partitionig scheme on disk..."; - sudo parted $disk mklabel msdos > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating FAT-32 partition..."; - sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating VFAT filesystem on partition..."; - sudo mkfs.vfat ${disk}1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/usb directory..."; - sudo mkdir /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting VFAT partition on /mnt/usb..."; - sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Instalation GRUB on disk..."; - sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/iso directory..."; - sudo mkdir /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting iso file on /mnt/iso..."; - sudo mount $iso /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying grub config files to the disk..."; - sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1; - sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying immudex files to the disk..."; - sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating empty DEBIAN file..."; - sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Umounting all mounted filesystems..."; - sudo umount /mnt/* > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -else - echo -n "Writing iso image to the disk..." - sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -fi diff --git a/tools/0/013/immudex_crypt b/tools/0/013/immudex_crypt deleted file mode 100755 index dfae10e..0000000 --- a/tools/0/013/immudex_crypt +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash - -function help() { - - echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " list - displaing list of opened and available crypt_LUKS devices"; - echo " open - opening crypt_LUKS device, after this device is ready to mount"; - echo " close - unmount and closing crypt_LUKS devices"; - echo "Using:"; - echo "$ immudex_crypt list"; - echo "$ immudex_crypt open "; - echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]"; -} - -function list() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "Opened devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint"; - else - echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted"; - fi - fi - done - else - echo -e "No opened crypt devices was found"; - fi - echo "=============================================================="; - - luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "crypt_LUKS devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$luksDevicesList" ]; then - for lDevice in $luksDevicesList; do - echo -e "$lDevice"; - done - else - echo "No crypt device was found"; - fi - echo "=============================================================="; -} - -function open() { - - if [ $# -lt 1 ]; then help; exit 1; - else - index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1); - if [ "$index" ]; then - index=$((index + 1)); - else - index=0; - fi - sudo cryptsetup open $1 immudex_crypt${index}; - sudo mkdir -p /media/${USER}/immudex_crypt${index}; - dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2); - if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then - echo "Could not determine filesystem of unlocked device."; - echo -n "Format this device to ext4? (y/n): " - read format; - if [ "$format" = "y" ]; then - sudo mkfs.ext4 /dev/mapper/immudex_crypt${index}; - else - echo "Refuse to mount."; - sudo cryptsetup close immudex_crypt${index}; - exit 1; - fi - fi - sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index}; - if [ ! -e /ic${index} ]; then - sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index}; - fi - fi - -} - -function close() { - - if [ $# -lt 1 ]; then help; exit 1; - else - if [ $1 -ge 0 ] 2> /dev/null; then - cryptfsName="immudex_crypt${1}"; - elif echo $1 | grep -q 'ic'; then - cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')"; - else - cryptfsName=$1; - fi - if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - sudo umount -R $mountPoint; - sudo cryptsetup close ${cryptfsName}; - else - sudo cryptsetup close ${cryptfsName}; - fi - else - echo "Given devices isn't opened crypt device or it was closed before"; - fi - fi -} - -if [ "$1" ]; then - - case $1 in - "list") list;; - "open") if [ "$2" ]; then open $2; - else help; exit 1; - fi;; - "close") if [ "$2" ]; then close $2; - else help; exit 1; - fi;; - *) help;; - esac -else - help; exit 1; -fi diff --git a/tools/0/013/immudex_install b/tools/0/013/immudex_install deleted file mode 100755 index 5d3363f..0000000 --- a/tools/0/013/immudex_install +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -ENDCOLOR="\e[0m"; - -while [ true ]; do - echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}"; - echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}"; - echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}"; - read ans; - if [ "$ans" = "y" ]; then break; fi -done - -set -e - -function selectDisk() { - disks=$(lsblk | grep 'disk' | awk '{printf $1" "}'); - if [ $(echo $disks | wc -w) -gt 1 ]; then - select drive in $disks; do - echo $drive; - break; - done - else - echo $disks | awk '{printf $1}'; - fi -} - -if $(sudo efibootmgr > /dev/null 2>&1); then -#uefi installation - #partitioning - echo -n "Installation immudex in EFI mode ... "; - disk=$(selectDisk); - originDisk=$disk; - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1; - sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1; - - #Setting label for partition - sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1; - - #mount root partition - sudo mount /dev/${disk}2 /media > /dev/null 2>&1; - - #creating directories for efi partition - sudo mkdir -p /media/boot/efi > /dev/null 2>&1; - - #mount efi partition - sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying whole iso image to the second partition - sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1; - - #removing unnecessary directories from second partition - sudo rm -rf /media/isolinux > /dev/null 2>&1; - sudo rm -rf /media/EFI > /dev/null 2>&1; - - #GRUB Installation - if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then - target="i386-efi"; - else - target="x86_64-efi"; - fi - sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1; - - #Adding entry to EFI Firmware - sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1; - - #Umount all mounted filesystems - sudo umount -R /media > /dev/null 2>&1; - - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - -else -#mbr installation - echo -n "Installation immudex in BIOS mode ... "; - - #partitioning - disk=$(selectDisk); - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1; - - #Setting label for partition is necessary for extlinux bootloader - sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1; - - #mount partition in /media directory - sudo mount /dev/${disk}1 /media > /dev/null 2>&1; - - #Creating directory for extlinux - sudo mkdir /media/extlinux > /dev/null 2>&1; - - #Instalation extlinux files in abovementioned directory - sudo extlinux --install /media/extlinux > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying live directory from iso image to partition - sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1; - - #installation extlinux MBR on first sector of hard drive (whole device) - sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1; - - #creating extlinux configuration file - cat > extlinux.conf < /dev/null 2>&1; - - #Unmounting filesystems - sudo umount /media > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi -fi diff --git a/tools/0/013/immudex_upgrade b/tools/0/013/immudex_upgrade deleted file mode 100755 index 7b1b3b0..0000000 --- a/tools/0/013/immudex_upgrade +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -set -e - -source library.sh - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; -root="/run/live/medium"; - -function help() { - echo "immudex_upgrade - script for searching upgrades and upgrade immudex"; - echo "morketsmerke.net @ 2022"; - echo "Options:"; - echo " --check --print - check there are upgrades for immudex"; - echo " --upgrade - check there are upgrades for immudex and install them."; - echo " If there is no new version, script will propose refreshing"; - echo " current immudex installation, its helpful when you tried"; - echo " remaster immudex and you get any trouble with this". -} - -function main_upgrade() { - set -e - ARCH=$(get_machine_arch); - BRANCH=$(get_debian_branch); - rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}'); - sudo mount $rootPart $1 -o remount,rw; - sudo rm -f ${1}/live/*; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz; - echo "$2" > /tmp/version; - sudo cp /tmp/version ${1}/live; -} - -if [ "$1" ] && [ "$1" = "--check" ]; then - if [ "$2" ] && [ "$2" = "--print" ]; then - newVersion=$(check_distro_version --print); - if check_distro_version; then - echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}"; - else - echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}"; - fi - fi -elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - newVersionTxt=$(check_distro_version --print); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if check_distro_version; then - echo -en "${YELLOW}New version " - echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) " - echo -e "of immudex is available.${ENDCOLOR}"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Upgrading immudex to the newest version..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}"; - echo -e "${YELLOW}but you can copy fresh system files from latest iso image"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Refreshing immudex to the latest iso image..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - exit 0; - fi -else - help; - exit 1; -fi diff --git a/tools/0/013/import_gpgkeys b/tools/0/013/import_gpgkeys deleted file mode 100755 index dfb9ff9..0000000 --- a/tools/0/013/import_gpgkeys +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ -f ~/public.gpg ] && [ -f ~/private.gpg ]; then - gpg --import ~/public.gpg - gpg --import ~/private.gpg - userId=$(gpg --list-keys | sed -nr 's/.+<(.*)>$/\1/p'); - gpg --edit-key $userId; -fi diff --git a/tools/0/013/library.sh b/tools/0/013/library.sh deleted file mode 100755 index 599c023..0000000 --- a/tools/0/013/library.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -function get_debian_branch() { - if grep -q '\/sid' /etc/os-release; then - echo "testing"; - else - echo "stable"; - fi -} - -function get_machine_arch() { - arch=$(uname -m); - if [ "$arch" = "i686" ]; then - echo "32"; - else - echo "64"; - fi -} - -function check_distro_version() { - set -e - root="/run/live/medium"; - if [ -d ${root}/live ]; then - if [ -f ${root}/live/version ]; then - version=$(cat ${root}/live/version | sed 's/\.//g'); - else version="000"; - fi - BRANCH=$(get_debian_branch); - ARCH=$(get_machine_arch); - if [ ! -f /tmp/ltver ]; then - wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver; - fi - if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi; - newVersionTxt=$(cat /tmp/ltver); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if [ $version -lt $newVersionInt ]; then - exitcode=0; - else - exitcode=1; - fi - else - exitcode=255; - fi - if [ "$1" ] && [ "$1" = "--print" ]; then - echo $newVersionTxt; - return 0; - fi - return $exitcode; -} diff --git a/tools/0/013/morketsmerke b/tools/0/013/morketsmerke deleted file mode 100755 index 7193473..0000000 --- a/tools/0/013/morketsmerke +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -function help() { - echo "======================================================================"; - echo "morketsmerke - script for fetch and adjust morketsmerke.net site"; - echo "as offline available source of information."; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo; - echo "Options:"; - echo " --browser - launching fetched site in default application for open" - echo " html sites"; - echo " -[-] - print this message"; - echo "By default script open downloaded site in terminal via W3M browser with"; - echo "monochrome mode"; - echo; - echo "Usage:"; - echo " $ morketsmerke [--browser]"; -} - -function R() { - - if [ "$path" ]; then path=${path}/${1}; - else path=$1; - fi - - fileList=$(ls $path); - for file in $fileList; do - if [ -d ${path}/${file} ]; then R ${file}; - else - sed -i 's@https://morketsmerke.github.io/@/usr/share/doc/morketsmerke/index.html@' ${path}/${file}; - sed -i 's@https://morketsmerke.github.io@/usr/share/doc/morketsmerke/index.html@' ${path}/${file}; - sed -i 's@/style.css@/usr/share/doc/morketsmerke/style.css@' ${path}/${file}; - fi - done - path=$(echo $path | sed "s@/$1@@") - -} - -function install_morketsmerke() { - - if [ -d morketsmerke.github.io ]; then rm -rf morketsmerke.github.io; fi - if [ ! -d morketsmerke.github.io ]; then - git clone https://github.com/morketsmerke/morketsmerke.github.io; - else - exit 1; - fi - - R morketsmerke.github.io - - if [ -d /usr/share/doc/morketsmerke ]; then - sudo rm -rf /usr/share/doc/morketsmerke; - fi - - sudo mv morketsmerke.github.io /usr/share/doc/morketsmerke - -} - -/usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1; -if [ $? -eq 0 ]; then install_morketsmerke; fi - -morketsmerke_path=/usr/share/doc/morketsmerke; - -if [ "$1" ] && [ "$1" = "--browser" ]; then - xdg-open ${morketsmerke_path}/index.html; -elif [ "$1" ]; then - help; - exit 1; -else - w3m -M ${morketsmerke_path}/index.html; -fi diff --git a/tools/0/013/motd2 b/tools/0/013/motd2 deleted file mode 100755 index da11dcc..0000000 --- a/tools/0/013/motd2 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -/usr/bin/figlet immudex; -echo; -echo "Today is: $(date)"; -echo; -echo "System summary: "; -cpuIdle=$(vmstat | tail -1 | awk '{printf $15}'); -cpuUsage=$((100 - $cpuIdle)); -echo -e " \tCPU: ${cpuUsage}%"; -echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free"; -if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then - i=1; - echo -e " \tCRYPT_PARTi: Free/Total (Usage%)"; - amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}'); - while [ $i -le $amountOfDisks ]; do - diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}'); - diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}'); - diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}'); - #FCP = First Crypt Partition - echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)"; - i=$((i + 1)); - done -else - echo -e " \tCRYPT_PART: N/A"; -fi -echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')"; -utime=$(uptime | awk '{printf $3}' | sed 's/,//'); -if $(echo $utime | grep -q ":"); then - echo -e " \tUPTIME: ${utime}"; -else - echo -e " \tUPTIME: 0:${utime}"; -fi -echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])"; -echo; -echo -e "morketsmerke.org @ 2023 https://github.com/xf0r3m/immudex"; -echo; -#/usr/local/bin/immudex_upgrade --check --print; -#if [ $? -ne 0 ]; then -# echo -e "\e[31mThere is no internet connection or internal error.\e[0m"; -# if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then -# rm -f /tmp/feed.xml; -# fi -#else -# if [ "$USER" = "xf0r3m" ]; then -# sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log; -# fi -#fi -echo "===================================================================="; diff --git a/tools/0/013/newsfeed b/tools/0/013/newsfeed deleted file mode 100755 index a3a426a..0000000 --- a/tools/0/013/newsfeed +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -function help() { - echo "newsfeed - fetch and browse news feed from rss and atom channels"; - echo "morketsmerke.net; COPYLEFT @ 2022"; - echo; - echo "Options:"; - echo " --list - shows numbered list of names, saved in ~/.newsfeed names and"; - echo " URL of rss channels"; - echo " --check - fetching new rss channel file from source"; - echo " --show - shows numbered list of news titles."; - echo " Number of channel you can get from --list option."; - echo " --open - open web browser on link, which are under"; - echo " titles of news on rss channel. Number of title you can get"; - echo " from --show option. This option based on the last showed rss"; - echo " channel feed."; - echo; - echo "The ~/.newsfeed file:"; - echo " This file is simple csv (semicolon separated values) file which"; - echo " store rss channels in one line. One by one. The one line"; - echo " contains: name and URL of rss feed. For example:"; - echo; - echo " News Feed;https://newsfeed.example.org/rss"; -} -if [ ! -s ~/.newsfeed ]; then - help; - exit 1; -else - if [ ! "$1" ] || ([ "$1" != "--list" ] && \ - [ "$1" != "--check" ] && \ - [ "$1" != "--show" ] && \ - [ "$1" != "--open" ]); then - help; - exit 1; - fi - amountOfSubscriptions=$(cat ~/.newsfeed | wc -l); - i=1; - while [ $i -le $amountOfSubscriptions ]; do - newsfeedLine=$(sed -n "${i}p" ~/.newsfeed); - nameOfSubscription=$(echo $newsfeedLine | cut -d ";" -f 1); - rssLink=$(echo $newsfeedLine | cut -d ";" -f 2); - if [ "$1" ] && [ "$1" = "--list" ]; then - echo -e "${i}. ${nameOfSubscription}"; - elif [ "$1" ] && [ "$1" = "--check" ]; then - echo -e "${i}. ${nameOfSubscription}"; - echo -n "Getting news feed..."; - wget $rssLink -O /tmp/new_newsfeed_${i}.xml 2>/dev/null; - if [ $? -eq 0 ]; then echo "[ OK ]"; - else echo -e "\nThere is no Internet connection"; exit 1; fi - if [ -s /tmp/newsfeed_${i}.xml ]; then - amountOfNewNewses=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | grep '' | wc -l); - if [ $amountOfNewNewses -gt 0 ]; then - notify-send "$nameOfSubscription" "New $amountOfNewNewses newses" --icon=/usr/share/icons/rss.png; - j=1; - sleep 1; - while [ $j -le $amountOfNewNewses ]; do - news=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | \ - grep '<title>' | sed -n "${j}p" | sed 's/<title>//' | \ - sed 's/<\/title>//' | sed 's/[<>]//' | \ - sed 's/^[[:space:]]*//g'); - notify-send "newsfeed" "${nameOfSubscription}: ${news}" -t 10000 --icon=/usr/share/icons/rss.png; - sleep 1; - j=$((j + 1)); - done - fi - mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml; - else - mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml; - amountOfNews=$(grep '<title>' /tmp/newsfeed_${i}.xml | sed -n '2,$p' | wc -l); - if [ $amountOfNews -eq 0 ]; then - compressed=1; - amountOfNews=$(sed 's/<\/title>/\n/g' /tmp/newsfeed_${i}.xml | sed 's/<item>/\n/g' | grep '<title>' | wc -l) - fi - notify-send "$nameOfSubscription" "New $amountOfNews newses" --icon=/usr/share/icons/rss.png; - fi - fi - i=$((i + 1)); - done - if [ "$1" ] && [ "$1" = "--show" ] && [ "$2" ] && [ $2 -gt 0 ]; then - - #Parsing - #Thanks to the linuxhint.com for command: - #sed 's/^[[:space]]*//g' - #https://linuxhint.com/trim_string_bash - - if grep -q 'CDATA' /tmp/newsfeed_${2}.xml; then - sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \ - sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \ - sed 's/<title>//' | sed 's/"/"/g' | \ - sed 's/<!\[CDATA\[//g' | sed 's/\]\]>//g' | \ - sed 's/^[[:space:]]*//g' | nl | less; - else - sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \ - sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \ - sed 's/<title>//' | sed 's/"/"/g' | \ - sed 's/^[[:space:]]*//g' | nl | less; - fi - echo $2 > /tmp/lastShowedNewsFeed; - elif [ "$1" ] && [ "$1" = "--open" ] && [ "$2" ] && [ $2 -gt 0 ]; then - subscriptionNumber=$(cat /tmp/lastShowedNewsFeed); - if ! grep -q 'CDATA' /tmp/newsfeed_${subscriptionNumber}.xml; then - link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/title>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p") - else - link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/description>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p") - fi - exo-open --launch WebBrowser "$link"; - fi -fi diff --git a/tools/0/013/notifier b/tools/0/013/notifier deleted file mode 100755 index d658ba0..0000000 --- a/tools/0/013/notifier +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -source library.sh; - -if [ "$1" ]; then - case $1 in - "distro") if check_distro_version; then - msg=$(check_distro_version --print); - notify-send -i software-update-urgent "Distribution update" "New version (${msg}) of immudex is available to upgrade."; - else - msg=$(check_distro_version --print); - notify-send -i apply "Distribution update" "This (${msg}) is the latest version of immudex."; - fi;; - "packages") msg=$(sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;); - notify-send -i software-update-available "Packages update" "$msg";; - esac -fi - diff --git a/tools/0/013/padlock b/tools/0/013/padlock deleted file mode 100755 index bf50d1a..0000000 --- a/tools/0/013/padlock +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -launcher="/home/${USER}/Pulpit/Padlock.desktop"; - -function main_unlock() { - /usr/local/bin/immudex_crypt open $1; - index=$(basename $(/usr/local/bin/immudex_crypt list | grep "$1" | head -1 | awk '{printf $2}' | grep -o '[0-9]')); - #sudo mkdir -p /media/${USER}/$devName; - #sudo mount /dev/mapper/$devName /media/${USER}/$devName; - - xfce4-terminal --default-working-directory=/ic${index}; - #sed -i 's/prevent/allow/' ${launcher}; - sudo rm /usr/share/icons/padlock-icon.png; - sudo ln -s /usr/share/icons/changes-allow.png /usr/share/icons/padlock-icon.png; - -} - -function unlock() { - - cryptParts=$(sudo blkid | grep 'LUKS' | sed 's/://g' | awk '{printf $1" "}'); - if [ "$cryptParts" ]; then - if [ $(echo $cryptParts | wc -w) -gt 1 ]; then - select cryptPart in $cryptParts; do - main_unlock $cryptPart; - break; - done - else - main_unlock $cryptParts; - fi - else - echo -e "\e[31mThere is no LUKS partition to open.\e[0m"; - sleep 3; - fi -} - -function lock() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - if [ "$mountPoint" ]; then - if $(sudo lsof $mountPoint > /dev/null 2>&1); then - notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error; - else - sudo umount $mountPoint; - if [ $? -ne 0 ]; then - notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error; - fi - sudo cryptsetup close /dev/mapper/${dmDevice}; - fi - else - sudo cryptsetup close /dev/mapper/${dmDevice}; - fi - fi - done - fi - if ! $(df -h | grep -q '/dev/mapper'); then - #sed -i 's/allow/prevent/' ${launcher}; - sudo rm /usr/share/icons/padlock-icon.png; - sudo ln -s /usr/share/icons/changes-prevent.png /usr/share/icons/padlock-icon.png; - fi -} - -mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - -if [ "$mapperDeviceList" ]; then lock; -else unlock; -fi diff --git a/tools/0/013/secured-firefox b/tools/0/013/secured-firefox deleted file mode 100755 index 4041e89..0000000 --- a/tools/0/013/secured-firefox +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ ! -d /tmp/${USER} ]; then - mkdir /tmp/${USER} - cp -prvv /home/${USER}/.mozilla /tmp/${USER} -fi - -eth0=$(ip route show | grep 'default' | awk '{printf $5}'); -firejail --private=/tmp/${USER} --net=$eth0 /usr/bin/firefox diff --git a/tools/0/013/ytplay b/tools/0/013/ytplay deleted file mode 100755 index 41ea516..0000000 --- a/tools/0/013/ytplay +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "ytplay - script which could play a video or audio track from youtube"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " -s - search given keyword on youtube."; - echo " -v - play youtube video." - echo " -a - play only youtube video audiotrack"; - echo "Ommiting -s option, assume you are give a yt video link."; - echo "You have to put -v or -a before you paste a yt video link"; - echo "When you put keywords in -s option, you need to choose"; - echo "that you want listening an audiotrack (-a) oraz watch video (-v)"; - echo "Usage:"; - echo " $ ytplay -s -a [-f ytdl-format] 'lofi'"; - echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]"; - echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]"; - echo "You can search again the same keywords puting 'r' or 'R' instead"; - echo "of video numer"; -} - -function yt_search() { - query=$(echo $* | sed 's/ /+/g'); - echo -n "Getting youtube site with search results..."; - wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - - sed -i 's/,/\n/g' /tmp/yt.html; - - listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}'); - - numberOfListElements=$(echo $listOfVideos | wc -w); - i=1; - lp=1; - while [ $i -le $numberOfListElements ]; do - if [ $i -eq $numberOfListElements ]; then - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2='$'; - else - j=$((i + 1)); - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2=$(echo $listOfVideos | cut -d " " -f $j); - fi - #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then - # i=$((i + 1)); continue; - #else - title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8); - channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8); - duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4); - if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi - videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4); - if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then - echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}"; - echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv; - else - i=$((i + 1)); continue; - fi - #fi - i=$((i + 1)); - lp=$((lp + 1)); - done -} - -if [ "$1" ]; then - if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then - mode=$1; - shift; - link=$(echo $1 | sed 's@https://@@'); - if [ $# -gt 1 ]; then - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--ytdl-format=bestaudio"; - else - format="--ytdl-format=${1}"; - fi - fi - fi - elif [ "$1" = "-s" ]; then - if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi - if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi - - shift; - mode=$1; - if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--ytdl-format=bestaudio"; - else - format="--ytdl-format=${1}"; - fi - fi - while [ true ]; do - yt_search $*; - echo -n "Put number of which video you want to hear/watch: "; - read numberOfVideo; - if [[ $numberOfVideo -gt 0 ]]; then break; - elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then - continue; - else - help; - exit 1; - fi - done - title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3); - channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4); - duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5); - videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2); - clear; - echo -e "Title: ${GREEN}${title}${ENDCOLOR}"; - echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "===================================================================="; - link=${videoId}; - else - help; - exit 1; - fi - - if [ "$mode" = "-a" ]; then - if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi - mpv ${format} ytdl://${link}; - elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi -else - help; - exit 1; -fi diff --git a/tools/0/014/ytplay b/tools/0/014/ytplay deleted file mode 100755 index 0bb0c14..0000000 --- a/tools/0/014/ytplay +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "ytplay - script which could play a video or audio track from youtube"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " -s - search given keyword on youtube."; - echo " -v - play youtube video." - echo " -a - play only youtube video audiotrack"; - echo "Ommiting -s option, assume you are give a yt video link."; - echo "You have to put -v or -a before you paste a yt video link"; - echo "When you put keywords in -s option, you need to choose"; - echo "that you want listening an audiotrack (-a) oraz watch video (-v)"; - echo "Usage:"; - echo " $ ytplay -s -a [-f ytdl-format] 'lofi'"; - echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]"; - echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]"; - echo "You can search again the same keywords puting 'r' or 'R' instead"; - echo "of video numer"; -} - -function yt_search() { - query=$(echo $* | sed 's/ /+/g'); - echo -n "Getting youtube site with search results..."; - wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - - sed -i 's/,/\n/g' /tmp/yt.html; - - listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}'); - - numberOfListElements=$(echo $listOfVideos | wc -w); - i=1; - lp=1; - while [ $i -le $numberOfListElements ]; do - if [ $i -eq $numberOfListElements ]; then - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2='$'; - else - j=$((i + 1)); - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2=$(echo $listOfVideos | cut -d " " -f $j); - fi - #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then - # i=$((i + 1)); continue; - #else - title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8); - channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8); - duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4); - if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi - videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4); - if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then - echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}"; - echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv; - else - i=$((i + 1)); continue; - fi - #fi - i=$((i + 1)); - lp=$((lp + 1)); - done -} - -if [ "$1" ]; then - if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then - mode=$1; - shift; - link=$(echo $1 | sed 's@https://@@'); - if [ $# -gt 1 ]; then - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--no-video --ytdl-format=${1}"; - else - format="--ytdl-format=${1}"; - fi - fi - fi - elif [ "$1" = "-s" ]; then - if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi - if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi - - shift; - mode=$1; - if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--no-video --ytdl-format=${1}"; - else - format="--ytdl-format=${1}"; - fi - fi - while [ true ]; do - yt_search $*; - echo -n "Put number of which video you want to hear/watch: "; - read numberOfVideo; - if [[ $numberOfVideo -gt 0 ]]; then break; - elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then - continue; - else - help; - exit 1; - fi - done - title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3); - channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4); - duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5); - videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2); - clear; - echo -e "Title: ${GREEN}${title}${ENDCOLOR}"; - echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "===================================================================="; - link=${videoId}; - else - help; - exit 1; - fi - - if [ "$mode" = "-a" ]; then - if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi - mpv ${format} ytdl://${link}; - elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi -else - help; - exit 1; -fi diff --git a/tools/0/016/library.sh b/tools/0/016/library.sh deleted file mode 100755 index b2400f5..0000000 --- a/tools/0/016/library.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -function get_debian_branch() { - if grep -q 'bookworm' /etc/os-release; then - echo "testing"; - else - echo "stable"; - fi -} - -function get_machine_arch() { - arch=$(uname -m); - if [ "$arch" = "i686" ]; then - echo "32"; - else - echo "64"; - fi -} - -function check_distro_version() { - set -e - root="/run/live/medium"; - if [ -d ${root}/live ]; then - if [ -f ${root}/live/version ]; then - version=$(cat ${root}/live/version | sed 's/\.//g'); - else version="000"; - fi - BRANCH=$(get_debian_branch); - ARCH=$(get_machine_arch); - if [ ! -f /tmp/ltver ]; then - wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver; - fi - if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi; - newVersionTxt=$(cat /tmp/ltver); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if [ $version -lt $newVersionInt ]; then - exitcode=0; - else - exitcode=1; - fi - else - exitcode=255; - fi - if [ "$1" ] && [ "$1" = "--print" ]; then - echo $newVersionTxt; - return 0; - fi - return $exitcode; -} diff --git a/tools/0/017/run-thunderbird b/tools/0/017/run-thunderbird deleted file mode 100755 index c08389a..0000000 --- a/tools/0/017/run-thunderbird +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -export HOME=/ic0; -thunderbird; diff --git a/tools/0/020/immudex_crypt b/tools/0/020/immudex_crypt deleted file mode 100755 index 51f5e59..0000000 --- a/tools/0/020/immudex_crypt +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash - -function help() { - - echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions"; - echo "morketsmerke.org COPYLEFT @ 2023"; - echo "Options:"; - echo " list - displaing list of opened and available crypt_LUKS devices"; - echo " create - formatting device for crypt_LUKS"; - echo " open - opening crypt_LUKS device, after this device is ready to mount"; - echo " close - unmount and closing crypt_LUKS devices"; - echo "Using:"; - echo "$ immudex_crypt list"; - echo "$ immudex_crypt create <disk partition>"; - echo "$ immudex_crypt open <crypt_LUKS device>"; - echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]"; -} - -function list() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "Opened devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint"; - else - echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted"; - fi - fi - done - else - echo -e "No opened crypt devices was found"; - fi - echo "=============================================================="; - - luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "crypt_LUKS devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$luksDevicesList" ]; then - for lDevice in $luksDevicesList; do - echo -e "$lDevice"; - done - else - echo "No crypt device was found"; - fi - echo "=============================================================="; -} - -function open() { - - if [ $# -lt 1 ]; then help; exit 1; - else - index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1); - if [ "$index" ]; then - index=$((index + 1)); - else - index=0; - fi - sudo cryptsetup open $1 immudex_crypt${index}; - sudo mkdir -p /media/${USER}/immudex_crypt${index}; - dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2); - if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then - echo "Could not determine filesystem of unlocked device."; - echo -n "Format this device to ext4? (y/n): " - read format; - if [ "$format" = "y" ]; then - sudo mkfs.ext4 /dev/mapper/immudex_crypt${index}; - else - echo "Refuse to mount."; - sudo cryptsetup close immudex_crypt${index}; - exit 1; - fi - fi - sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index}; - if [ ! -e /ic${index} ]; then - sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index}; - fi - fi - -} - -function close() { - - if [ $# -lt 1 ]; then help; exit 1; - else - if [ $1 -ge 0 ] 2> /dev/null; then - cryptfsName="immudex_crypt${1}"; - elif echo $1 | grep -q 'ic'; then - cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')"; - else - cryptfsName=$1; - fi - if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - sudo umount -R $mountPoint; - sudo cryptsetup close ${cryptfsName}; - else - sudo cryptsetup close ${cryptfsName}; - fi - else - echo "Given devices isn't opened crypt device or it was closed before"; - fi - fi -} - -function create() { - if [ $# -lt 1 ]; then help; exit 1; - else - sudo cryptsetup -y -v luksFormat $1; - fi -} - -if [ "$1" ]; then - - case $1 in - "list") list;; - "open") if [ "$2" ]; then open $2; - else help; exit 1; - fi;; - "close") if [ "$2" ]; then close $2; - else help; exit 1; - fi;; - "create") if [ "$2" ]; then create $2 && open $2; - else help; exit 1; - fi;; - *) help;; - esac -else - help; exit 1; -fi diff --git a/tools/0/020/immudex_install b/tools/0/020/immudex_install deleted file mode 100755 index b74ab2f..0000000 --- a/tools/0/020/immudex_install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -ENDCOLOR="\e[0m"; - -while [ true ]; do - echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}"; - echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}"; - echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}"; - read ans; - if [ "$ans" = "y" ]; then break; - elif [ "$ans" = "n" ]; then exit 1; - fi -done - -set -e - -function selectDisk() { - disks=$(lsblk | grep 'disk' | awk '{printf $1" "}'); - if [ $(echo $disks | wc -w) -gt 1 ]; then - select drive in $disks; do - echo $drive; - break; - done - else - echo $disks | awk '{printf $1}'; - fi -} - -if $(sudo efibootmgr > /dev/null 2>&1); then -#uefi installation - #partitioning - echo -n "Installation immudex in EFI mode ... "; - disk=$(selectDisk); - originDisk=$disk; - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1; - sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1; - - #Setting label for partition - sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1; - - #mount root partition - sudo mount /dev/${disk}2 /media > /dev/null 2>&1; - - #creating directories for efi partition - sudo mkdir -p /media/boot/efi > /dev/null 2>&1; - - #mount efi partition - sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying whole iso image to the second partition - sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1; - - #removing unnecessary directories from second partition - sudo rm -rf /media/isolinux > /dev/null 2>&1; - sudo rm -rf /media/EFI > /dev/null 2>&1; - - #GRUB Installation - if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then - target="i386-efi"; - else - target="x86_64-efi"; - fi - sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1; - - #Adding entry to EFI Firmware - sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1; - - #Umount all mounted filesystems - sudo umount -R /media > /dev/null 2>&1; - - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - -else -#mbr installation - echo -n "Installation immudex in BIOS mode ... "; - - #partitioning - disk=$(selectDisk); - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1; - - #Setting label for partition is necessary for extlinux bootloader - sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1; - - #mount partition in /media directory - sudo mount /dev/${disk}1 /media > /dev/null 2>&1; - - #Creating directory for extlinux - sudo mkdir /media/extlinux > /dev/null 2>&1; - - #Instalation extlinux files in abovementioned directory - sudo extlinux --install /media/extlinux > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying live directory from iso image to partition - sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1; - - #installation extlinux MBR on first sector of hard drive (whole device) - sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1; - - #creating extlinux configuration file - cat > extlinux.conf <<EOF -default immudex -label immudex -kernel /live/vmlinuz -append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor -EOF - sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1; - rm extlinux.conf; - - #Unmounting filesystems - sudo umount /media > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi -fi diff --git a/tools/0/020/immudex_upgrade b/tools/0/020/immudex_upgrade deleted file mode 100755 index 42f157f..0000000 --- a/tools/0/020/immudex_upgrade +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash - -set -e - -source library.sh - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; -root="/run/live/medium"; - -function help() { - echo "immudex_upgrade - script for searching upgrades and upgrade immudex"; - echo "morketsmerke.org @ 2023"; - echo "Options:"; - echo " --check --print - check there are upgrades for immudex"; - echo " --upgrade - check there are upgrades for immudex and install them."; - echo " If there is no new version, script will propose refreshing"; - echo " current immudex installation, its helpful when you tried"; - echo " remaster immudex and you get any trouble with this". - echo " --version - getting latest version of immudex"; - echo " --branch <stable/testing> - change immudex branch"; - echo " Switch between stable or testing version and vice versa" -} - -function main_upgrade() { - set -e - ARCH=$(get_machine_arch); - if [ ! "$BRANCH" ]; then - BRANCH=$(get_debian_branch); - fi - rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}'); - sudo mount $rootPart $1 -o remount,rw; - sudo rm -f ${1}/live/*; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd; - sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz; - echo "$2" > /tmp/version; - sudo cp /tmp/version ${1}/live; -} - -if [ "$1" ] && [ "$1" = "--check" ]; then - if [ "$2" ] && [ "$2" = "--print" ]; then - newVersion=$(check_distro_version --print); - if check_distro_version; then - echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}"; - else - echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}"; - fi - fi -elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - newVersionTxt=$(check_distro_version --print); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if check_distro_version; then - echo -en "${YELLOW}New version " - echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) " - echo -e "of immudex is available.${ENDCOLOR}"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Upgrading immudex to the newest version..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}"; - echo -e "${YELLOW}but you can copy fresh system files from latest iso image"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Refreshing immudex to the latest iso image..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - exit 0; - fi -elif [ "$1" ] && [ "$1" = "--version" ]; then - stable64=$(curl https://ftp.morketsmerke.org/immudex/stable/upgrades/latest/64/version 2>/dev/null) - stable32=$(curl https://ftp.morketsmerke.org/immudex/stable/upgrades/latest/32/version 2>/dev/null) - testing64=$(curl https://ftp.morketsmerke.org/immudex/testing/upgrades/latest/64/version 2>/dev/null) - testing32=$(curl https://ftp.morketsmerke.org/immudex/testing/upgrades/latest/32/version 2>/dev/null) - branch=$(get_debian_branch); - localVer=$(cat /run/live/medium/live/version); - if [ "$(uname -m)" = "x86_64" ]; then - arch="amd64"; - stable=$stable64; - testing=$testing64; - else - arch="i386"; - stable=$stable32; - testing=$testing32; - fi - echo "Arch: $arch"; - echo "Local: ${localVer} (${branch})"; - echo "Stable: $stable"; - echo "Testing: $testing"; -elif [ "$1" ] && [ "$1" = "--branch" ]; then - if [ "$2" ] && ([ "$2" = "stable" ] || [ "$2" = "testing" ]); then - BRANCH=$2; - ARCH=$(get_machine_arch); - export $BRANCH; - echo -en "${YELLOW}Do you really want change immudex branch (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Changing immudex branch to ${BRANCH}..."; - newVersionTxt=$(curl https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version 2>/dev/null); - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - help; exit 1; - fi -else - help; - exit 1; -fi diff --git a/tools/0/021/create_media b/tools/0/021/create_media deleted file mode 100755 index 9471ff1..0000000 --- a/tools/0/021/create_media +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "create_media - script used for write iso image to usb drive(mainly)"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " --i386-efi - creating 32-bit EFI usb drive with iso image"; - echo " (comapatible with immudex only iso images)"; - echo "Usage:"; - echo " $ create_media [--i386-efi] <usb_disk> <iso_image>"; -} - -if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi -if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then - disk=$1; shift; -else - help; - exit 1; -fi -if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then - iso=$1; -else - help; - exit 1; -fi - -if [ "$target" ]; then - echo -n "Writing zeros to 1st megabyte on disk..."; - sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating MS-DOS partitionig scheme on disk..."; - sudo parted $disk mklabel msdos > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating FAT-32 partition..."; - sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating VFAT filesystem on partition..."; - sudo mkfs.vfat ${disk}1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/usb directory..."; - sudo mkdir /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting VFAT partition on /mnt/usb..."; - sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Instalation GRUB on disk..."; - sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/iso directory..."; - sudo mkdir /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting iso file on /mnt/iso..."; - sudo mount $iso /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying grub config files to the disk..."; - sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1; - sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying immudex files to the disk..."; - sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating empty DEBIAN file..."; - sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Umounting all mounted filesystems..."; - sudo umount /mnt/* > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -else - echo -n "Writing zeros to 1st megabyte on disk..."; - sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Writing iso image to the disk..." - sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -fi diff --git a/tools/0/021/immudex_install b/tools/0/021/immudex_install deleted file mode 100755 index 7d10bd1..0000000 --- a/tools/0/021/immudex_install +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -ENDCOLOR="\e[0m"; - -while [ true ]; do - echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}"; - echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}"; - echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}"; - read ans; - if [ "$ans" = "y" ]; then break; - elif [ "$ans" = "n" ]; then exit 1; - fi -done - -set -e - -function selectDisk() { - disks=$(lsblk | grep 'disk' | awk '{printf $1" "}'); - if [ $(echo $disks | wc -w) -gt 1 ]; then - select drive in $disks; do - echo $drive; - break; - done - else - echo $disks | awk '{printf $1}'; - fi -} - -if $(sudo efibootmgr > /dev/null 2>&1); then -#uefi installation - #partitioning - echo -n "Installation immudex in EFI mode ... "; - disk=$(selectDisk); - originDisk=$disk; - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1; - sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1; - - #Setting label for partition - sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1; - - #mount root partition - sudo mount /dev/${disk}2 /media > /dev/null 2>&1; - - #creating directories for efi partition - sudo mkdir -p /media/boot/efi > /dev/null 2>&1; - - #mount efi partition - sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying whole iso image to the second partition - sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1; - - sudo sed -i 's/bootfrom=removable //g' /media/boot/grub/grub.cfg; - - #removing unnecessary directories from second partition - sudo rm -rf /media/isolinux > /dev/null 2>&1; - sudo rm -rf /media/EFI > /dev/null 2>&1; - - #GRUB Installation - if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then - target="i386-efi"; - else - target="x86_64-efi"; - fi - sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1; - - #Adding entry to EFI Firmware - sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1; - - #Umount all mounted filesystems - sudo umount -R /media > /dev/null 2>&1; - - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - -else -#mbr installation - echo -n "Installation immudex in BIOS mode ... "; - - #partitioning - disk=$(selectDisk); - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1; - - #Setting label for partition is necessary for extlinux bootloader - sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1; - - #mount partition in /media directory - sudo mount /dev/${disk}1 /media > /dev/null 2>&1; - - #Creating directory for extlinux - sudo mkdir /media/extlinux > /dev/null 2>&1; - - #Instalation extlinux files in abovementioned directory - sudo extlinux --install /media/extlinux > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying live directory from iso image to partition - sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1; - - #installation extlinux MBR on first sector of hard drive (whole device) - sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1; - - #creating extlinux configuration file - cat > extlinux.conf <<EOF -default immudex -label immudex -kernel /live/vmlinuz -append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor -EOF - sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1; - rm extlinux.conf; - - #Unmounting filesystems - sudo umount /media > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi -fi diff --git a/tools/0/021/meteo b/tools/0/021/meteo deleted file mode 100755 index e447a1e..0000000 --- a/tools/0/021/meteo +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -function help() { - echo "meteo - prognoza pogody z meteo.icm.edu.pl" - echo "morketsmerke.org @ 2023"; - echo "Opcje:"; - echo " -h - legenda, pozwalająca na odczytanie prognozy"; - echo "Użycie:"; - echo "$ meteo <miasto>"; -} - -rm /tmp/meteo*; - -if [ "$1" ] && [ "$1" = "-h" ]; then - xdg-open /usr/share/meteo/leg60.png; -elif [ "$1" ]; then - if [ ! "$2" ]; then prognoza=60; - else prognoza=$2; fi - - miasto=$(echo "$1" | sed -e 's/ą/a/g' -e 's/ę/e/g' -e 's/ć/c/g' -e 's/ż/z/g' -e 's/ś/s/g' -e 's/ź/z/g' -e 's/ń/n/g' -e 's/ó/o/g' -e 's/ł/l/g'); - #miasto=${miasto^}; - - wget m.meteo.pl/${miasto}/${prognoza} -O /tmp/meteo 2>/dev/null; - link=$(grep "image_${prognoza}" /tmp/meteo | cut -d '"' -f 2); - wget $link -O /tmp/meteo_${miasto}.png 2>/dev/null; - xdg-open /tmp/meteo_${miasto}.png; -else - help; - exit 1; -fi diff --git a/tools/0/022/immudex_install b/tools/0/022/immudex_install deleted file mode 100755 index 1994533..0000000 --- a/tools/0/022/immudex_install +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -ENDCOLOR="\e[0m"; - -while [ true ]; do - echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}"; - echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}"; - echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}"; - read ans; - if [ "$ans" = "y" ]; then break; - elif [ "$ans" = "n" ]; then exit 1; - fi -done - -set -e - -function selectDisk() { - disks=$(lsblk | grep 'disk' | awk '{printf $1" "}'); - if [ $(echo $disks | wc -w) -gt 1 ]; then - select drive in $disks; do - echo $drive; - break; - done - else - echo $disks | awk '{printf $1}'; - fi -} - -if $(sudo efibootmgr > /dev/null 2>&1); then -#uefi installation - #partitioning - echo -n "Installation immudex in EFI mode ... "; - disk=$(selectDisk); - originDisk=$disk; - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1; - sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1; - - #Setting label for partition - sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1; - - #mount root partition - sudo mount /dev/${disk}2 /media > /dev/null 2>&1; - - #creating directories for efi partition - sudo mkdir -p /media/boot/efi > /dev/null 2>&1; - - #mount efi partition - sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying whole iso image to the second partition - sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1; - - sudo sed -i '/set\ timeout=/ s/30/5/' /media/boot/grub/grub.cfg; - sudo sed -i 's/bootfrom=removable //g' /media/boot/grub/grub.cfg; - - #removing unnecessary directories from second partition - sudo rm -rf /media/isolinux > /dev/null 2>&1; - sudo rm -rf /media/EFI > /dev/null 2>&1; - - #GRUB Installation - if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then - target="i386-efi"; - else - target="x86_64-efi"; - fi - sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1; - - #Adding entry to EFI Firmware - sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1; - - #Umount all mounted filesystems - sudo umount -R /media > /dev/null 2>&1; - - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - -else -#mbr installation - echo -n "Installation immudex in BIOS mode ... "; - - #partitioning - disk=$(selectDisk); - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1; - - #Setting label for partition is necessary for extlinux bootloader - sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1; - - #mount partition in /media directory - sudo mount /dev/${disk}1 /media > /dev/null 2>&1; - - #Creating directory for extlinux - sudo mkdir /media/extlinux > /dev/null 2>&1; - - #Instalation extlinux files in abovementioned directory - sudo extlinux --install /media/extlinux > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying live directory from iso image to partition - sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1; - - #installation extlinux MBR on first sector of hard drive (whole device) - sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1; - - #creating extlinux configuration file - cat > extlinux.conf <<EOF -default immudex -label immudex -kernel /live/vmlinuz -append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor -EOF - sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1; - rm extlinux.conf; - - #Unmounting filesystems - sudo umount /media > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi -fi diff --git a/tools/0/023/create_media b/tools/0/023/create_media deleted file mode 100755 index 9471ff1..0000000 --- a/tools/0/023/create_media +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "create_media - script used for write iso image to usb drive(mainly)"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " --i386-efi - creating 32-bit EFI usb drive with iso image"; - echo " (comapatible with immudex only iso images)"; - echo "Usage:"; - echo " $ create_media [--i386-efi] <usb_disk> <iso_image>"; -} - -if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi -if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then - disk=$1; shift; -else - help; - exit 1; -fi -if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then - iso=$1; -else - help; - exit 1; -fi - -if [ "$target" ]; then - echo -n "Writing zeros to 1st megabyte on disk..."; - sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating MS-DOS partitionig scheme on disk..."; - sudo parted $disk mklabel msdos > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating FAT-32 partition..."; - sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating VFAT filesystem on partition..."; - sudo mkfs.vfat ${disk}1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/usb directory..."; - sudo mkdir /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting VFAT partition on /mnt/usb..."; - sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Instalation GRUB on disk..."; - sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/iso directory..."; - sudo mkdir /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting iso file on /mnt/iso..."; - sudo mount $iso /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying grub config files to the disk..."; - sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1; - sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying immudex files to the disk..."; - sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating empty DEBIAN file..."; - sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Umounting all mounted filesystems..."; - sudo umount /mnt/* > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -else - echo -n "Writing zeros to 1st megabyte on disk..."; - sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Writing iso image to the disk..." - sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -fi diff --git a/tools/0/023/immudex_branch b/tools/0/023/immudex_branch deleted file mode 100755 index 048b5db..0000000 --- a/tools/0/023/immudex_branch +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -if grep -q 'bookworm' /etc/os-release; then - echo -n '-testing'; -else - echo -n '-stable'; -fi diff --git a/tools/0/023/immudex_crypt b/tools/0/023/immudex_crypt deleted file mode 100755 index 51f5e59..0000000 --- a/tools/0/023/immudex_crypt +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash - -function help() { - - echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions"; - echo "morketsmerke.org COPYLEFT @ 2023"; - echo "Options:"; - echo " list - displaing list of opened and available crypt_LUKS devices"; - echo " create - formatting device for crypt_LUKS"; - echo " open - opening crypt_LUKS device, after this device is ready to mount"; - echo " close - unmount and closing crypt_LUKS devices"; - echo "Using:"; - echo "$ immudex_crypt list"; - echo "$ immudex_crypt create <disk partition>"; - echo "$ immudex_crypt open <crypt_LUKS device>"; - echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]"; -} - -function list() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "Opened devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint"; - else - echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted"; - fi - fi - done - else - echo -e "No opened crypt devices was found"; - fi - echo "=============================================================="; - - luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "crypt_LUKS devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$luksDevicesList" ]; then - for lDevice in $luksDevicesList; do - echo -e "$lDevice"; - done - else - echo "No crypt device was found"; - fi - echo "=============================================================="; -} - -function open() { - - if [ $# -lt 1 ]; then help; exit 1; - else - index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1); - if [ "$index" ]; then - index=$((index + 1)); - else - index=0; - fi - sudo cryptsetup open $1 immudex_crypt${index}; - sudo mkdir -p /media/${USER}/immudex_crypt${index}; - dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2); - if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then - echo "Could not determine filesystem of unlocked device."; - echo -n "Format this device to ext4? (y/n): " - read format; - if [ "$format" = "y" ]; then - sudo mkfs.ext4 /dev/mapper/immudex_crypt${index}; - else - echo "Refuse to mount."; - sudo cryptsetup close immudex_crypt${index}; - exit 1; - fi - fi - sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index}; - if [ ! -e /ic${index} ]; then - sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index}; - fi - fi - -} - -function close() { - - if [ $# -lt 1 ]; then help; exit 1; - else - if [ $1 -ge 0 ] 2> /dev/null; then - cryptfsName="immudex_crypt${1}"; - elif echo $1 | grep -q 'ic'; then - cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')"; - else - cryptfsName=$1; - fi - if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - sudo umount -R $mountPoint; - sudo cryptsetup close ${cryptfsName}; - else - sudo cryptsetup close ${cryptfsName}; - fi - else - echo "Given devices isn't opened crypt device or it was closed before"; - fi - fi -} - -function create() { - if [ $# -lt 1 ]; then help; exit 1; - else - sudo cryptsetup -y -v luksFormat $1; - fi -} - -if [ "$1" ]; then - - case $1 in - "list") list;; - "open") if [ "$2" ]; then open $2; - else help; exit 1; - fi;; - "close") if [ "$2" ]; then close $2; - else help; exit 1; - fi;; - "create") if [ "$2" ]; then create $2 && open $2; - else help; exit 1; - fi;; - *) help;; - esac -else - help; exit 1; -fi diff --git a/tools/0/023/immudex_upgrade b/tools/0/023/immudex_upgrade deleted file mode 100755 index 3bf1ca0..0000000 --- a/tools/0/023/immudex_upgrade +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/bash - -set -e - -source library.sh - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; -root="/run/live/medium"; - -function help() { - echo "immudex_upgrade - script for searching upgrades and upgrade immudex"; - echo "morketsmerke.org @ 2023"; - echo "Options:"; - echo " --check --print - check there are upgrades for immudex"; - echo " --upgrade - check there are upgrades for immudex and install them."; - echo " If there is no new version, script will propose refreshing"; - echo " current immudex installation, its helpful when you tried"; - echo " remaster immudex and you get any trouble with this". - echo " --version - getting latest version of immudex"; - echo " --branch <stable/testing> - change immudex branch"; - echo " Switch between stable or testing version and vice versa" -} - -function main_upgrade() { - set -e - ARCH=$(get_machine_arch); - if [ ! "$BRANCH" ]; then - BRANCH=$(get_debian_branch); - fi - MIRROR=$(check_mirror); - rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}'); - sudo mount $rootPart $1 -o remount,rw; - sudo rm -f ${1}/live/*; - sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs; - sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd; - sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz; - echo "$2" > /tmp/version; - sudo cp /tmp/version ${1}/live; -} - -function check_mirror() { - mirrorList=("sourceforge.net=https://sourceforge.net/projects/immudex/files", "plikownia.zsgronowo.edu.pl=https://plikownia.zsgronowo.edu.pl/pliki/Nauczyciele/Administrator/files", "ftp.morketsmerke.org=https://ftp.morketsmerke.org"); - for i in ${mirrorList[@]}; do - name=$(echo $i | cut -d "=" -f 1); - address=$(echo $i | cut -d "=" -f 2 | sed 's/,//'); - echo -en "Checking is ${YELLOW}${name}${ENDCOLOR} available..." 1>&2; - curl ${address}/immudex/stable/upgrades/latest/64/version > /dev/null 2>&1; - if [ $? -eq 0 ]; then - echo -e "[ ${GREEN}OK${ENDCOLOR} ]" 1>&2; - mirror=$address; - mirror_name=$name; - else - echo -e "[ ${RED}FAIL${ENDCOLOR} ]" 1>&2; - fi - done - if [ "$mirror" ]; then - echo "Choosing $mirror_name" 1>&2; - echo $mirror; - else exit 1; fi -} - -if [ "$1" ] && [ "$1" = "--check" ]; then - if [ "$2" ] && [ "$2" = "--print" ]; then - newVersion=$(check_distro_version --print); - if check_distro_version; then - echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}"; - else - echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}"; - fi - elif [ "$2" = "--mirror" ]; then - mirror=$(check_mirror); - echo $mirror; - fi -elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - newVersionTxt=$(check_distro_version --print); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if check_distro_version; then - echo -en "${YELLOW}New version " - echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) " - echo -e "of immudex is available.${ENDCOLOR}"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo "Upgrading immudex to the newest version..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "Upgrading immudex to the newest version...[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}"; - echo -e "${YELLOW}but you can copy fresh system files from latest iso image"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo "Refreshing immudex to the latest iso image..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "Refreshing immudex to the latest iso image...[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - exit 0; - fi -elif [ "$1" ] && [ "$1" = "--version" ]; then - MIRROR=$(check_mirror); - stable64=$(curl ${MIRROR}/immudex/stable/upgrades/latest/64/version 2>/dev/null) - stable32=$(curl ${MIRROR}/immudex/stable/upgrades/latest/32/version 2>/dev/null) - testing64=$(curl ${MIRROR}/immudex/testing/upgrades/latest/64/version 2>/dev/null) - testing32=$(curl ${MIRROR}/immudex/testing/upgrades/latest/32/version 2>/dev/null) - branch=$(get_debian_branch); - localVer=$(cat /run/live/medium/live/version); - if [ "$(uname -m)" = "x86_64" ]; then - arch="amd64"; - stable=$stable64; - testing=$testing64; - else - arch="i386"; - stable=$stable32; - testing=$testing32; - fi - echo "Arch: $arch"; - echo "Local: ${localVer} (${branch})"; - echo "Stable: $stable"; - echo "Testing: $testing"; -elif [ "$1" ] && [ "$1" = "--branch" ]; then - if [ "$2" ] && ([ "$2" = "stable" ] || [ "$2" = "testing" ]); then - BRANCH=$2; - ARCH=$(get_machine_arch); - export $BRANCH; - echo -en "${YELLOW}Do you really want change immudex branch (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo "Changing immudex branch to ${BRANCH}..."; - newVersionTxt=$(curl https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version 2>/dev/null); - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "Changing immudex branch to ${BRANCH}...[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - help; exit 1; - fi -else - help; - exit 1; -fi diff --git a/tools/0/023/import_gpgkeys b/tools/0/023/import_gpgkeys deleted file mode 100755 index dfb9ff9..0000000 --- a/tools/0/023/import_gpgkeys +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ -f ~/public.gpg ] && [ -f ~/private.gpg ]; then - gpg --import ~/public.gpg - gpg --import ~/private.gpg - userId=$(gpg --list-keys | sed -nr 's/.+<(.*)>$/\1/p'); - gpg --edit-key $userId; -fi diff --git a/tools/0/023/import_sshkeys b/tools/0/023/import_sshkeys deleted file mode 100755 index 3cb56ad..0000000 --- a/tools/0/023/import_sshkeys +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -if $(ls $HOME | grep -q '.*_rsa.*'); then - if [ -d /home/$USER/.ssh ]; then - cp -v ~/*_rsa* /home/$USER/.ssh; - else - mkdir /home/$USER/.ssh; - chmod 700 /home/$USER/.ssh; - cp -v ~/*_rsa* /home/$USER/.ssh; - fi -fi - diff --git a/tools/0/023/library.sh b/tools/0/023/library.sh deleted file mode 100755 index b2400f5..0000000 --- a/tools/0/023/library.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -function get_debian_branch() { - if grep -q 'bookworm' /etc/os-release; then - echo "testing"; - else - echo "stable"; - fi -} - -function get_machine_arch() { - arch=$(uname -m); - if [ "$arch" = "i686" ]; then - echo "32"; - else - echo "64"; - fi -} - -function check_distro_version() { - set -e - root="/run/live/medium"; - if [ -d ${root}/live ]; then - if [ -f ${root}/live/version ]; then - version=$(cat ${root}/live/version | sed 's/\.//g'); - else version="000"; - fi - BRANCH=$(get_debian_branch); - ARCH=$(get_machine_arch); - if [ ! -f /tmp/ltver ]; then - wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver; - fi - if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi; - newVersionTxt=$(cat /tmp/ltver); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if [ $version -lt $newVersionInt ]; then - exitcode=0; - else - exitcode=1; - fi - else - exitcode=255; - fi - if [ "$1" ] && [ "$1" = "--print" ]; then - echo $newVersionTxt; - return 0; - fi - return $exitcode; -} diff --git a/tools/0/023/meteo b/tools/0/023/meteo deleted file mode 100755 index e447a1e..0000000 --- a/tools/0/023/meteo +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -function help() { - echo "meteo - prognoza pogody z meteo.icm.edu.pl" - echo "morketsmerke.org @ 2023"; - echo "Opcje:"; - echo " -h - legenda, pozwalająca na odczytanie prognozy"; - echo "Użycie:"; - echo "$ meteo <miasto>"; -} - -rm /tmp/meteo*; - -if [ "$1" ] && [ "$1" = "-h" ]; then - xdg-open /usr/share/meteo/leg60.png; -elif [ "$1" ]; then - if [ ! "$2" ]; then prognoza=60; - else prognoza=$2; fi - - miasto=$(echo "$1" | sed -e 's/ą/a/g' -e 's/ę/e/g' -e 's/ć/c/g' -e 's/ż/z/g' -e 's/ś/s/g' -e 's/ź/z/g' -e 's/ń/n/g' -e 's/ó/o/g' -e 's/ł/l/g'); - #miasto=${miasto^}; - - wget m.meteo.pl/${miasto}/${prognoza} -O /tmp/meteo 2>/dev/null; - link=$(grep "image_${prognoza}" /tmp/meteo | cut -d '"' -f 2); - wget $link -O /tmp/meteo_${miasto}.png 2>/dev/null; - xdg-open /tmp/meteo_${miasto}.png; -else - help; - exit 1; -fi diff --git a/tools/0/023/morketsmerke b/tools/0/023/morketsmerke deleted file mode 100755 index 7193473..0000000 --- a/tools/0/023/morketsmerke +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -function help() { - echo "======================================================================"; - echo "morketsmerke - script for fetch and adjust morketsmerke.net site"; - echo "as offline available source of information."; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo; - echo "Options:"; - echo " --browser - launching fetched site in default application for open" - echo " html sites"; - echo " -[-]<any_other_chars_or_strings> - print this message"; - echo "By default script open downloaded site in terminal via W3M browser with"; - echo "monochrome mode"; - echo; - echo "Usage:"; - echo " $ morketsmerke [--browser]"; -} - -function R() { - - if [ "$path" ]; then path=${path}/${1}; - else path=$1; - fi - - fileList=$(ls $path); - for file in $fileList; do - if [ -d ${path}/${file} ]; then R ${file}; - else - sed -i 's@https://morketsmerke.github.io/@/usr/share/doc/morketsmerke/index.html@' ${path}/${file}; - sed -i 's@https://morketsmerke.github.io@/usr/share/doc/morketsmerke/index.html@' ${path}/${file}; - sed -i 's@/style.css@/usr/share/doc/morketsmerke/style.css@' ${path}/${file}; - fi - done - path=$(echo $path | sed "s@/$1@@") - -} - -function install_morketsmerke() { - - if [ -d morketsmerke.github.io ]; then rm -rf morketsmerke.github.io; fi - if [ ! -d morketsmerke.github.io ]; then - git clone https://github.com/morketsmerke/morketsmerke.github.io; - else - exit 1; - fi - - R morketsmerke.github.io - - if [ -d /usr/share/doc/morketsmerke ]; then - sudo rm -rf /usr/share/doc/morketsmerke; - fi - - sudo mv morketsmerke.github.io /usr/share/doc/morketsmerke - -} - -/usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1; -if [ $? -eq 0 ]; then install_morketsmerke; fi - -morketsmerke_path=/usr/share/doc/morketsmerke; - -if [ "$1" ] && [ "$1" = "--browser" ]; then - xdg-open ${morketsmerke_path}/index.html; -elif [ "$1" ]; then - help; - exit 1; -else - w3m -M ${morketsmerke_path}/index.html; -fi diff --git a/tools/0/023/motd2 b/tools/0/023/motd2 deleted file mode 100755 index da11dcc..0000000 --- a/tools/0/023/motd2 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -/usr/bin/figlet immudex; -echo; -echo "Today is: $(date)"; -echo; -echo "System summary: "; -cpuIdle=$(vmstat | tail -1 | awk '{printf $15}'); -cpuUsage=$((100 - $cpuIdle)); -echo -e " \tCPU: ${cpuUsage}%"; -echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free"; -if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then - i=1; - echo -e " \tCRYPT_PARTi: Free/Total (Usage%)"; - amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}'); - while [ $i -le $amountOfDisks ]; do - diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}'); - diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}'); - diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}'); - #FCP = First Crypt Partition - echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)"; - i=$((i + 1)); - done -else - echo -e " \tCRYPT_PART: N/A"; -fi -echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')"; -utime=$(uptime | awk '{printf $3}' | sed 's/,//'); -if $(echo $utime | grep -q ":"); then - echo -e " \tUPTIME: ${utime}"; -else - echo -e " \tUPTIME: 0:${utime}"; -fi -echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])"; -echo; -echo -e "morketsmerke.org @ 2023 https://github.com/xf0r3m/immudex"; -echo; -#/usr/local/bin/immudex_upgrade --check --print; -#if [ $? -ne 0 ]; then -# echo -e "\e[31mThere is no internet connection or internal error.\e[0m"; -# if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then -# rm -f /tmp/feed.xml; -# fi -#else -# if [ "$USER" = "xf0r3m" ]; then -# sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log; -# fi -#fi -echo "===================================================================="; diff --git a/tools/0/023/newsfeed b/tools/0/023/newsfeed deleted file mode 100755 index a3a426a..0000000 --- a/tools/0/023/newsfeed +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -function help() { - echo "newsfeed - fetch and browse news feed from rss and atom channels"; - echo "morketsmerke.net; COPYLEFT @ 2022"; - echo; - echo "Options:"; - echo " --list - shows numbered list of names, saved in ~/.newsfeed names and"; - echo " URL of rss channels"; - echo " --check - fetching new rss channel file from source"; - echo " --show <number_of_channel> - shows numbered list of news titles."; - echo " Number of channel you can get from --list option."; - echo " --open <number_of_title> - open web browser on link, which are under"; - echo " titles of news on rss channel. Number of title you can get"; - echo " from --show option. This option based on the last showed rss"; - echo " channel feed."; - echo; - echo "The ~/.newsfeed file:"; - echo " This file is simple csv (semicolon separated values) file which"; - echo " store rss channels in one line. One by one. The one line"; - echo " contains: name and URL of rss feed. For example:"; - echo; - echo " News Feed;https://newsfeed.example.org/rss"; -} -if [ ! -s ~/.newsfeed ]; then - help; - exit 1; -else - if [ ! "$1" ] || ([ "$1" != "--list" ] && \ - [ "$1" != "--check" ] && \ - [ "$1" != "--show" ] && \ - [ "$1" != "--open" ]); then - help; - exit 1; - fi - amountOfSubscriptions=$(cat ~/.newsfeed | wc -l); - i=1; - while [ $i -le $amountOfSubscriptions ]; do - newsfeedLine=$(sed -n "${i}p" ~/.newsfeed); - nameOfSubscription=$(echo $newsfeedLine | cut -d ";" -f 1); - rssLink=$(echo $newsfeedLine | cut -d ";" -f 2); - if [ "$1" ] && [ "$1" = "--list" ]; then - echo -e "${i}. ${nameOfSubscription}"; - elif [ "$1" ] && [ "$1" = "--check" ]; then - echo -e "${i}. ${nameOfSubscription}"; - echo -n "Getting news feed..."; - wget $rssLink -O /tmp/new_newsfeed_${i}.xml 2>/dev/null; - if [ $? -eq 0 ]; then echo "[ OK ]"; - else echo -e "\nThere is no Internet connection"; exit 1; fi - if [ -s /tmp/newsfeed_${i}.xml ]; then - amountOfNewNewses=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | grep '<title>' | wc -l); - if [ $amountOfNewNewses -gt 0 ]; then - notify-send "$nameOfSubscription" "New $amountOfNewNewses newses" --icon=/usr/share/icons/rss.png; - j=1; - sleep 1; - while [ $j -le $amountOfNewNewses ]; do - news=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | \ - grep '<title>' | sed -n "${j}p" | sed 's/<title>//' | \ - sed 's/<\/title>//' | sed 's/[<>]//' | \ - sed 's/^[[:space:]]*//g'); - notify-send "newsfeed" "${nameOfSubscription}: ${news}" -t 10000 --icon=/usr/share/icons/rss.png; - sleep 1; - j=$((j + 1)); - done - fi - mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml; - else - mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml; - amountOfNews=$(grep '<title>' /tmp/newsfeed_${i}.xml | sed -n '2,$p' | wc -l); - if [ $amountOfNews -eq 0 ]; then - compressed=1; - amountOfNews=$(sed 's/<\/title>/\n/g' /tmp/newsfeed_${i}.xml | sed 's/<item>/\n/g' | grep '<title>' | wc -l) - fi - notify-send "$nameOfSubscription" "New $amountOfNews newses" --icon=/usr/share/icons/rss.png; - fi - fi - i=$((i + 1)); - done - if [ "$1" ] && [ "$1" = "--show" ] && [ "$2" ] && [ $2 -gt 0 ]; then - - #Parsing - #Thanks to the linuxhint.com for command: - #sed 's/^[[:space]]*//g' - #https://linuxhint.com/trim_string_bash - - if grep -q 'CDATA' /tmp/newsfeed_${2}.xml; then - sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \ - sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \ - sed 's/<title>//' | sed 's/"/"/g' | \ - sed 's/<!\[CDATA\[//g' | sed 's/\]\]>//g' | \ - sed 's/^[[:space:]]*//g' | nl | less; - else - sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \ - sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \ - sed 's/<title>//' | sed 's/"/"/g' | \ - sed 's/^[[:space:]]*//g' | nl | less; - fi - echo $2 > /tmp/lastShowedNewsFeed; - elif [ "$1" ] && [ "$1" = "--open" ] && [ "$2" ] && [ $2 -gt 0 ]; then - subscriptionNumber=$(cat /tmp/lastShowedNewsFeed); - if ! grep -q 'CDATA' /tmp/newsfeed_${subscriptionNumber}.xml; then - link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/title>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p") - else - link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/description>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p") - fi - exo-open --launch WebBrowser "$link"; - fi -fi diff --git a/tools/0/023/notifier b/tools/0/023/notifier deleted file mode 100755 index d658ba0..0000000 --- a/tools/0/023/notifier +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -source library.sh; - -if [ "$1" ]; then - case $1 in - "distro") if check_distro_version; then - msg=$(check_distro_version --print); - notify-send -i software-update-urgent "Distribution update" "New version (${msg}) of immudex is available to upgrade."; - else - msg=$(check_distro_version --print); - notify-send -i apply "Distribution update" "This (${msg}) is the latest version of immudex."; - fi;; - "packages") msg=$(sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;); - notify-send -i software-update-available "Packages update" "$msg";; - esac -fi - diff --git a/tools/0/023/padlock b/tools/0/023/padlock deleted file mode 100755 index bf50d1a..0000000 --- a/tools/0/023/padlock +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -launcher="/home/${USER}/Pulpit/Padlock.desktop"; - -function main_unlock() { - /usr/local/bin/immudex_crypt open $1; - index=$(basename $(/usr/local/bin/immudex_crypt list | grep "$1" | head -1 | awk '{printf $2}' | grep -o '[0-9]')); - #sudo mkdir -p /media/${USER}/$devName; - #sudo mount /dev/mapper/$devName /media/${USER}/$devName; - - xfce4-terminal --default-working-directory=/ic${index}; - #sed -i 's/prevent/allow/' ${launcher}; - sudo rm /usr/share/icons/padlock-icon.png; - sudo ln -s /usr/share/icons/changes-allow.png /usr/share/icons/padlock-icon.png; - -} - -function unlock() { - - cryptParts=$(sudo blkid | grep 'LUKS' | sed 's/://g' | awk '{printf $1" "}'); - if [ "$cryptParts" ]; then - if [ $(echo $cryptParts | wc -w) -gt 1 ]; then - select cryptPart in $cryptParts; do - main_unlock $cryptPart; - break; - done - else - main_unlock $cryptParts; - fi - else - echo -e "\e[31mThere is no LUKS partition to open.\e[0m"; - sleep 3; - fi -} - -function lock() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - if [ "$mountPoint" ]; then - if $(sudo lsof $mountPoint > /dev/null 2>&1); then - notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error; - else - sudo umount $mountPoint; - if [ $? -ne 0 ]; then - notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error; - fi - sudo cryptsetup close /dev/mapper/${dmDevice}; - fi - else - sudo cryptsetup close /dev/mapper/${dmDevice}; - fi - fi - done - fi - if ! $(df -h | grep -q '/dev/mapper'); then - #sed -i 's/allow/prevent/' ${launcher}; - sudo rm /usr/share/icons/padlock-icon.png; - sudo ln -s /usr/share/icons/changes-prevent.png /usr/share/icons/padlock-icon.png; - fi -} - -mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - -if [ "$mapperDeviceList" ]; then lock; -else unlock; -fi diff --git a/tools/0/023/run-thunderbird b/tools/0/023/run-thunderbird deleted file mode 100755 index c08389a..0000000 --- a/tools/0/023/run-thunderbird +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -export HOME=/ic0; -thunderbird; diff --git a/tools/0/023/secured-firefox b/tools/0/023/secured-firefox deleted file mode 100755 index 4041e89..0000000 --- a/tools/0/023/secured-firefox +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ ! -d /tmp/${USER} ]; then - mkdir /tmp/${USER} - cp -prvv /home/${USER}/.mozilla /tmp/${USER} -fi - -eth0=$(ip route show | grep 'default' | awk '{printf $5}'); -firejail --private=/tmp/${USER} --net=$eth0 /usr/bin/firefox diff --git a/tools/0/023/shoutcasts b/tools/0/023/shoutcasts deleted file mode 100755 index 888ef1b..0000000 --- a/tools/0/023/shoutcasts +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -echo -n "What are you wanna listen? "; -read search; - -function getDataBetweenHtmlMarks() { - grep "$1" $2 | sed -n "${3}p" | cut -d ">" -f 2 | cut -d "<" -f 1; -} -wget http://dir.xiph.org/search?q=$search -O /tmp/shcast_dir.html >> /dev/null 2>&1; -if [ ! -s /tmp/shcast_dir.html ]; then - echo -e "\e[31mThere is no internet connection.\e[0m"; - exit 1; -else - amountOfStations=$(grep 'card-title' /tmp/shcast_dir.html | wc -l); - i=1; - while [ $i -le $amountOfStations ]; do - stationName=$(getDataBetweenHtmlMarks 'card-title' /tmp/shcast_dir.html ${i}); - whatIsPlaying=$(getDataBetweenHtmlMarks 'card-subtitle' /tmp/shcast_dir.html ${i}); - echo -e "${i}. \e[33m${stationName}\e[0m"; - echo -e " \e[32m${whatIsPlaying}\e[0m"; - i=$((i + 1)); - done - echo -n "Pick a one: "; - read numberOfStation; - echo $(grep 'Play' /tmp/shcast_dir.html | sed -n "${numberOfStation}p" | cut -d '"' -f 2) | xclip -selection c; - echo "Station URL was copied to clipboard"; - -fi diff --git a/tools/0/023/sync.sh b/tools/0/023/sync.sh deleted file mode 100644 index 9d7c64a..0000000 --- a/tools/0/023/sync.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -source ~/.sync.d/sync.conf; - -if [ ! -d "${HOME}/${ldirectory}" ]; then mkdir "${HOME}/${ldirectory}"; fi - -function printhelp { - - echo "Skrypt szybkiej synchronizacji katalogu zdalnego"; - echo "morketsmerke.org"; - echo "2023; COPYLEFT; ALL RIGHTS REVERSED"; - echo ""; - echo "push - Przesłanie danych z katalogu lokalnego na katalog zdalny"; - echo "pull - Pobranie zawartości katalogu zdalnego do katalogu lokalnego"; - echo "Plik konfiguracyjny musi znajdować się na ścieżce: ~/.sync.d/sync.conf"; - echo "Przykładowy plik konfiguracyjny znajduje się na ścieżce: /usr/share/sync.sh/sync.conf"; -} -if [ ! "$1" ]; then - - printhelp; - exit 1; - -else - if [ "$1" = "push" ]; then - - echo "[*] Synchronizacja: local -> remote"; - rsync -avu ${HOME}/${ldirectory}/* ${ruser}@${server}:${rdirectory}; - - elif [ "$1" = "pull" ]; then - - echo "[*] Synchronizacja remote -> local"; - rsync -avu ${ruser}@${server}:${rdirectory}/* ${HOME}/${ldirectory}; - - else - printhelp; - exit 1; - fi - -fi diff --git a/tools/0/023/ytplay b/tools/0/023/ytplay deleted file mode 100755 index 0bb0c14..0000000 --- a/tools/0/023/ytplay +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "ytplay - script which could play a video or audio track from youtube"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " -s - search given keyword on youtube."; - echo " -v - play youtube video." - echo " -a - play only youtube video audiotrack"; - echo "Ommiting -s option, assume you are give a yt video link."; - echo "You have to put -v or -a before you paste a yt video link"; - echo "When you put keywords in -s option, you need to choose"; - echo "that you want listening an audiotrack (-a) oraz watch video (-v)"; - echo "Usage:"; - echo " $ ytplay -s -a [-f ytdl-format] 'lofi'"; - echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]"; - echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]"; - echo "You can search again the same keywords puting 'r' or 'R' instead"; - echo "of video numer"; -} - -function yt_search() { - query=$(echo $* | sed 's/ /+/g'); - echo -n "Getting youtube site with search results..."; - wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - - sed -i 's/,/\n/g' /tmp/yt.html; - - listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}'); - - numberOfListElements=$(echo $listOfVideos | wc -w); - i=1; - lp=1; - while [ $i -le $numberOfListElements ]; do - if [ $i -eq $numberOfListElements ]; then - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2='$'; - else - j=$((i + 1)); - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2=$(echo $listOfVideos | cut -d " " -f $j); - fi - #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then - # i=$((i + 1)); continue; - #else - title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8); - channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8); - duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4); - if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi - videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4); - if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then - echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}"; - echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv; - else - i=$((i + 1)); continue; - fi - #fi - i=$((i + 1)); - lp=$((lp + 1)); - done -} - -if [ "$1" ]; then - if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then - mode=$1; - shift; - link=$(echo $1 | sed 's@https://@@'); - if [ $# -gt 1 ]; then - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--no-video --ytdl-format=${1}"; - else - format="--ytdl-format=${1}"; - fi - fi - fi - elif [ "$1" = "-s" ]; then - if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi - if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi - - shift; - mode=$1; - if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--no-video --ytdl-format=${1}"; - else - format="--ytdl-format=${1}"; - fi - fi - while [ true ]; do - yt_search $*; - echo -n "Put number of which video you want to hear/watch: "; - read numberOfVideo; - if [[ $numberOfVideo -gt 0 ]]; then break; - elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then - continue; - else - help; - exit 1; - fi - done - title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3); - channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4); - duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5); - videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2); - clear; - echo -e "Title: ${GREEN}${title}${ENDCOLOR}"; - echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "===================================================================="; - link=${videoId}; - else - help; - exit 1; - fi - - if [ "$mode" = "-a" ]; then - if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi - mpv ${format} ytdl://${link}; - elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi -else - help; - exit 1; -fi diff --git a/tools/0/025/immudex_hostname b/tools/0/025/immudex_hostname deleted file mode 100755 index d147a2a..0000000 --- a/tools/0/025/immudex_hostname +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -vendor=$(hostnamectl | grep 'Vendor' | awk '{printf $3}') -modelLine=$(hostnamectl | grep 'Model' | awk '{printf $3}') -model=$(hostnamectl | grep 'Model' | awk '{printf $4}') - -case $vendor in - "Lenovo") vendorShort="l";; - "Dell") vendorShort="d";; - *) hName="immudex";; -esac - -case $modelLine in - "ThinkPad") mLShort="TP";; - "Latitude") mLShort="Lat";; - *) hName="immudex";; -esac - -if [ ! "$hName" ]; then - hName="${vendorShort}-${mLShort}-$model" - sudo hostnamectl set-hostname $hName; - sudo sed -i "s/immudex/${hName}/" /etc/hosts; - echo $hName | sudo tee /etc/hostname > /dev/null; -fi - diff --git a/tools/0/025/meteo b/tools/0/025/meteo deleted file mode 100755 index 5a77737..0000000 --- a/tools/0/025/meteo +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -function help() { - echo "meteo - prognoza pogody z wttr.in" - echo "morketsmerke.org @ 2023"; - echo "Opcje:"; - echo " -s - format krótki (aktualna pogoda)"; - echo " -l - format długi (format krótki + 2 dniowa prognoza)" - echo "Użycie:"; - echo "$ meteo <-s/-l> <miasto>"; -} - -if [ "$1" ]; then - if [ "$1" = "-s" ]; then - curl wttr.in/${2}?0\&lang=pl; - elif [ "$1" = "-l" ]; then - curl wttr.in/${2}?lang=pl; - fi -else - help; - exit 1; -fi diff --git a/tools/0/025/pl b/tools/0/025/pl deleted file mode 100755 index efcd0b0..0000000 --- a/tools/0/025/pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -file=$1; - -function help() { - echo "pl - Play Links. Skrypt to odtwarzania multimediów z listy linków"; - echo "morketsmerke.org; COPYLEFT; 2023"; - echo; - echo "Użycie:"; - echo "$ pl sciezka/do/listy/linkow"; - echo; - echo "Format listy:"; - echo "nazwa linku: https://youtube.com/..."; -} - -if [ "$1" ]; then - PS3="Link: "; - linkNames=$(cut -d ":" -f 1 $1 | sed 's/\ /_/g' | awk '{printf $1" "}') - select name in $linkNames; do - if [ ! "$name" ]; then break; fi - linkName=$(echo $name | sed 's/_/\ /g'); - link=$(grep "$linkName" $file | cut -d ":" -f 2-); - if echo $link | grep -q "youtube"; then - ytplay -a $link -f best[height=360]; - else - mpv --no-video $link; - fi - done -else - help; - exit 1; -fi diff --git a/tools/0/immudex_crypt b/tools/0/immudex_crypt deleted file mode 100755 index f686522..0000000 --- a/tools/0/immudex_crypt +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/bash - -function help() { - - echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " list - displaing list of opened and available crypt_LUKS devices"; - echo " open - opening crypt_LUKS device, after this device is ready to mount"; - echo " close - unmount and closing crypt_LUKS devices"; - echo "Using:"; - echo "$ immudex_crypt list"; - echo "$ immudex_open <crypt_LUKS device>"; - echo "$ immudex_close immudex_crypt[0-9] | ic[0-9] | [0-9]"; -} - -function list() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "Opened devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint"; - else - echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted"; - fi - fi - done - else - echo -e "No opened crypt devices was found"; - fi - echo "=============================================================="; - - luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "crypt_LUKS devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$luksDevicesList" ]; then - for lDevice in $luksDevicesList; do - echo -e "$lDevice"; - done - else - echo "No crypt device was found"; - fi - echo "=============================================================="; -} - -function open() { - - if [ $# -lt 1 ]; then help; exit 1; - else - index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1); - if [ "$index" ]; then - index=$((index + 1)); - else - index=0; - fi - sudo cryptsetup open $1 immudex_crypt${index}; - sudo mkdir -p /media/${USER}/immudex_crypt${index}; - if ! $(sudo file -s /dev/dm-${index} | grep -q 'ext4'); then - echo "Could not determine filesystem of unlocked device."; - echo -n "Format this device to ext4? (y/n): " - read format; - if [ "$format" = "y" ]; then - sudo mkfs.ext4 /dev/mapper/immudex_crypt${index}; - else - echo "Refuse to mount."; - sudo cryptsetup close immudex_crypt${index}; - exit 1; - fi - fi - sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index}; - if [ ! -e /ic${index} ]; then - sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index}; - fi - fi - -} - -function close() { - - if [ $# -lt 1 ]; then help; exit 1; - else - if [ $1 -ge 0 ] 2> /dev/null; then - cryptfsName="immudex_crypt${1}"; - elif echo $1 | grep -q 'ic'; then - cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')"; - else - cryptfsName=$1; - fi - if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - sudo umount -R $mountPoint; - sudo cryptsetup close ${cryptfsName}; - else - sudo cryptsetup close ${cryptfsName}; - fi - else - echo "Given devices isn't opened crypt device or it was closed before"; - fi - fi -} - -if [ "$1" ]; then - - case $1 in - "list") list;; - "open") if [ "$2" ]; then open $2; - else help; exit 1; - fi;; - "close") if [ "$2" ]; then close $2; - else help; exit 1; - fi;; - *) help;; - esac -else - help; exit 1; -fi diff --git a/tools/0/immudex_install b/tools/0/immudex_install deleted file mode 100755 index 405c4c9..0000000 --- a/tools/0/immudex_install +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -ENDCOLOR="\e[0m"; - -while [ true ]; do - echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}"; - echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}"; - echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}"; - read ans; - if [ "$ans" = "y" ]; then break; fi -done - -set -e - -function selectDisk() { - disks=$(lsblk | grep 'disk' | awk '{printf $1" "}'); - if [ $(echo $disks | wc -w) -gt 1 ]; then - select drive in $disks; do - echo $drive; - break; - done - else - echo $disks | awk '{printf $1}'; - fi -} - -if $(sudo efibootmgr > /dev/null 2>&1); then -#uefi installation - #partitioning - echo -n "Installation immudex in EFI mode ... "; - disk=$(selectDisk); - originDisk=$disk; - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1; - sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1; - - #Setting label for partition - sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1; - - #mount root partition - sudo mount /dev/${disk}2 /media > /dev/null 2>&1; - - #creating directories for efi partition - sudo mkdir -p /media/boot/efi > /dev/null 2>&1; - - #mount efi partition - sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying whole iso image to the second partition - sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1; - - #removing unnecessary directories from second partition - sudo rm -rf /media/isolinux > /dev/null 2>&1; - sudo rm -rf /media/EFI > /dev/null 2>&1; - - #GRUB Installation - sudo grub-install --target=x86_64-efi --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1; - - #Adding entry to EFI Firmware - sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1; - - #Umount all mounted filesystems - sudo umount -R /media > /dev/null 2>&1; - - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - -else -#mbr installation - echo -n "Installation immudex in BIOS mode ... "; - - #partitioning - disk=$(selectDisk); - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1; - - #Setting label for partition is necessary for extlinux bootloader - sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1; - - #mount partition in /media directory - sudo mount /dev/${disk}1 /media > /dev/null 2>&1; - - #Creating directory for extlinux - sudo mkdir /media/extlinux > /dev/null 2>&1; - - #Instalation extlinux files in abovementioned directory - sudo extlinux --install /media/extlinux > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying live directory from iso image to partition - sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1; - - #installation extlinux MBR on first sector of hard drive (whole device) - sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1; - - #creating extlinux configuration file - cat > extlinux.conf <<EOF -default immudex -label immudex -kernel /live/vmlinuz -append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor -EOF - sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1; - - #Unmounting filesystems - sudo umount /media > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi -fi diff --git a/tools/0/immudex_upgrade b/tools/0/immudex_upgrade deleted file mode 100755 index 371124d..0000000 --- a/tools/0/immudex_upgrade +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -set -e - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; -root="/run/live/medium"; - -function help() { - echo "immudex_upgrade - script for searching upgrades and upgrade immudex"; - echo "morketsmerke.net @ 2022"; - echo "Options:"; - echo " --check --print - check there are upgrades for immudex"; - echo " --upgrade - check there are upgrades for immudex and install them."; - echo " If there is no new version, script will propose refreshing"; - echo " current immudex installation, its helpful when you tried"; - echo " remaster immudex and you get any trouble with this". -} - -function main_upgrade() { - set -e - if [ "$(uname -m)" = "x86_64" ]; then arch="64"; - else arch="32"; - fi - rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}'); - sudo mount $rootPart $1 -o remount,rw; - sudo rm -f ${1}/live/*; - sudo wget -q https://sourceforge.net/projects/immudex/files/upgrades/${2}/${arch}/filesystem.squashfs/download -O ${1}/live/filesystem.squashfs; - sudo wget -q https://sourceforge.net/projects/immudex/files/upgrades/${2}/${arch}/initrd/download -O ${1}/live/initrd; - sudo wget -q https://sourceforge.net/projects/immudex/files/upgrades/${2}/${arch}/vmlinuz/download -O ${1}/live/vmlinuz; - echo "$2" > /tmp/version; - sudo cp /tmp/version ${1}/live; -} - -function check(){ - set -e - if [ -d ${root}/live ]; then - if [ -f ${root}/live/version ]; then - version=$(cat ${root}/live/version | sed 's/\.//g'); - else version="000"; - fi - if [ ! -f /tmp/feed.xml ]; then - wget -q https://sourceforge.net/p/immudex/activity/feed -O /tmp/feed.xml - fi - if [ ! -s /tmp/feed.xml ]; then sudo rm /tmp/feed.xml; return 255; fi; - newVersionTxt=$(grep -o "[0-9]\.[0-9]\.[0-9]" /tmp/feed.xml | head -1); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if [ $version -lt $newVersionInt ]; then - exitcode=0; - else - exitcode=1; - fi - else - exitcode=255; - fi - if [ "$1" ] && [ "$1" = "--print" ]; then - echo $newVersionTxt; - return 0; - fi - return $exitcode; -} - -if [ "$1" ] && [ "$1" = "--check" ]; then - if [ "$2" ] && [ "$2" = "--print" ]; then - newVersion=$(check --print); - if check; then - echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}"; - else - echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}"; - fi - fi -elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - newVersionTxt=$(check --print); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if check; then - echo -en "${YELLOW}New version " - echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) " - echo -e "of immudex is available.${ENDCOLOR}"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Upgrading immudex to the newest version..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}"; - echo -e "${YELLOW}but you can copy fresh system files from latest iso image"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo -n "Refreshing immudex to the latest iso image..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - exit 0; - fi -else - help; - exit 1; -fi diff --git a/tools/0/import_gpgkeys b/tools/0/import_gpgkeys deleted file mode 100755 index dfb9ff9..0000000 --- a/tools/0/import_gpgkeys +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ -f ~/public.gpg ] && [ -f ~/private.gpg ]; then - gpg --import ~/public.gpg - gpg --import ~/private.gpg - userId=$(gpg --list-keys | sed -nr 's/.+<(.*)>$/\1/p'); - gpg --edit-key $userId; -fi diff --git a/tools/0/import_sshkeys b/tools/0/import_sshkeys deleted file mode 100755 index 3cb56ad..0000000 --- a/tools/0/import_sshkeys +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -if $(ls $HOME | grep -q '.*_rsa.*'); then - if [ -d /home/$USER/.ssh ]; then - cp -v ~/*_rsa* /home/$USER/.ssh; - else - mkdir /home/$USER/.ssh; - chmod 700 /home/$USER/.ssh; - cp -v ~/*_rsa* /home/$USER/.ssh; - fi -fi - diff --git a/tools/0/motd b/tools/0/motd deleted file mode 100755 index f046d47..0000000 --- a/tools/0/motd +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -/usr/bin/figlet immudex; -echo; -echo "-= Today is: $(date) =-"; -cpuIdle=$(vmstat | tail -1 | awk '{printf $15}'); -cpuUsage=$((100 - $cpuIdle)); -echo -e "-=\tCPU: ${cpuUsage}%\t\t\t=-"; -echo -e "-=\tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free\t\t\t=-"; -diskSize=$(df -h | grep '/dev/mapper' | head -1 | awk '{printf $2}'); -diskFree=$(df -h | grep '/dev/mapper' | head -1 | awk '{printf $4}'); -diskUsage_perc=$(df -h | grep '/dev/mapper' | head -1 | sed 's/%//' | awk '{printf $5}'); -#FCP = First Crypt Partition -echo -e "-=\tFCP: ${diskFree}/${diskSize} (${diskUsage_perc}%)\t\t=-"; -echo -e "-=\tPROCESSES: $(grep 'proces' /proc/stat | awk '{printf $2}')\t\t\t=-"; -echo -e "-=\tUPTIME: $(uptime | awk '{printf $3}' | sed 's/,//')\t\t\t=-"; -echo -e "-=\t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])\t=-"; -echo -e "-= morketsmerke.net @ 2022 https://github.com/xf0r3m/immudex =-"; -echo; -/usr/local/bin/immudex_upgrade --check --print -echo "===================================================================="; diff --git a/tools/0/motd2 b/tools/0/motd2 deleted file mode 100755 index 239b016..0000000 --- a/tools/0/motd2 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -/usr/bin/figlet immudex; -echo; -echo "Today is: $(date)"; -echo; -echo "System summary: "; -cpuIdle=$(vmstat | tail -1 | awk '{printf $15}'); -cpuUsage=$((100 - $cpuIdle)); -echo -e " \tCPU: ${cpuUsage}%"; -echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free"; -if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then - i=1; - echo -e " \tCRYPT_PARTi: Free/Total (Usage%)"; - amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}'); - while [ $i -le $amountOfDisks ]; do - diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}'); - diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}'); - diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}'); - #FCP = First Crypt Partition - echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)"; - i=$((i + 1)); - done -else - echo -e " \tCRYPT_PART: N/A"; -fi -echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')"; -utime=$(uptime | awk '{printf $3}' | sed 's/,//'); -if $(echo $utime | grep -q ":"); then - echo -e " \tUPTIME: ${utime}"; -else - echo -e " \tUPTIME: 0:${utime}"; -fi -echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])"; -echo; -echo -e "morketsmerke.net @ 2022 https://github.com/xf0r3m/immudex"; -echo; -/usr/local/bin/immudex_upgrade --check --print; -if [ $? -ne 0 ]; then - echo -e "\e[31mThere is no internet connection or internal error.\e[0m"; - if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then - rm -f /tmp/feed.xml; - fi -else - if [ "$USER" = "xf0r3m" ]; then - sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log; - fi -fi -echo "===================================================================="; diff --git a/tools/0/newsfeed b/tools/0/newsfeed deleted file mode 100755 index a3a426a..0000000 --- a/tools/0/newsfeed +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -function help() { - echo "newsfeed - fetch and browse news feed from rss and atom channels"; - echo "morketsmerke.net; COPYLEFT @ 2022"; - echo; - echo "Options:"; - echo " --list - shows numbered list of names, saved in ~/.newsfeed names and"; - echo " URL of rss channels"; - echo " --check - fetching new rss channel file from source"; - echo " --show <number_of_channel> - shows numbered list of news titles."; - echo " Number of channel you can get from --list option."; - echo " --open <number_of_title> - open web browser on link, which are under"; - echo " titles of news on rss channel. Number of title you can get"; - echo " from --show option. This option based on the last showed rss"; - echo " channel feed."; - echo; - echo "The ~/.newsfeed file:"; - echo " This file is simple csv (semicolon separated values) file which"; - echo " store rss channels in one line. One by one. The one line"; - echo " contains: name and URL of rss feed. For example:"; - echo; - echo " News Feed;https://newsfeed.example.org/rss"; -} -if [ ! -s ~/.newsfeed ]; then - help; - exit 1; -else - if [ ! "$1" ] || ([ "$1" != "--list" ] && \ - [ "$1" != "--check" ] && \ - [ "$1" != "--show" ] && \ - [ "$1" != "--open" ]); then - help; - exit 1; - fi - amountOfSubscriptions=$(cat ~/.newsfeed | wc -l); - i=1; - while [ $i -le $amountOfSubscriptions ]; do - newsfeedLine=$(sed -n "${i}p" ~/.newsfeed); - nameOfSubscription=$(echo $newsfeedLine | cut -d ";" -f 1); - rssLink=$(echo $newsfeedLine | cut -d ";" -f 2); - if [ "$1" ] && [ "$1" = "--list" ]; then - echo -e "${i}. ${nameOfSubscription}"; - elif [ "$1" ] && [ "$1" = "--check" ]; then - echo -e "${i}. ${nameOfSubscription}"; - echo -n "Getting news feed..."; - wget $rssLink -O /tmp/new_newsfeed_${i}.xml 2>/dev/null; - if [ $? -eq 0 ]; then echo "[ OK ]"; - else echo -e "\nThere is no Internet connection"; exit 1; fi - if [ -s /tmp/newsfeed_${i}.xml ]; then - amountOfNewNewses=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | grep '<title>' | wc -l); - if [ $amountOfNewNewses -gt 0 ]; then - notify-send "$nameOfSubscription" "New $amountOfNewNewses newses" --icon=/usr/share/icons/rss.png; - j=1; - sleep 1; - while [ $j -le $amountOfNewNewses ]; do - news=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | \ - grep '<title>' | sed -n "${j}p" | sed 's/<title>//' | \ - sed 's/<\/title>//' | sed 's/[<>]//' | \ - sed 's/^[[:space:]]*//g'); - notify-send "newsfeed" "${nameOfSubscription}: ${news}" -t 10000 --icon=/usr/share/icons/rss.png; - sleep 1; - j=$((j + 1)); - done - fi - mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml; - else - mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml; - amountOfNews=$(grep '<title>' /tmp/newsfeed_${i}.xml | sed -n '2,$p' | wc -l); - if [ $amountOfNews -eq 0 ]; then - compressed=1; - amountOfNews=$(sed 's/<\/title>/\n/g' /tmp/newsfeed_${i}.xml | sed 's/<item>/\n/g' | grep '<title>' | wc -l) - fi - notify-send "$nameOfSubscription" "New $amountOfNews newses" --icon=/usr/share/icons/rss.png; - fi - fi - i=$((i + 1)); - done - if [ "$1" ] && [ "$1" = "--show" ] && [ "$2" ] && [ $2 -gt 0 ]; then - - #Parsing - #Thanks to the linuxhint.com for command: - #sed 's/^[[:space]]*//g' - #https://linuxhint.com/trim_string_bash - - if grep -q 'CDATA' /tmp/newsfeed_${2}.xml; then - sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \ - sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \ - sed 's/<title>//' | sed 's/"/"/g' | \ - sed 's/<!\[CDATA\[//g' | sed 's/\]\]>//g' | \ - sed 's/^[[:space:]]*//g' | nl | less; - else - sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \ - sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \ - sed 's/<title>//' | sed 's/"/"/g' | \ - sed 's/^[[:space:]]*//g' | nl | less; - fi - echo $2 > /tmp/lastShowedNewsFeed; - elif [ "$1" ] && [ "$1" = "--open" ] && [ "$2" ] && [ $2 -gt 0 ]; then - subscriptionNumber=$(cat /tmp/lastShowedNewsFeed); - if ! grep -q 'CDATA' /tmp/newsfeed_${subscriptionNumber}.xml; then - link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/title>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p") - else - link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/description>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p") - fi - exo-open --launch WebBrowser "$link"; - fi -fi diff --git a/tools/0/padlock b/tools/0/padlock deleted file mode 100755 index 1b4b14f..0000000 --- a/tools/0/padlock +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -launcher="/home/${USER}/.config/xfce4/panel/launcher-29/16633324331.desktop"; - -function main_unlock() { - /usr/local/bin/immudex_crypt open $1; - index=$(basename $(/usr/local/bin/immudex_crypt list | grep "$1" | head -1 | awk '{printf $2}' | grep -o '[0-9]')); - #sudo mkdir -p /media/${USER}/$devName; - #sudo mount /dev/mapper/$devName /media/${USER}/$devName; - - xfce4-terminal --default-working-directory=/ic${index}; - sed -i 's/--unlock/--lock/' ${launcher}; - sed -i 's/padlock.png/unlocked.png/' ${launcher}; -} - -function unlock() { - - cryptParts=$(sudo blkid | grep 'LUKS' | sed 's/://g' | awk '{printf $1" "}'); - if [ "$cryptParts" ]; then - if [ $(echo $cryptParts | wc -w) -gt 1 ]; then - select cryptPart in $cryptParts; do - main_unlock $cryptPart; - break; - done - else - main_unlock $cryptParts; - fi - else - echo -e "\e[31mThere is no LUKS partition to open.\e[0m"; - sleep 3; - fi -} - -function lock() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - if [ "$mountPoint" ]; then - if $(sudo lsof $mountPoint > /dev/null 2>&1); then - notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error; - else - sudo umount $mountPoint; - if [ $? -ne 0 ]; then - notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error; - fi - sudo cryptsetup close /dev/mapper/${dmDevice}; - fi - else - sudo cryptsetup close /dev/mapper/${dmDevice}; - fi - fi - done - fi - if ! $(df -h | grep -q '/dev/mapper'); then - sed -i 's/--lock/--unlock/' ${launcher}; - sed -i 's/unlocked.png/padlock.png/' ${launcher}; - fi -} - -if [ "$1" ] && [ "$1" = "--unlock" ]; then unlock; -elif [ "$1" ] && [ "$1" = "--lock" ]; then lock; -fi diff --git a/tools/0/protected b/tools/0/protected deleted file mode 100755 index 12d7414..0000000 --- a/tools/0/protected +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - -if [ "$mapperDeviceList" ]; then - - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - if [ "$mountPoint" ]; then - if $(sudo lsof $mountPoint > /dev/null 2>&1); then - notify-send "Protected" "The $1 cannot be run, because your LUKS partition is open." --icon=dialog-error; - exit 1; - else - sudo umount $mountPoint; - sudo cryptsetup close /dev/mapper/${dmDevice}; - #zmiana na launcherze padlock - launcher="/home/${USER}/.config/xfce4/panel/launcher-29/16633324331.desktop"; - sed -i 's/--lock/--unlock/' ${launcher}; - sed -i 's/unlocked.png/padlock.png/' ${launcher}; - fi - fi - fi - done - $1; -else - $1; - -fi diff --git a/tools/0/shoutcasts b/tools/0/shoutcasts deleted file mode 100755 index 888ef1b..0000000 --- a/tools/0/shoutcasts +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -echo -n "What are you wanna listen? "; -read search; - -function getDataBetweenHtmlMarks() { - grep "$1" $2 | sed -n "${3}p" | cut -d ">" -f 2 | cut -d "<" -f 1; -} -wget http://dir.xiph.org/search?q=$search -O /tmp/shcast_dir.html >> /dev/null 2>&1; -if [ ! -s /tmp/shcast_dir.html ]; then - echo -e "\e[31mThere is no internet connection.\e[0m"; - exit 1; -else - amountOfStations=$(grep 'card-title' /tmp/shcast_dir.html | wc -l); - i=1; - while [ $i -le $amountOfStations ]; do - stationName=$(getDataBetweenHtmlMarks 'card-title' /tmp/shcast_dir.html ${i}); - whatIsPlaying=$(getDataBetweenHtmlMarks 'card-subtitle' /tmp/shcast_dir.html ${i}); - echo -e "${i}. \e[33m${stationName}\e[0m"; - echo -e " \e[32m${whatIsPlaying}\e[0m"; - i=$((i + 1)); - done - echo -n "Pick a one: "; - read numberOfStation; - echo $(grep 'Play' /tmp/shcast_dir.html | sed -n "${numberOfStation}p" | cut -d '"' -f 2) | xclip -selection c; - echo "Station URL was copied to clipboard"; - -fi diff --git a/tools/0/ytplay b/tools/0/ytplay deleted file mode 100755 index 1b9491c..0000000 --- a/tools/0/ytplay +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "ytplay - script which could play a video or audio track from youtube"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " -s - search given keyword on youtube."; - echo " -v - play youtube video." - echo " -a - play only youtube video audiotrack"; - echo "Ommiting -s option, assume you are give a yt video link."; - echo "You have to put -v or -a before you paste a yt video link"; - echo "When you put keywords in -s option, you need to choose"; - echo "that you want listening an audiotrack (-a) oraz watch video (-v)"; - echo "Usage:"; - echo " $ ytplay -s -a 'lofi'"; - echo " $ ytplay -v https://youtube.com/watch?v=..."; - echo " $ ytplay -a https://youtube.com/watch?v=..."; -} - -if [ "$1" ]; then - if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then - mode=$1; - shift; - link=$(echo $1 | sed 's@https://@@'); - elif [ "$1" = "-s" ]; then - if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi - if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi - - shift; - mode=$1; - if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi - shift; - query=$(echo $* | sed 's/ /+/g'); - echo -n "Getting youtube site with search results..."; - wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - - sed -i 's/,/\n/g' /tmp/yt.html; - - listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}'); - - numberOfListElements=$(echo $listOfVideos | wc -w); - i=1; - lp=1; - while [ $i -le $numberOfListElements ]; do - if [ $i -eq $numberOfListElements ]; then - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2='$'; - else - j=$((i + 1)); - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2=$(echo $listOfVideos | cut -d " " -f $j); - fi - if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then - i=$((i + 1)); continue; - else - title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8); - channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8); - duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4); - videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4); - if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then - echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}"; - echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv; - else - i=$((i + 1)); continue; - fi - fi - i=$((i + 1)); - lp=$((lp + 1)); - done - echo -n "Put number of which video you want to hear/watch: "; - read numberOfVideo; - title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3); - channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4); - duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5); - videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2); - clear; - echo -e "Title: ${GREEN}${title}${ENDCOLOR}"; - echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "===================================================================="; - link=${videoId}; - else - help; - exit 1; - fi - - if [ "$mode" = "-a" ]; then mpv --ytdl-format=bestaudio ytdl://${link}; - elif [ "$mode" = "-v" ]; then mpv ytdl://${link}; fi -else - help; - exit 1; -fi diff --git a/tools/100/autostart-x4notes b/tools/100/autostart-x4notes deleted file mode 100755 index a41856d..0000000 --- a/tools/100/autostart-x4notes +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -while [ ! -h /dev/mapper/immudex_crypt0 ]; do sleep 1; done -HOME=/ic0 xfce4-notes > /dev/null 2>&1 & diff --git a/tools/100/create_media b/tools/100/create_media deleted file mode 100755 index 9471ff1..0000000 --- a/tools/100/create_media +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "create_media - script used for write iso image to usb drive(mainly)"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " --i386-efi - creating 32-bit EFI usb drive with iso image"; - echo " (comapatible with immudex only iso images)"; - echo "Usage:"; - echo " $ create_media [--i386-efi] <usb_disk> <iso_image>"; -} - -if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi -if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then - disk=$1; shift; -else - help; - exit 1; -fi -if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then - iso=$1; -else - help; - exit 1; -fi - -if [ "$target" ]; then - echo -n "Writing zeros to 1st megabyte on disk..."; - sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating MS-DOS partitionig scheme on disk..."; - sudo parted $disk mklabel msdos > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating FAT-32 partition..."; - sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating VFAT filesystem on partition..."; - sudo mkfs.vfat ${disk}1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/usb directory..."; - sudo mkdir /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting VFAT partition on /mnt/usb..."; - sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Instalation GRUB on disk..."; - sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/iso directory..."; - sudo mkdir /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; - else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi - - echo -n "Mounting iso file on /mnt/iso..."; - sudo mount $iso /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying grub config files to the disk..."; - sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1; - sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Copying immudex files to the disk..."; - sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating empty DEBIAN file..."; - sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Umounting all mounted filesystems..."; - sudo umount /mnt/* > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -else - echo -n "Writing zeros to 1st megabyte on disk..."; - sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Writing iso image to the disk..." - sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi -fi diff --git a/tools/100/immudex_crypt b/tools/100/immudex_crypt deleted file mode 100755 index 5ff721d..0000000 --- a/tools/100/immudex_crypt +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/bash - -function help() { - - echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions"; - echo "morketsmerke.org COPYLEFT @ 2023"; - echo "Options:"; - echo " list - displaing list of opened and available crypt_LUKS devices"; - echo " create - formatting device for crypt_LUKS"; - echo " open - opening crypt_LUKS device, after this device is ready to mount"; - echo " close - unmount and closing crypt_LUKS devices"; - echo "Using:"; - echo "$ immudex_crypt list"; - echo "$ immudex_crypt create <disk partition>"; - echo "$ immudex_crypt open <crypt_LUKS device>"; - echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]"; -} - -function list() { - - mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "Opened devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$mapperDeviceList" ]; then - for dmDevice in $mapperDeviceList; do - if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}'); - device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint"; - else - echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted"; - fi - fi - done - else - echo -e "No opened crypt devices was found"; - fi - echo "=============================================================="; - - luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}'); - - echo "=============================================================="; - echo -e "crypt_LUKS devices:"; - echo "=============================================================="; - echo -e "Device:\t\tMapper name:\t\tMount point:"; - - if [ "$luksDevicesList" ]; then - for lDevice in $luksDevicesList; do - echo -e "$lDevice"; - done - else - echo "No crypt device was found"; - fi - echo "=============================================================="; -} - -function open() { - - if [ $# -lt 1 ]; then help; exit 1; - else - index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1); - if [ "$index" ]; then - index=$((index + 1)); - else - index=0; - fi - sudo cryptsetup open $1 immudex_crypt${index}; - sudo mkdir -p /media/${USER}/immudex_crypt${index}; - dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2); - if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then - echo "Could not determine filesystem of unlocked device."; - echo -n "Format this device to ext4? (y/n): " - read format; - if [ "$format" = "y" ]; then - sudo mkfs.ext4 /dev/mapper/immudex_crypt${index}; - else - echo "Refuse to mount."; - sudo cryptsetup close immudex_crypt${index}; - exit 1; - fi - fi - sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index}; - if [ ! -e /ic${index} ]; then - sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index}; - fi - fi - -} - -function close() { - - if [ $# -lt 1 ]; then help; exit 1; - else - if [ $1 -ge 0 ] 2> /dev/null; then - cryptfsName="immudex_crypt${1}"; - elif echo $1 | grep -q 'ic'; then - cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')"; - else - cryptfsName=$1; - fi - if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then - mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}'); - if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then - sudo umount -R $mountPoint; - sudo cryptsetup close ${cryptfsName}; - else - sudo cryptsetup close ${cryptfsName}; - fi - else - echo "Given devices isn't opened crypt device or it was closed before"; - fi - fi -} - -function create() { - if [ $# -lt 1 ]; then help; exit 1; - else - sudo cryptsetup -y -v luksFormat $1; - fi -} - -function set_ownership(){ - if [ $# -lt 1 ]; then help; exit 1; - else - mountPoint=$(list | grep "$USER" | grep "$1" | awk '{printf $3}') - owner=$(stat -c %u $mountPoint); - if [ $owner -eq $UID ]; then - if id $USER | grep -q $UID; then - echo "User $USER is already owner of $mountPoint"; - fi - else - sudo chown ${USER}:${USER} $mountPoint; - fi - fi -} - -if [ "$1" ]; then - - case $1 in - "list") list;; - "open") if [ "$2" ]; then open $2; - else help; exit 1; - fi;; - "close") if [ "$2" ]; then close $2; - else help; exit 1; - fi;; - "create") if [ "$2" ]; then - create $2; - open $2; - set_ownership $2; - else help; exit 1; - fi;; - *) help;; - esac -else - help; exit 1; -fi diff --git a/tools/100/immudex_hostname b/tools/100/immudex_hostname deleted file mode 100755 index d147a2a..0000000 --- a/tools/100/immudex_hostname +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -vendor=$(hostnamectl | grep 'Vendor' | awk '{printf $3}') -modelLine=$(hostnamectl | grep 'Model' | awk '{printf $3}') -model=$(hostnamectl | grep 'Model' | awk '{printf $4}') - -case $vendor in - "Lenovo") vendorShort="l";; - "Dell") vendorShort="d";; - *) hName="immudex";; -esac - -case $modelLine in - "ThinkPad") mLShort="TP";; - "Latitude") mLShort="Lat";; - *) hName="immudex";; -esac - -if [ ! "$hName" ]; then - hName="${vendorShort}-${mLShort}-$model" - sudo hostnamectl set-hostname $hName; - sudo sed -i "s/immudex/${hName}/" /etc/hosts; - echo $hName | sudo tee /etc/hostname > /dev/null; -fi - diff --git a/tools/100/immudex_install b/tools/100/immudex_install deleted file mode 100755 index db1f05d..0000000 --- a/tools/100/immudex_install +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -ENDCOLOR="\e[0m"; - -while [ true ]; do - echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}"; - echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}"; - echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}"; - read ans; - if [ "$ans" = "y" ]; then break; - elif [ "$ans" = "n" ]; then exit 1; - fi -done - -set -e - -function selectDisk() { - disks=$(lsblk | grep 'disk' | awk '{printf $1" "}'); - if [ $(echo $disks | wc -w) -gt 1 ]; then - select drive in $disks; do - echo $drive; - break; - done - else - echo $disks | awk '{printf $1}'; - fi -} - -if $(sudo efibootmgr > /dev/null 2>&1); then -#uefi installation - #partitioning - echo -n "Installation immudex in EFI mode ... "; - disk=$(selectDisk); - originDisk=$disk; - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 101M 6G > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1; - sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1; - - #Setting label for partition - sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1; - - #mount root partition - sudo mount /dev/${disk}2 /media > /dev/null 2>&1; - - #creating directories for efi partition - sudo mkdir -p /media/boot/efi > /dev/null 2>&1; - - #mount efi partition - sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying whole iso image to the second partition - sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1; - - sudo sed -i '/set\ timeout=/ s/30/5/' /media/boot/grub/grub.cfg; - sudo sed -i 's/bootfrom=removable //g' /media/boot/grub/grub.cfg; - - #removing unnecessary directories from second partition - sudo rm -rf /media/isolinux > /dev/null 2>&1; - sudo rm -rf /media/EFI > /dev/null 2>&1; - - #GRUB Installation - if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then - target="i386-efi"; - else - target="x86_64-efi"; - fi - sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1; - - #Adding entry to EFI Firmware - sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1; - - #Umount all mounted filesystems - sudo umount -R /media > /dev/null 2>&1; - - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - -else -#mbr installation - echo -n "Installation immudex in BIOS mode ... "; - - #partitioning - disk=$(selectDisk); - if [ ! "$disk" ]; then exit 1; fi - - sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1; - sudo parted /dev/$disk mkpart primary 1 6G > /dev/null 2>&1; - sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1; - - #Setting label for partition is necessary for extlinux bootloader - sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1; - - #mount partition in /media directory - sudo mount /dev/${disk}1 /media > /dev/null 2>&1; - - #Creating directory for extlinux - sudo mkdir /media/extlinux > /dev/null 2>&1; - - #Instalation extlinux files in abovementioned directory - sudo extlinux --install /media/extlinux > /dev/null 2>&1; - - #mount iso image in /mnt directory - #sudo mount /dev/sr0 /mnt > /dev/null 2>&1; - - #copying live directory from iso image to partition - sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1; - - #installation extlinux MBR on first sector of hard drive (whole device) - sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1; - - #creating extlinux configuration file - cat > extlinux.conf <<EOF -default immudex -label immudex -kernel /live/vmlinuz -append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor -EOF - sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1; - rm extlinux.conf; - - #Unmounting filesystems - sudo umount /media > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi -fi diff --git a/tools/100/immudex_upgrade b/tools/100/immudex_upgrade deleted file mode 100755 index 3bf1ca0..0000000 --- a/tools/100/immudex_upgrade +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/bash - -set -e - -source library.sh - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; -root="/run/live/medium"; - -function help() { - echo "immudex_upgrade - script for searching upgrades and upgrade immudex"; - echo "morketsmerke.org @ 2023"; - echo "Options:"; - echo " --check --print - check there are upgrades for immudex"; - echo " --upgrade - check there are upgrades for immudex and install them."; - echo " If there is no new version, script will propose refreshing"; - echo " current immudex installation, its helpful when you tried"; - echo " remaster immudex and you get any trouble with this". - echo " --version - getting latest version of immudex"; - echo " --branch <stable/testing> - change immudex branch"; - echo " Switch between stable or testing version and vice versa" -} - -function main_upgrade() { - set -e - ARCH=$(get_machine_arch); - if [ ! "$BRANCH" ]; then - BRANCH=$(get_debian_branch); - fi - MIRROR=$(check_mirror); - rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}'); - sudo mount $rootPart $1 -o remount,rw; - sudo rm -f ${1}/live/*; - sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs; - sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd; - sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz; - echo "$2" > /tmp/version; - sudo cp /tmp/version ${1}/live; -} - -function check_mirror() { - mirrorList=("sourceforge.net=https://sourceforge.net/projects/immudex/files", "plikownia.zsgronowo.edu.pl=https://plikownia.zsgronowo.edu.pl/pliki/Nauczyciele/Administrator/files", "ftp.morketsmerke.org=https://ftp.morketsmerke.org"); - for i in ${mirrorList[@]}; do - name=$(echo $i | cut -d "=" -f 1); - address=$(echo $i | cut -d "=" -f 2 | sed 's/,//'); - echo -en "Checking is ${YELLOW}${name}${ENDCOLOR} available..." 1>&2; - curl ${address}/immudex/stable/upgrades/latest/64/version > /dev/null 2>&1; - if [ $? -eq 0 ]; then - echo -e "[ ${GREEN}OK${ENDCOLOR} ]" 1>&2; - mirror=$address; - mirror_name=$name; - else - echo -e "[ ${RED}FAIL${ENDCOLOR} ]" 1>&2; - fi - done - if [ "$mirror" ]; then - echo "Choosing $mirror_name" 1>&2; - echo $mirror; - else exit 1; fi -} - -if [ "$1" ] && [ "$1" = "--check" ]; then - if [ "$2" ] && [ "$2" = "--print" ]; then - newVersion=$(check_distro_version --print); - if check_distro_version; then - echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}"; - else - echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}"; - fi - elif [ "$2" = "--mirror" ]; then - mirror=$(check_mirror); - echo $mirror; - fi -elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - newVersionTxt=$(check_distro_version --print); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if check_distro_version; then - echo -en "${YELLOW}New version " - echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) " - echo -e "of immudex is available.${ENDCOLOR}"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo "Upgrading immudex to the newest version..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "Upgrading immudex to the newest version...[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}"; - echo -e "${YELLOW}but you can copy fresh system files from latest iso image"; - echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}"; - echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo "Refreshing immudex to the latest iso image..."; - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "Refreshing immudex to the latest iso image...[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - exit 0; - fi -elif [ "$1" ] && [ "$1" = "--version" ]; then - MIRROR=$(check_mirror); - stable64=$(curl ${MIRROR}/immudex/stable/upgrades/latest/64/version 2>/dev/null) - stable32=$(curl ${MIRROR}/immudex/stable/upgrades/latest/32/version 2>/dev/null) - testing64=$(curl ${MIRROR}/immudex/testing/upgrades/latest/64/version 2>/dev/null) - testing32=$(curl ${MIRROR}/immudex/testing/upgrades/latest/32/version 2>/dev/null) - branch=$(get_debian_branch); - localVer=$(cat /run/live/medium/live/version); - if [ "$(uname -m)" = "x86_64" ]; then - arch="amd64"; - stable=$stable64; - testing=$testing64; - else - arch="i386"; - stable=$stable32; - testing=$testing32; - fi - echo "Arch: $arch"; - echo "Local: ${localVer} (${branch})"; - echo "Stable: $stable"; - echo "Testing: $testing"; -elif [ "$1" ] && [ "$1" = "--branch" ]; then - if [ "$2" ] && ([ "$2" = "stable" ] || [ "$2" = "testing" ]); then - BRANCH=$2; - ARCH=$(get_machine_arch); - export $BRANCH; - echo -en "${YELLOW}Do you really want change immudex branch (y/n):${ENDCOLOR} "; - read commit; - if [ $commit = "y" ]; then - echo "Changing immudex branch to ${BRANCH}..."; - newVersionTxt=$(curl https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version 2>/dev/null); - main_upgrade $root $newVersionTxt; - if [ $? -eq 0 ]; then echo -e "Changing immudex branch to ${BRANCH}...[ ${GREEN}OK${ENDCOLOR} ]"; fi - else - exit 1; - fi - else - help; exit 1; - fi -else - help; - exit 1; -fi diff --git a/tools/100/import_sshkeys b/tools/100/import_sshkeys deleted file mode 100755 index 3cb56ad..0000000 --- a/tools/100/import_sshkeys +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -if $(ls $HOME | grep -q '.*_rsa.*'); then - if [ -d /home/$USER/.ssh ]; then - cp -v ~/*_rsa* /home/$USER/.ssh; - else - mkdir /home/$USER/.ssh; - chmod 700 /home/$USER/.ssh; - cp -v ~/*_rsa* /home/$USER/.ssh; - fi -fi - diff --git a/tools/100/morketsmerke b/tools/100/morketsmerke deleted file mode 100755 index 7193473..0000000 --- a/tools/100/morketsmerke +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -function help() { - echo "======================================================================"; - echo "morketsmerke - script for fetch and adjust morketsmerke.net site"; - echo "as offline available source of information."; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo; - echo "Options:"; - echo " --browser - launching fetched site in default application for open" - echo " html sites"; - echo " -[-]<any_other_chars_or_strings> - print this message"; - echo "By default script open downloaded site in terminal via W3M browser with"; - echo "monochrome mode"; - echo; - echo "Usage:"; - echo " $ morketsmerke [--browser]"; -} - -function R() { - - if [ "$path" ]; then path=${path}/${1}; - else path=$1; - fi - - fileList=$(ls $path); - for file in $fileList; do - if [ -d ${path}/${file} ]; then R ${file}; - else - sed -i 's@https://morketsmerke.github.io/@/usr/share/doc/morketsmerke/index.html@' ${path}/${file}; - sed -i 's@https://morketsmerke.github.io@/usr/share/doc/morketsmerke/index.html@' ${path}/${file}; - sed -i 's@/style.css@/usr/share/doc/morketsmerke/style.css@' ${path}/${file}; - fi - done - path=$(echo $path | sed "s@/$1@@") - -} - -function install_morketsmerke() { - - if [ -d morketsmerke.github.io ]; then rm -rf morketsmerke.github.io; fi - if [ ! -d morketsmerke.github.io ]; then - git clone https://github.com/morketsmerke/morketsmerke.github.io; - else - exit 1; - fi - - R morketsmerke.github.io - - if [ -d /usr/share/doc/morketsmerke ]; then - sudo rm -rf /usr/share/doc/morketsmerke; - fi - - sudo mv morketsmerke.github.io /usr/share/doc/morketsmerke - -} - -/usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1; -if [ $? -eq 0 ]; then install_morketsmerke; fi - -morketsmerke_path=/usr/share/doc/morketsmerke; - -if [ "$1" ] && [ "$1" = "--browser" ]; then - xdg-open ${morketsmerke_path}/index.html; -elif [ "$1" ]; then - help; - exit 1; -else - w3m -M ${morketsmerke_path}/index.html; -fi diff --git a/tools/100/motd2 b/tools/100/motd2 deleted file mode 100755 index da11dcc..0000000 --- a/tools/100/motd2 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -/usr/bin/figlet immudex; -echo; -echo "Today is: $(date)"; -echo; -echo "System summary: "; -cpuIdle=$(vmstat | tail -1 | awk '{printf $15}'); -cpuUsage=$((100 - $cpuIdle)); -echo -e " \tCPU: ${cpuUsage}%"; -echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free"; -if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then - i=1; - echo -e " \tCRYPT_PARTi: Free/Total (Usage%)"; - amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}'); - while [ $i -le $amountOfDisks ]; do - diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}'); - diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}'); - diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}'); - #FCP = First Crypt Partition - echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)"; - i=$((i + 1)); - done -else - echo -e " \tCRYPT_PART: N/A"; -fi -echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')"; -utime=$(uptime | awk '{printf $3}' | sed 's/,//'); -if $(echo $utime | grep -q ":"); then - echo -e " \tUPTIME: ${utime}"; -else - echo -e " \tUPTIME: 0:${utime}"; -fi -echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])"; -echo; -echo -e "morketsmerke.org @ 2023 https://github.com/xf0r3m/immudex"; -echo; -#/usr/local/bin/immudex_upgrade --check --print; -#if [ $? -ne 0 ]; then -# echo -e "\e[31mThere is no internet connection or internal error.\e[0m"; -# if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then -# rm -f /tmp/feed.xml; -# fi -#else -# if [ "$USER" = "xf0r3m" ]; then -# sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log; -# fi -#fi -echo "===================================================================="; diff --git a/tools/100/newsfeed b/tools/100/newsfeed deleted file mode 100755 index a3a426a..0000000 --- a/tools/100/newsfeed +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -function help() { - echo "newsfeed - fetch and browse news feed from rss and atom channels"; - echo "morketsmerke.net; COPYLEFT @ 2022"; - echo; - echo "Options:"; - echo " --list - shows numbered list of names, saved in ~/.newsfeed names and"; - echo " URL of rss channels"; - echo " --check - fetching new rss channel file from source"; - echo " --show <number_of_channel> - shows numbered list of news titles."; - echo " Number of channel you can get from --list option."; - echo " --open <number_of_title> - open web browser on link, which are under"; - echo " titles of news on rss channel. Number of title you can get"; - echo " from --show option. This option based on the last showed rss"; - echo " channel feed."; - echo; - echo "The ~/.newsfeed file:"; - echo " This file is simple csv (semicolon separated values) file which"; - echo " store rss channels in one line. One by one. The one line"; - echo " contains: name and URL of rss feed. For example:"; - echo; - echo " News Feed;https://newsfeed.example.org/rss"; -} -if [ ! -s ~/.newsfeed ]; then - help; - exit 1; -else - if [ ! "$1" ] || ([ "$1" != "--list" ] && \ - [ "$1" != "--check" ] && \ - [ "$1" != "--show" ] && \ - [ "$1" != "--open" ]); then - help; - exit 1; - fi - amountOfSubscriptions=$(cat ~/.newsfeed | wc -l); - i=1; - while [ $i -le $amountOfSubscriptions ]; do - newsfeedLine=$(sed -n "${i}p" ~/.newsfeed); - nameOfSubscription=$(echo $newsfeedLine | cut -d ";" -f 1); - rssLink=$(echo $newsfeedLine | cut -d ";" -f 2); - if [ "$1" ] && [ "$1" = "--list" ]; then - echo -e "${i}. ${nameOfSubscription}"; - elif [ "$1" ] && [ "$1" = "--check" ]; then - echo -e "${i}. ${nameOfSubscription}"; - echo -n "Getting news feed..."; - wget $rssLink -O /tmp/new_newsfeed_${i}.xml 2>/dev/null; - if [ $? -eq 0 ]; then echo "[ OK ]"; - else echo -e "\nThere is no Internet connection"; exit 1; fi - if [ -s /tmp/newsfeed_${i}.xml ]; then - amountOfNewNewses=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | grep '<title>' | wc -l); - if [ $amountOfNewNewses -gt 0 ]; then - notify-send "$nameOfSubscription" "New $amountOfNewNewses newses" --icon=/usr/share/icons/rss.png; - j=1; - sleep 1; - while [ $j -le $amountOfNewNewses ]; do - news=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | \ - grep '<title>' | sed -n "${j}p" | sed 's/<title>//' | \ - sed 's/<\/title>//' | sed 's/[<>]//' | \ - sed 's/^[[:space:]]*//g'); - notify-send "newsfeed" "${nameOfSubscription}: ${news}" -t 10000 --icon=/usr/share/icons/rss.png; - sleep 1; - j=$((j + 1)); - done - fi - mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml; - else - mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml; - amountOfNews=$(grep '<title>' /tmp/newsfeed_${i}.xml | sed -n '2,$p' | wc -l); - if [ $amountOfNews -eq 0 ]; then - compressed=1; - amountOfNews=$(sed 's/<\/title>/\n/g' /tmp/newsfeed_${i}.xml | sed 's/<item>/\n/g' | grep '<title>' | wc -l) - fi - notify-send "$nameOfSubscription" "New $amountOfNews newses" --icon=/usr/share/icons/rss.png; - fi - fi - i=$((i + 1)); - done - if [ "$1" ] && [ "$1" = "--show" ] && [ "$2" ] && [ $2 -gt 0 ]; then - - #Parsing - #Thanks to the linuxhint.com for command: - #sed 's/^[[:space]]*//g' - #https://linuxhint.com/trim_string_bash - - if grep -q 'CDATA' /tmp/newsfeed_${2}.xml; then - sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \ - sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \ - sed 's/<title>//' | sed 's/"/"/g' | \ - sed 's/<!\[CDATA\[//g' | sed 's/\]\]>//g' | \ - sed 's/^[[:space:]]*//g' | nl | less; - else - sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \ - sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \ - sed 's/<title>//' | sed 's/"/"/g' | \ - sed 's/^[[:space:]]*//g' | nl | less; - fi - echo $2 > /tmp/lastShowedNewsFeed; - elif [ "$1" ] && [ "$1" = "--open" ] && [ "$2" ] && [ $2 -gt 0 ]; then - subscriptionNumber=$(cat /tmp/lastShowedNewsFeed); - if ! grep -q 'CDATA' /tmp/newsfeed_${subscriptionNumber}.xml; then - link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/title>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p") - else - link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/description>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p") - fi - exo-open --launch WebBrowser "$link"; - fi -fi diff --git a/tools/100/notifier b/tools/100/notifier deleted file mode 100755 index d658ba0..0000000 --- a/tools/100/notifier +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -source library.sh; - -if [ "$1" ]; then - case $1 in - "distro") if check_distro_version; then - msg=$(check_distro_version --print); - notify-send -i software-update-urgent "Distribution update" "New version (${msg}) of immudex is available to upgrade."; - else - msg=$(check_distro_version --print); - notify-send -i apply "Distribution update" "This (${msg}) is the latest version of immudex."; - fi;; - "packages") msg=$(sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;); - notify-send -i software-update-available "Packages update" "$msg";; - esac -fi - diff --git a/tools/100/pl b/tools/100/pl deleted file mode 100755 index 34efee5..0000000 --- a/tools/100/pl +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -if [ "$1" ] && [ $1 = "--video" ]; then - video=1; - shift; - if [ $# -gt 1 ]; then format=$1; shift; file=$1; - else format="best"; file=$1; fi -else - file=$1; -fi - -function help() { - echo "pl - Play Links. Skrypt to odtwarzania multimediów z listy linków"; - echo "morketsmerke.org; COPYLEFT; 2023"; - echo; - echo "Opcje:"; - echo; - echo -e "\t--video [format] - możliwość odtwarzania linków jako filmów. Format"; - echo -e "\tjest opcjonalny, w przypadku jego braku, domyślnym formatem jest"; - echo -e "\t'best'."; - echo; - echo "Użycie:"; - echo -e "\t$ pl sciezka/do/listy/linkow"; - echo; - echo "Format listy:"; - echo -e "\tnazwa linku: https://youtube.com/..."; -} - -if [ "$1" ]; then - PS3="Link: "; - linkNames=$(cut -d ":" -f 1 $1 | sed 's/\ /_/g' | awk '{printf $1" "}') - select name in $linkNames; do - if [ ! "$name" ]; then break; fi - link=$(grep "$name" $file | cut -d ":" -f 2-); - if [ ! "$link" ]; then - linkName=$(echo $name | sed 's/_/\ /g'); - link=$(grep "$linkName" $file | cut -d ":" -f 2-); - fi - if echo $link | grep -q "youtube"; then - if [ "$video" ]; then - ytplay -v $link -f $format; - else - ytplay -a $link -f best[height=360]; - fi - else - mpv --no-video $link; - fi - done -else - help; - exit 1; -fi diff --git a/tools/100/secured-firefox b/tools/100/secured-firefox deleted file mode 100755 index 4041e89..0000000 --- a/tools/100/secured-firefox +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ ! -d /tmp/${USER} ]; then - mkdir /tmp/${USER} - cp -prvv /home/${USER}/.mozilla /tmp/${USER} -fi - -eth0=$(ip route show | grep 'default' | awk '{printf $5}'); -firejail --private=/tmp/${USER} --net=$eth0 /usr/bin/firefox diff --git a/tools/100/shoutcasts b/tools/100/shoutcasts deleted file mode 100755 index 888ef1b..0000000 --- a/tools/100/shoutcasts +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -echo -n "What are you wanna listen? "; -read search; - -function getDataBetweenHtmlMarks() { - grep "$1" $2 | sed -n "${3}p" | cut -d ">" -f 2 | cut -d "<" -f 1; -} -wget http://dir.xiph.org/search?q=$search -O /tmp/shcast_dir.html >> /dev/null 2>&1; -if [ ! -s /tmp/shcast_dir.html ]; then - echo -e "\e[31mThere is no internet connection.\e[0m"; - exit 1; -else - amountOfStations=$(grep 'card-title' /tmp/shcast_dir.html | wc -l); - i=1; - while [ $i -le $amountOfStations ]; do - stationName=$(getDataBetweenHtmlMarks 'card-title' /tmp/shcast_dir.html ${i}); - whatIsPlaying=$(getDataBetweenHtmlMarks 'card-subtitle' /tmp/shcast_dir.html ${i}); - echo -e "${i}. \e[33m${stationName}\e[0m"; - echo -e " \e[32m${whatIsPlaying}\e[0m"; - i=$((i + 1)); - done - echo -n "Pick a one: "; - read numberOfStation; - echo $(grep 'Play' /tmp/shcast_dir.html | sed -n "${numberOfStation}p" | cut -d '"' -f 2) | xclip -selection c; - echo "Station URL was copied to clipboard"; - -fi diff --git a/tools/100/sync.sh b/tools/100/sync.sh deleted file mode 100644 index 9d7c64a..0000000 --- a/tools/100/sync.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -source ~/.sync.d/sync.conf; - -if [ ! -d "${HOME}/${ldirectory}" ]; then mkdir "${HOME}/${ldirectory}"; fi - -function printhelp { - - echo "Skrypt szybkiej synchronizacji katalogu zdalnego"; - echo "morketsmerke.org"; - echo "2023; COPYLEFT; ALL RIGHTS REVERSED"; - echo ""; - echo "push - Przesłanie danych z katalogu lokalnego na katalog zdalny"; - echo "pull - Pobranie zawartości katalogu zdalnego do katalogu lokalnego"; - echo "Plik konfiguracyjny musi znajdować się na ścieżce: ~/.sync.d/sync.conf"; - echo "Przykładowy plik konfiguracyjny znajduje się na ścieżce: /usr/share/sync.sh/sync.conf"; -} -if [ ! "$1" ]; then - - printhelp; - exit 1; - -else - if [ "$1" = "push" ]; then - - echo "[*] Synchronizacja: local -> remote"; - rsync -avu ${HOME}/${ldirectory}/* ${ruser}@${server}:${rdirectory}; - - elif [ "$1" = "pull" ]; then - - echo "[*] Synchronizacja remote -> local"; - rsync -avu ${ruser}@${server}:${rdirectory}/* ${HOME}/${ldirectory}; - - else - printhelp; - exit 1; - fi - -fi diff --git a/tools/100/ytplay b/tools/100/ytplay deleted file mode 100755 index 474a864..0000000 --- a/tools/100/ytplay +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "ytplay - script which could play a video or audio track from youtube"; - echo "morketsmerke.net COPYLEFT @ 2022"; - echo "Options:"; - echo " -s - search given keyword on youtube."; - echo " -v - play youtube video." - echo " -a - play only youtube video audiotrack"; - echo "Ommiting -s option, assume you are give a yt video link."; - echo "You have to put -v or -a before you paste a yt video link"; - echo "When you put keywords in -s option, you need to choose"; - echo "that you want listening an audiotrack (-a) oraz watch video (-v)"; - echo "Usage:"; - echo " $ ytplay -s -a [-f ytdl-format] 'lofi'"; - echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]"; - echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]"; - echo "You can search again the same keywords puting 'r' or 'R' instead"; - echo "of video numer"; -} - -function yt_search() { - query=$(echo $* | sed 's/ /+/g'); - echo -n "Getting youtube site with search results..."; - wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - - sed -i 's/,/\n/g' /tmp/yt.html; - - listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}'); - - numberOfListElements=$(echo $listOfVideos | wc -w); - i=1; - lp=1; - while [ $i -le $numberOfListElements ]; do - if [ $i -eq $numberOfListElements ]; then - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2='$'; - else - j=$((i + 1)); - ln1=$(echo $listOfVideos | cut -d " " -f $i); - ln2=$(echo $listOfVideos | cut -d " " -f $j); - fi - #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then - # i=$((i + 1)); continue; - #else - title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8); - channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8); - duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4); - if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi - videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4); - if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then - echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}"; - echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv; - else - i=$((i + 1)); continue; - fi - #fi - i=$((i + 1)); - lp=$((lp + 1)); - done -} - -if [ "$1" ]; then - if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then - mode=$1; - shift; - link=$(echo $1 | sed 's@https://@@'); - if [ $# -gt 1 ]; then - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--no-video --ytdl-format=${1}"; - else - format="--ytdl-format=${1}"; - fi - fi - fi - elif [ "$1" = "-s" ]; then - if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi - if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi - - shift; - mode=$1; - if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi - shift; - if [ "$1" = "-f" ]; then - shift; - if [ "$mode" = "-a" ]; then - format="--no-video --ytdl-format=${1}"; - else - format="--ytdl-format=${1}"; - fi - fi - while [ true ]; do - yt_search $*; - echo -n "Put number of which video you want to hear/watch: "; - read numberOfVideo; - if [[ $numberOfVideo -gt 0 ]]; then break; - elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then - continue; - else - help; - exit 1; - fi - done - title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3); - channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4); - duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5); - videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2); - clear; - echo -e "Title: ${GREEN}${title}${ENDCOLOR}"; - echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}"; - echo "===================================================================="; - link=${videoId}; - else - help; - exit 1; - fi - - if [ "$mode" = "-a" ]; then - if [ ! "$format" ]; then format="--no-video --ytdl-format=best[height=360]"; fi - mpv ${format} ytdl://${link}; - elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi -else - help; - exit 1; -fi diff --git a/tools/101/immudex_hostname b/tools/101/immudex_hostname deleted file mode 100755 index 33cc30c..0000000 --- a/tools/101/immudex_hostname +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -vendor=$(hostnamectl | grep 'Vendor' | awk '{printf $3}') -modelLine=$(hostnamectl | grep 'Model' | awk '{printf $3}') -model=$(hostnamectl | grep 'Model' | awk '{printf $4}') - -case $vendor in - "Lenovo") vendorShort="l";; - "Dell") vendorShort="d";; - "Acer") vendorShort="a";; - "ASUSTeK") vendorShort="as";; - "GOOGLE") vendorShort="go";; - "QEMU") vendorShort="kvm";; - *) hName="immudex";; -esac - -case $modelLine in - "ThinkPad") mLShort="TP";; - "Latitude") mLShort="Lat";; - "AOD260") mLShort="ao"; - model="D260";; - "Candy") vendorShort="d"; - mLShort="chrbook"; - model="3120";; - "Inspiron") mLShort="Ins";; - "Standard") if [ $vendorShort = "kvm" ]; then - mLShort=$(hostnamectl | grep 'Machine ID' | awk '{print $3}' | cut -c 26-33); - model=""; - else - mlShort="Std"; - fi;; - *) hName="immudex";; -esac - -if [ ! "$hName" ]; then - hName="${vendorShort}-${mLShort}-$model" - sudo hostnamectl set-hostname $hName; - sudo sed -i "s/immudex/${hName}/" /etc/hosts; - echo $hName | sudo tee /etc/hostname > /dev/null; -fi - diff --git a/tools/101/pl b/tools/101/pl deleted file mode 100755 index e800822..0000000 --- a/tools/101/pl +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -if [ "$1" ] && [ $1 = "--video" ]; then - video=1; - shift; - if [ $# -gt 1 ]; then format="--ytdl-format=$1"; shift; file=$1; - else format="--ytdl-forma=best"; file=$1; fi -else - file=$1; -fi - -function help() { - echo "pl - Play Links. Skrypt to odtwarzania multimediów z listy linków"; - echo "morketsmerke.org; COPYLEFT; 2023"; - echo; - echo "Opcje:"; - echo; - echo -e "\t--video [format] - możliwość odtwarzania linków jako filmów. Format"; - echo -e "\tjest opcjonalny, w przypadku jego braku, domyślnym formatem jest"; - echo -e "\t'best'."; - echo; - echo "Użycie:"; - echo -e "\t$ pl sciezka/do/listy/linkow"; - echo; - echo "Format listy:"; - echo -e "\tnazwa linku: https://youtube.com/..."; -} -if [ "$1" ]; then - PS3="Link: "; - linkNames=$(cut -d ":" -f 1 $1 | sed 's/\ /_/g' | awk '{printf $1" "}') - select name in $linkNames; do - if [ "$MPVPID" ]; then kill $MPVPID; fi - if [ ! "$name" ]; then break; fi - link=$(grep "$name" $file | cut -d ":" -f 2-); - if [ ! "$link" ]; then - linkName=$(echo $name | sed 's/_/\ /g'); - link=$(grep "$linkName" $file | cut -d ":" -f 2-); - fi - if echo $link | grep -q "youtube"; then - if [ "$video" ]; then - #ytplay -v $link -f $format - mpv $format ytdl://$link > /dev/null 2>&1 & MPVPID=$! - else - #ytplay -a $link -f best[height=360] - format="--no-video --ytdl-format=best[height=360]"; - mpv $format ytdl://$link > /dev/null 2>&1 & MPVPID=$! - fi - else - mpv --no-video $link > /tmp/pl.log 2>&1 & MPVPID=$!; - tail -f /tmp/pl.log | grep "icy-title" & - fi - #echo "MPV: $MPVPID"; - done -else - help; - exit 1; -fi diff --git a/tools/105/pl b/tools/105/pl deleted file mode 100755 index 50fad5d..0000000 --- a/tools/105/pl +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -if [ "$1" ] && [ $1 = "--video" ]; then - video=1; - shift; - if [ $# -gt 1 ]; then format="--ytdl-format=$1"; shift; file=$1; - else format="--ytdl-forma=best"; file=$1; fi -else - file=$1; -fi - -function help() { - echo "pl - Play Links. Skrypt to odtwarzania multimediów z listy linków"; - echo "morketsmerke.org; COPYLEFT; 2023"; - echo; - echo "Opcje:"; - echo; - echo -e "\t--video [format] - możliwość odtwarzania linków jako filmów. Format"; - echo -e "\tjest opcjonalny, w przypadku jego braku, domyślnym formatem jest"; - echo -e "\t'best'."; - echo; - echo "Użycie:"; - echo -e "\t$ pl sciezka/do/listy/linkow"; - echo; - echo "Format listy:"; - echo -e "\tnazwa linku: https://youtube.com/..."; -} -if [ "$1" ]; then - PS3="Link: "; - linkNames=$(cut -d ":" -f 1 $1 | sed 's/\ /_/g' | awk '{printf $1" "}') - select name in $linkNames; do - if [ "$MPVPID" ]; then kill $MPVPID; fi - if [ ! "$name" ]; then break; fi - link=$(grep "$name" $file | cut -d ":" -f 2-); - if [ ! "$link" ]; then - linkName=$(echo $name | sed 's/_/\ /g'); - link=$(grep "$linkName" $file | cut -d ":" -f 2-); - fi - if echo $link | grep -q "youtube"; then - link=$(echo $link | sed 's/\ //g'); - if [ "$video" ]; then - #ytplay -v $link -f $format - mpv $format ytdl://$link > /dev/null 2>&1 & MPVPID=$! - else - #ytplay -a $link -f best[height=360] - format="--no-video --ytdl-format=best[height=360]"; - mpv $format ytdl://$link > /dev/null 2>&1 & MPVPID=$! - fi - else - mpv --no-video $link > /tmp/pl.log 2>&1 & MPVPID=$!; - tail -f /tmp/pl.log | grep "icy-title" & - fi - #echo "MPV: $MPVPID"; - done -else - help; - exit 1; -fi diff --git a/tools/0/024/autostart-x4notes b/tools/autostart-x4notes similarity index 100% rename from tools/0/024/autostart-x4notes rename to tools/autostart-x4notes diff --git a/tools/106/create_media b/tools/create_media similarity index 100% rename from tools/106/create_media rename to tools/create_media diff --git a/tools/108/idle-clic b/tools/idle-clic similarity index 100% rename from tools/108/idle-clic rename to tools/idle-clic diff --git a/tools/101/immudex_addons b/tools/immudex_addons similarity index 100% rename from tools/101/immudex_addons rename to tools/immudex_addons diff --git a/tools/100/immudex_branch b/tools/immudex_branch similarity index 100% rename from tools/100/immudex_branch rename to tools/immudex_branch diff --git a/tools/0/025/immudex_crypt b/tools/immudex_crypt similarity index 100% rename from tools/0/025/immudex_crypt rename to tools/immudex_crypt diff --git a/tools/106/immudex_hostname b/tools/immudex_hostname similarity index 100% rename from tools/106/immudex_hostname rename to tools/immudex_hostname diff --git a/tools/0/023/immudex_install b/tools/immudex_install similarity index 100% rename from tools/0/023/immudex_install rename to tools/immudex_install diff --git a/tools/0/021/immudex_upgrade b/tools/immudex_upgrade similarity index 100% rename from tools/0/021/immudex_upgrade rename to tools/immudex_upgrade diff --git a/tools/100/import_gpgkeys b/tools/import_gpgkeys similarity index 100% rename from tools/100/import_gpgkeys rename to tools/import_gpgkeys diff --git a/tools/0/013/import_sshkeys b/tools/import_sshkeys similarity index 100% rename from tools/0/013/import_sshkeys rename to tools/import_sshkeys diff --git a/tools/100/library.sh b/tools/library.sh similarity index 100% rename from tools/100/library.sh rename to tools/library.sh diff --git a/tools/100/meteo b/tools/meteo similarity index 100% rename from tools/100/meteo rename to tools/meteo diff --git a/tools/0/003/morketsmerke b/tools/morketsmerke similarity index 100% rename from tools/0/003/morketsmerke rename to tools/morketsmerke diff --git a/tools/0/012/motd2 b/tools/motd2 similarity index 100% rename from tools/0/012/motd2 rename to tools/motd2 diff --git a/tools/103/newsfeed b/tools/newsfeed similarity index 100% rename from tools/103/newsfeed rename to tools/newsfeed diff --git a/tools/0/011/notifier b/tools/notifier similarity index 100% rename from tools/0/011/notifier rename to tools/notifier diff --git a/tools/100/padlock b/tools/padlock similarity index 100% rename from tools/100/padlock rename to tools/padlock diff --git a/tools/108/pl b/tools/pl similarity index 100% rename from tools/108/pl rename to tools/pl diff --git a/tools/0/008/secured-firefox b/tools/secured-firefox similarity index 100% rename from tools/0/008/secured-firefox rename to tools/secured-firefox diff --git a/tools/0/013/shoutcasts b/tools/shoutcasts similarity index 100% rename from tools/0/013/shoutcasts rename to tools/shoutcasts diff --git a/tools/0/022/sync.sh b/tools/sync.sh similarity index 100% rename from tools/0/022/sync.sh rename to tools/sync.sh diff --git a/tools/0/025/ytplay b/tools/ytplay similarity index 100% rename from tools/0/025/ytplay rename to tools/ytplay -- 2.39.5