From: xf0r3m Date: Sun, 19 Apr 2026 11:56:27 +0000 (+0200) Subject: Usunięcie pliku immudex_hostname.service. Przeniesienie autorskich narzędzi immudex... X-Git-Url: https://gitweb.morketsmerke.org/?a=commitdiff_plain;h=ea60fd670a6adccdd59a923d4993ea990546032e;p=immudex.git Usunięcie pliku immudex_hostname.service. Przeniesienie autorskich narzędzi immudex do innych repozytoriów. Dodanie tych zmian do pliku bazowego. Dodanie pakietów do wireshark, mc oraz minicom. Przeniesienie aktualizacji yt-dlp po instalacji projektu xfcedebian i usunięcie TeamViewera. --- diff --git a/files/immudex_hostname.service b/files/immudex_hostname.service deleted file mode 100644 index c65f2e3..0000000 --- a/files/immudex_hostname.service +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Set hostname based on Hardware model -Before=display-manager.service -[Service] -Type=OneShot -ExecStart=/usr/local/sbin/immudex-hostname -RemainAfterExit=yes -[Install] -WantedBy=multi-user.target diff --git a/tools/bin/idle-clic b/tools/bin/idle-clic deleted file mode 100755 index 706b14a..0000000 --- a/tools/bin/idle-clic +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -function help() { - echo 'idle-cli - Inter-Distribution Linux Environment CLI'; - echo '@ 2023 morketsmerke.org'; - echo; - echo "Options:"; - echo " list-distros - listing available containers with Linux distros on this server"; - echo " shell - bring up the shell of given distro"; - echo " check-commmand - verify is given command exists in given distro"; - echo " apropos - finds commmands match to given keywords"; - echo " pkgsearch - check is given package is ready to install in given distro"; - echo; - echo " - pointing only one distro, but you can use also:" - echo " :"; - echo " --deb - .deb packages using distros (debian,kali,ubuntu)"; - echo " --rpm - .rpm packages using distros (fedora,rocky,opensuse)"; - echo " --other - other distros don't match to above (alpine,archlinux,gentoo,void)"; - echo " or <--all> - all 10 available distros (warning, output could be large, use some of pager)"; - echo; - echo 'Usage:'; - echo ' $ idle-clic list-distros'; - echo ' $ idle-clic shell rocky'; - echo ' $ idle-clic check-command netstat'; - echo ' $ idle-clic apropos zip'; - echo ' $ idle-clic pkgsearch "intel sound"'; - echo; - echo 'IDLE Configuration:'; - echo 'In ~/.idle/.idle.conf file (example of this file: /usr/share/idle/idle.conf)'; - echo ' RUSER="user";'; - echo ' IDLESERVER="idle.example.org";'; - echo ' SSH_OPTS="-p 10022 -i ~/id_rsa"; #OPTIONAL'; -} - -if [ -f ~/.idle/idle.conf ]; then - source ~/.idle/idle.conf; - echo "IDLE Server response:"; - if echo $@ | grep -q 'shell'; then - ssh -t ${SSH_OPTS} ${RUSER}@${IDLESERVER} "idle-clis $@"; - else - ssh ${SSH_OPTS} ${RUSER}@${IDLESERVER} "idle-clis $@"; - fi - if [ $? -eq 1 ]; then help; exit 1; fi -else - echo "There is no IDLE config file. Exiting..."; - help; - exit 1; -fi diff --git a/tools/bin/immudex-autostart-x4notes b/tools/bin/immudex-autostart-x4notes deleted file mode 100755 index 8b549b1..0000000 --- a/tools/bin/immudex-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/bin/immudex-branch b/tools/bin/immudex-branch deleted file mode 100755 index 1893bc1..0000000 --- a/tools/bin/immudex-branch +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if grep -q 'forky' /etc/os-release; then - echo -n '-testing'; -elif grep -q 'trixie' /etc/os-release; then - echo -n '-stable'; -else - echo -n '-oldstable'; -fi diff --git a/tools/bin/immudex-cdrip b/tools/bin/immudex-cdrip deleted file mode 100755 index fc3cf0b..0000000 --- a/tools/bin/immudex-cdrip +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -function XMLScrap() { - echo -n $(grep -o "<${1}>.*" $2 \ - | sed "s,<${1}>,," \ - | sed "s,,," \ - | sed 's,&,and,g'); -} - -function help() { - echo "immudex-cdrip - bash script for collection audio tracks from Audio CD."; - echo "morketsmerke.org @ 2025"; - echo; - echo "Usage:"; - echo " $ immudex-cdrip --rip-n-rename"; - echo; - echo "Options:"; - echo " --rip-only - Rips audio tracks from Audio CD, without quering CDIndex"; - echo " (MusicBrainz) database."; - echo; - echo " --get-disc-info - Getting info from CDIndex (MusicBrainz) database"; - echo " about Audio CD without ripping."; - echo; - echo " --rip-n-rename - Rips audio tracks from Audio CD, create Artist/Album folders"; - echo " and rename tracks according to data get CDIndex (MusicBrainz)"; - echo " database (normal usage)."; - echo; - echo "Script using CDDA2WAV tool from icedax package and libparanoia library (GNU/Linux Debian)."; -} - -function multipleArtistDisc() { - - FILE="$1"; - ARTIST="VA"; - ALBUM=$(XMLScrap "Title" $FILE); - NUMTRACKS=$(XMLScrap "NumTracks" $FILE); - TRACKPATH="${ARTIST} - ${ALBUM}"; - - mkdir -vp "${TRACKPATH}"; - - i=1; - while [ $i -le $NUMTRACKS ]; do - artist=$(grep -o ".*" $FILE \ - | sed -n "${i}p" \ - | sed 's,,,' \ - | sed 's,,,'); - - trackName=$(grep -o ".*" $FILE \ - | sed -n "${i}p" \ - | sed 's,,,' \ - | sed 's,,,'); - - if [ $i -lt 10 ]; then - trackNumber="0${i}"; - else - trackNumber=${i}; - fi - - audioFilename="audio_${trackNumber}.wav"; - infFilename=$(echo $audioFilename | sed 's/wav/inf/'); - - mv -v $audioFilename "${TRACKPATH}/${trackNumber}. ${artist} - ${trackName}.wav"; - rm -v ${infFilename}; - i=$(expr $i + 1); - done - - rm -v audio.cddb; - rm -v ${FILE}; -} - -if [ ! -x /usr/bin/cdda2wav ]; then - sudo apt-get install icedax cdparanoia -y; -fi - -if [ "$1" ] && [ "$1" = "--rip-only" ]; then - cdda2wav -vall cddb=-1 speed=4 -paranoia paraopts=no-verify -B -D /dev/sr0; - exit 0; -fi - -if [ "$1" ] && [ "$1" = "--get-disc-info" ]; then - cdda2wav -J -D /dev/sr0; - exit 0; -fi - -if [ "$1" ] && [ "$1" = "--rip-n-rename" ]; then - cdda2wav -vall cddb=1 speed=4 -paranoia paraopts=no-verify -B -D /dev/sr0; - - FILE="audio.cdindex"; - - if $(grep -q '' $FILE); then - multipleArtistDisc $FILE; - else - ARTIST=$(XMLScrap "Artist" $FILE); - ALBUM=$(XMLScrap "Title" $FILE); - NUMTRACKS=$(XMLScrap "NumTracks" $FILE); - TRACKPATH="${ARTIST}/${ALBUM}"; - - mkdir -vp "${TRACKPATH}"; - - i=1; - while [ $i -le $NUMTRACKS ]; do - trackName=$(grep -o ".*" $FILE \ - | sed -n "${i}p" \ - | sed 's,,,' \ - | sed 's,,,'); - - if [ $i -lt 10 ]; then - audioFilename="audio_0${i}.wav"; - trackNumber="0${i}"; - else - audioFilename="audio_${i}.wav"; - trackNumber="${i}"; - fi - infFilename=$(echo "$audioFilename" | sed 's/wav/inf/'); - mv -v $audioFilename "${TRACKPATH}/${trackNumber}. ${ARTIST} - ${trackName}.wav"; - rm -v $infFilename; - i=$(expr $i + 1); - done - - rm -v audio.cddb; - rm -v audio.cdindex; - fi - exit 0; -fi - -help; diff --git a/tools/bin/immudex-import-gpgkeys b/tools/bin/immudex-import-gpgkeys deleted file mode 100755 index 29f1e00..0000000 --- a/tools/bin/immudex-import-gpgkeys +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -if [ -f ~/public.gpg ] && [ -f ~/private.gpg ] && [ -f ~/otrust.txt ]; then - gpg --import ~/public.gpg - gpg --import ~/private.gpg - gpg --import-ownertrust ~/otrust.txt -fi diff --git a/tools/bin/immudex-import-sshkeys b/tools/bin/immudex-import-sshkeys deleted file mode 100755 index 345aebc..0000000 --- a/tools/bin/immudex-import-sshkeys +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -function help() { - echo "immudex-import-sshkeys - script for copying ssh keys into user native home directory."; - echo "@ 2025 morketsmerke.org"; - echo; - echo "Usage:"; - echo "$ immudex-import-sshkeys" - echo "This comman should be run in other home directory, where ssh keys are stored."; - echo; - echo "Options:"; - echo " --help - print this message."; - echo " --import-hosts - import hostnames and adresses to /etc/host file (sudo required)"; - echo " from SSH config file if exist."; -} - -if [ "$1" ] && [ "$1" = "--help" ]; then - help; - exit 1; -fi - -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 -if $(ls -w1 $HOME | grep -q '^config$'); then - cp -v ~/config /home/$USER/.ssh; - if [ "$1" ] && [ "$1" = "--import-hosts" ]; then - i=1; - hostsCount=$(grep -o "Host .*" ~/config | wc -l); - while [ $i -le $hostsCount ]; do - host=$(grep -o "Host .*" ~/config | sed -n "${i}p" | awk '{printf $2}'); - hostName=$(grep -o "HostName .*" ~/config | sed -n "${i}p" | awk '{printf $2}'); - echo -e "${host}\t${hostName}" | sudo tee -a /etc/hosts; - i=$(expr $i + 1); - done - fi - chmod 600 /home/$USER/.ssh/config; -fi diff --git a/tools/bin/immudex-kvm b/tools/bin/immudex-kvm deleted file mode 100755 index 8185287..0000000 --- a/tools/bin/immudex-kvm +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash - -#immudex-kvm -L|[-R URI] help|[command] [arg1]..[argX] - -if [ "$1" ] && [ "$1" = "-L" ] || [ "$1" = "-R" ]; then - if [ "$1" = "-R" ]; then - export CONNECT="$2"; - shift 2; - else - if $(sudo virsh net-list --all | grep -q '\ nieaktywne\ '); then - sudo virsh net-start default; - fi - export CONNECT="qemu:///system"; - shift; - fi -else - if $(sudo virsh net-list --all | grep -q '\ nieaktywne\ '); then - sudo virsh net-start default; - fi - export CONNECT="qemu:///system"; -fi - -function immudex-kvm-help() { - echo "immudex-kvm - script for KVM management."; - echo "morketsmerke.org @ 2024"; - echo; - echo "SYNTAX:"; - echo "$ immudex-kvm -L|[-R URI] help|[command] [arg1]..[argX]"; - echo; - echo "CONNECT:"; - echo " -L - connect with local KVM instance (qemu:///system)"; - echo " -R - connect with remote KVM instance (requires URI)"; - echo; - echo "COMMANDS:"; - echo " list - list of KVM virtual machines on this instance"; - echo " List args: "; - echo " create - create VM, with defaults settings."; - echo " Create args: "; - echo " import - create VM, with default settings, but use already existing disk."; - echo " Import args: "; - echo " start - run KVM objects."; - echo " Start args: vm /network "; - echo " connect - connect with VM console."; - echo " Connect args: "; - echo " restart - force reboot for VM."; - echo " Restart args: "; - echo " shutdown - shutting down the VM."; - echo " Shutdown args: "; - echo " poweroff - power off the VM."; - echo " Power off args: "; - echo " delete - deletes VM."; - echo " Delete args: [delete-disk]"; -} - -function immudex-kvm-list() { - if [ "$1" ]; then - case $1 in - 'vms') virsh -c $CONNECT list --all;; - 'os-types') if ! $(echo $CONNECT | grep -q 'ssh'); then - osinfo-query -f short-id,name os | grep "$2"; - else - KEYFILE=$(echo $CONNECT | cut -d "=" -f 2); - USER_HOSTNAME=$(echo $CONNECT | cut -d "/" -f 3 | cut -d ":" -f 1); - PORT=$(echo $CONNECT | egrep -o ":[0-9]+"); - if [ "$KEYFILE" ]; then - ssh -p ${PORT:=22} -i $KEYFILE $USER_HOSTNAME "osinfo-query -f short-id,name os | grep \"$2\""; - else - ssh -p ${PORT:=22} $USER_HOSTNAME "osinfo-query -f short-id,name os | grep \"$2\""; - fi - fi;; - 'networks') sudo virsh -c $CONNECT net-list --all;; - *) immudex-kvm-help;; - esac - fi -} - -function immudex-kvm-create() { - virt-install --connect $CONNECT --name=$1 --vcpus=$3 --memory=$4 --cdrom=$5 --disk=${6},bus=sata,size=${7} --graphics vnc --os-variant=$2 -} - -function immudex-kvm-import() { - virt-install --connect $CONNECT --name=$1 --vcpus=$3 --memory=$4 --disk=${5},bus=sata --os-variant=$2 --import --boot hd -} - -function immudex-kvm-connect() { - virt-viewer -c $CONNECT $1; -} - -function immudex-kvm-start() { - if [ "$1" ]; then - case $1 in - 'vm') shift; - virsh -c $CONNECT start $1;; - 'network') shift; - sudo virsh -c $CONNECT net-start $1;; - *) immudex-kvm-help;; - esac - fi - } - -function immudex-kvm-restart() { - virsh -c $CONNECT reset $1; - #polite: virsh -c $CONNECT reboot $1 -} - -function immudex-kvm-shutdown() { - virsh -c $CONNECT shutdown $1; -} - -function immudex-kvm-poweroff() { - virsh -c $CONNECT destroy $1; -} - -function immudex-kvm-delete() { - if [ "$2" ] && [ "$2" = "delete-disk" ]; then - virsh -c $CONNECT undefine $1 --storage sda; - else - virsh -c $CONNECT undefine $1; - fi -} - -if [ "$1" ] && [ "$1" = "--debug" ]; then - shift; - echo "Connect: $CONNECT"; -fi - -case "$1" in - 'list') shift; - immudex-kvm-list $@;; - 'create') shift; - immudex-kvm-create $@;; - 'import') shift; - immudex-kvm-import $@;; - 'connect') shift; - immudex-kvm-connect $1;; - 'start') shift; - immudex-kvm-start $@;; - 'restart') shift; - immudex-kvm-restart $1;; - 'shutdown') shift; - immudex-kvm-shutdown $1;; - 'poweroff') shift; - immudex-kvm-poweroff $1;; - 'delete') shift; - immudex-kvm-delete $@;; - *) immudex-kvm-help;; -esac diff --git a/tools/bin/immudex-meteo b/tools/bin/immudex-meteo deleted file mode 100755 index a536e57..0000000 --- a/tools/bin/immudex-meteo +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -function help() { - echo "immudex-meteo - prognoza pogody z wttr.in" - echo "@ 2023 morketsmerke.org"; - 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 "; -} - -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/bin/immudex-morketsmerke b/tools/bin/immudex-morketsmerke deleted file mode 100755 index 826d745..0000000 --- a/tools/bin/immudex-morketsmerke +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -function help() { - echo "======================================================================"; - echo "immudex-morketsmerke - script for fetch and adjust morketsmerke.net site"; - echo "as offline available source of information."; - echo "@ 2023 morketsmerke.org"; - 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/bin/immudex-motd2 b/tools/bin/immudex-motd2 deleted file mode 100755 index d9fce1e..0000000 --- a/tools/bin/immudex-motd2 +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -#/usr/bin/figlet immudex; -#source /usr/local/bin/library.sh; -#ascii_colors; -echo -en "\e[1m"; echo "immudex" | /usr/bin/figlet | lolcat; echo -en "\e[0m"; -#echo "immudex" | /usr/bin/figlet | lolcat -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 " \tIP: $(ip addr show $(sed -n '2p' /proc/net/route | awk '{printf $1}') | grep 'inet\ ' | awk '{printf $2"\n"}')"; -echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')"; -if $(uptime | grep -q 'day'); then - utime=$(uptime | awk '{printf $3" "$4" "$5}' | sed -e 's/\,$//' -e 's,:,h ,'); - echo -e "\tUPTIME: ${utime}m"; -else - utime=$(uptime | awk '{printf $3}' | sed -e 's/,//' -e 's,:,h ,'); - if $(echo $utime | grep -q "h"); then - echo -e " \tUPTIME: ${utime}m"; - else - echo -e " \tUPTIME: 0h ${utime}m"; - fi -fi -echo -e " \t$(uptime | grep -o "load.*$" | tr '[a-z]' '[A-Z]')"; -echo; -echo -e "morketsmerke.org @ 2025 https://github.com/xf0r3m/immudex"; -echo; -echo "===================================================================="; diff --git a/tools/bin/immudex-padlock b/tools/bin/immudex-padlock deleted file mode 100755 index 5ee8685..0000000 --- a/tools/bin/immudex-padlock +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -launcher="/home/${USER}/.config/xfce4/panel/launcher-14/16844255236.desktop"; - -function main_unlock() { - sudo /usr/bin/immudex-crypt --open=$1; - index=$(basename $(sudo /usr/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/padlock-icon/changes-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 | grep 'immudex-*' | 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/changes-allow/padlock-icon/' ${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 | grep 'immudex-*' | awk '{printf $1" "}'); - -if [ "$mapperDeviceList" ]; then lock; -else unlock; -fi diff --git a/tools/bin/immudex-pl b/tools/bin/immudex-pl deleted file mode 100755 index 222cabe..0000000 --- a/tools/bin/immudex-pl +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -RED="\e[31m"; -ENDCOLOR="\e[0m"; - -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 "immudex-pl - Play Links. Skrypt to odtwarzania multimediów z listy linków"; - echo "@ 2023 morketsmerke.org"; - 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 [http(s)://adres/lub/]sciezka/do/listy/linkow"; - echo; - echo "Format listy:"; - echo -e "\tnazwa linku: https://youtube.com/..."; -} - -if echo $file | grep -q 'http'; then - echo -n "Getting link list..."; - wget -q $file -O /tmp/playlist.txt; - if [ $? -eq 0 ]; then - echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; - file="/tmp/playlist.txt"; - else - echo -e "[ ${RED}FAIL${ENDCOLOR} ]"; - help; - exit 1; - fi -fi - -if [ "$file" ]; then - PS3="Link: "; - linkNames=$(cut -d ":" -f 1 $file | 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 - -if [ -f /tmp/playlist.txt ]; then - rm /tmp/playlist.txt; -fi diff --git a/tools/bin/immudex-protected b/tools/bin/immudex-protected deleted file mode 100755 index e0346db..0000000 --- a/tools/bin/immudex-protected +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -mapperDevice=$(ls /dev/mapper --hide=control | head -1 | awk '{printf $1" "}') - -if [ "$mapperDevice" ]; then - if mount | grep -q "$mapperDevice"; then - notify-send "Protected" "The $(basename $1) cannot be run, because your LUKS partitions are open" --icon=dialog-error - exit 1; - fi -else - $1; -fi diff --git a/tools/bin/immudex-protected-firefox b/tools/bin/immudex-protected-firefox deleted file mode 100755 index 89b6a85..0000000 --- a/tools/bin/immudex-protected-firefox +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -/usr/local/bin/immudex-protected /usr/lib/firefox-esr/firefox-esr diff --git a/tools/bin/immudex-run b/tools/bin/immudex-run deleted file mode 100755 index b92b8bb..0000000 --- a/tools/bin/immudex-run +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -export HOME=/ic0; -export XDG_CONFIG_HOME=/ic0; -export XDG_CACHE_HOME=/ic0/.cache; -export XDG_CONFIG_DIRS=/ic0/.config; - -program=$1; -shift; -args="$@"; - -$(which $program) ${args}; diff --git a/tools/bin/immudex-secured-firefox b/tools/bin/immudex-secured-firefox deleted file mode 100755 index 94a1f30..0000000 --- a/tools/bin/immudex-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/lib/firefox-esr/firefox-esr diff --git a/tools/bin/immudex-secured-librewolf b/tools/bin/immudex-secured-librewolf deleted file mode 100755 index cfc6676..0000000 --- a/tools/bin/immudex-secured-librewolf +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ ! -d /tmp/${USER} ]; then - mkdir /tmp/${USER} - cp -prvv /home/${USER}/.librewolf /tmp/${USER} -fi - -eth0=$(ip route show | grep 'default' | awk '{printf $5}'); -firejail --private=/tmp/${USER} --net=$eth0 /usr/bin/librewolf diff --git a/tools/bin/immudex-shoutcasts b/tools/bin/immudex-shoutcasts deleted file mode 100755 index 888ef1b..0000000 --- a/tools/bin/immudex-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/bin/immudex-unlock-ds b/tools/bin/immudex-unlock-ds deleted file mode 100755 index 2d139a0..0000000 --- a/tools/bin/immudex-unlock-ds +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -function help() { -echo "immudex-unlock-ds - Shell script for unlocking data store (cryptfs)."; -echo "@ 2023 morketsmerke.org" -echo; -echo "This script will unmount every file system mounted in cryptfs. If FS is"; -echo "locked then will kill every process that have opened file in that FS and"; -echo "finally in cryptfs unlocking him also. So use wisely."; -echo; -echo "Options: "; -echo " -h - This message"; -} - -# Function that getting PID of processes that have open file in DS -function getPids() { - sudo lsof 2>/dev/null | grep "$@" | awk '{printf $2"\n"}' | sort | uniq | awk '{printf $1" "}'; -} - -# Reading argv[1] to get help message"; -if [ "$1" ] && [ "$1" = "-h" ]; then - help; - exit 1; -fi - -# Disclaimer and question about continuing -echo "This script will unmount every file system mounted in cryptfs. If FS is"; -echo "locked then will kill every process that have opened file in that FS and"; -echo "finally in cryptfs unlocking him also. So use wisely."; -echo -n "Do you wish to contiue? (y/n):"; -read -n 1 cont; -if [ "$cont" != "y" ]; then exit 1; fi - - -dataStoresMountPoints=$(immudex-crypt list | grep 'immudex-crypt[0-9]*' | awk '{printf $3" "}'); -for dataStoreMountPoint in $dataStoresMountPoints; do - # Check is there any file system mounted inside data store. - mountPointsInDS=$(df | grep "${dataStoreMountPoint}/.*" | awk '{printf $6" "}'); - for mountPoint in $mountPointsInDS; do - # Try to umount FS in DS - sudo umount $mountPoint >> /dev/null 2>&1; - if [ $? -ne 0 ]; then - # Try to unlock mounted FS by killing processes that have open files - # inside mount point. - sudo kill $(getPids $mountPoint); - # Try umount FS once again. - sudo umount $mountPoint >> /dev/null 2>&1; - if [ $? -ne 0 ]; then - # FS are still mounted. Try to send a SIGKILL signal to them. - sudo kill -9 $(getPids $mountPoint); - # Try umount once again. - sudo umount $mountPoint >> /dev/null 2>&1; - if [ $? -ne 0 ]; then - echo "File systems mounted in data store are still lock. Needs user intervention"; - exit 1; - else - echo "The $mountPoint was unmounted."; - fi - else - echo "The $mountPoint was unmounted."; - fi - else - echo "The $mountPoint was unmounted."; - fi - done - # Check there are processes that have opened file from data store. - pidsList=$(getPids $dataStoreMountPoint); - if [ $(echo $pidsList | wc -w) -gt 0 ]; then - sudo kill $pidsList; - # Refresh pidsList - pidsList=$(getPids $dataStoreMountPoint); - if [ $(echo $pidsList | wc -w) -gt 0 ]; then - sudo kill -9 $pidsList; - pidsList=$(getPids $dataStoreMountPoint); - if [ $(echo $pidsList | wc -w) -eq 0 ]; then - echo "Data store: $dataStoreMountPoint is unlocked."; - else - echo "Data store: $dataStoreMountPoint is still locked. Needs user intervention"; - fi - else - echo "Data store: $dataStoreMountPoint is unlocked."; - fi - else - echo "Data store: $dataStoreMountPoint isn't locked. Nothing to do."; - fi -done diff --git a/tools/bin/immudex-version b/tools/bin/immudex-version deleted file mode 100755 index 67be301..0000000 --- a/tools/bin/immudex-version +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -eval $(grep '^COMMIT' /run/live/medium/live/changelog) -echo $COMMIT | awk '{printf $1}' | cut -c 1-7 diff --git a/tools/bin/immudex-ytplay b/tools/bin/immudex-ytplay deleted file mode 100755 index 272fe41..0000000 --- a/tools/bin/immudex-ytplay +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -BLUE="\e[34m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "immudex-ytplay - script which could play a video or audio track from youtube"; - echo "@ 2023 morketsmerke.org"; - 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/bin/immudex-ytplay2 b/tools/bin/immudex-ytplay2 deleted file mode 100755 index 2ccf90e..0000000 --- a/tools/bin/immudex-ytplay2 +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import subprocess -from youtube_search import YoutubeSearch - -def usage(): - - print( - ''' - immudex-ytplay - script which could play a video or audio track from youtube - @ 2023 (original bash script), 2025 (python script) morketsmerke.org - Options: - -s - search given keyword on youtube. - -v - play youtube video. - -a - play only youtube video audiotrack - Ommiting -s option, assume you are give a yt video link. - You have to put -v or -a before you paste a yt video link - When you put keywords in -s option, you need to choose - that you want listening an audiotrack (-a) oraz watch video (-v) - Usage: - $ immudex-ytplay -s -a [-f ytdl-format] 'lofi' - $ immudex-ytplay -v https://youtube.com/watch?v=... [-f ytdl-format] - $ immudex-ytplay -a https://youtube.com/watch?v=... [-f ytdl-format] - You can search again the same keywords puting 'r' or 'R' instead - of video numer - ''') - -def ytSearch(keywords, maxResults=15): - - i = "r" - while isinstance(i, str) and (i == "r" or i == "R"): - subprocess.run('clear') - results = YoutubeSearch(keywords, max_results=maxResults).to_dict() - - index = 1 - for video in results: - print(f"\033[1m\033[91m{index}\033[0m. Title: \033[92m{video['title']}\033[0m") - print(f" Channel: \033[93m{video['channel']}\033[0m, Duration: \033[94m{video['duration']}\033[0m, PubDate: \033[95m{video['publish_time']}\033[0m") - index += 1 - - i = input("Put number of video you wanna watch or put 'r' to reload search result: ") - - i = int(i) - 1 - return(results[i]['id'], results[i]['title'], results[i]['channel'], results[i]['duration'], results[i]['publish_time']); - -if sys.argv[1] == '-s': - if len(sys.argv) > 2: - if sys.argv[2] == '-v': - mode = "video" - elif sys.argv[2] == '-a': - mode = "audio" - else: - usage() - sys.exit(2) - if len(sys.argv) > 3: - if sys.argv[3][0:5] == "best[": - ytFormat=sys.argv[3] - else: - ytFormat = "best" - keywords=sys.argv[3] - if len(sys.argv) > 4: - keywords = sys.argv[4] - - #link = f"https://youtube.com/watch?v={ytSearch(keywords)}" - video = ytSearch(keywords) - #print(video) - subprocess.run('clear') - print(f"\033[91m1\033[0m. Title: \033[92m{video[1]}\033[0m") - print(f" Channel: \033[93m{video[2]}\033[0m, Duration: \033[94m{video[3]}\033[0m, PubDate: \033[95m{video[4]}\033[0m") - print("===================================================================") - if mode == 'audio': - ytFormat = "--no-video" - else: - ytFormat = "--ytdl-format=" + ytFormat - - subprocess.run(['mpv', ytFormat, 'ytdl://' + video[0]]) - -elif sys.argv[1] == '-a': - if len(sys.argv) > 2: - link=sys.argv[2] - ytFormat="--no-video" - subprocess.run(['mpv', ytFormat, 'ytdl://' + link]) - else: - usage() - sys.exit(2) - -elif sys.argv[1] == '-v': - if len(sys.argv) > 2: - link=sys.argv[2] - if len(sys.argv) > 3: - ytFormat="--ytdl-format=" + sys.argv[3] - else: - ytFormat="--ytdl-format=best" - subprocess.run(['mpv', ytFormat, 'ytdl://' + link]) - else: - usage() - sys.exit(2) diff --git a/tools/bin/library.sh b/tools/bin/library.sh deleted file mode 100755 index 2e50210..0000000 --- a/tools/bin/library.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -function get_debian_branch() { - if grep -q 'trixie' /etc/os-release; then - echo "testing"; - elif grep -q 'bookworm' /etc/os-release; then - echo "stable"; - else - echo "oldstable"; - fi -} - -function get_machine_arch() { - arch=$(uname -m); - if [ "$arch" = "i686" ]; then - echo "32"; - else - echo "64"; - fi -} - -function check_distro_commit() { - versionFile="/run/live/medium/live/version"; - if [ -f $versionFile ]; then - localVersion=$(cat $versionFile); - if [ -d /tmp/immudex ]; then - $(cd /tmp/immudex && git pull -q); - else - git clone -q https://github.com/xf0r3m/immudex /tmp/immudex; - fi - latestVersion=$(cd /tmp/immudex && git log --pretty=oneline | head -1 | cut -d " " -f 1); - if [ "$1" ] && [ "$1" == "--print" ]; then - echo "$(cd /tmp/immudex && git log ${localVersion}..${latestVersion})"; - fi - if [ "$localVersion" = "$latestVersion" ]; then - return 0; - else - return 1; - fi - else - return 255; - fi -} - -function ascii_colors() { - - BLUE="\e[1;94m"; - RED="\e[1;91m"; - CYAN="\e[1;96m"; - ENDCOLOR="\e[0m"; - - echo -e "${BLUE} _ ${RED} _ ${CYAN} ${ENDCOLOR}"; - echo -e "${BLUE}(_)_ __ ___ _ __ ___ _ _ ${RED} __| | ___${CYAN}__ __${ENDCOLOR}"; - echo -e "${BLUE}| | '_ \` _ \| '_ \` _ \| | | |${RED}/ _\` |/ _ \\\\${CYAN} \/ /${ENDCOLOR}"; - echo -e "${BLUE}| | | | | | | | | | | | |_| |${RED} (_| | __/${CYAN}> < ${ENDCOLOR}"; - echo -e "${BLUE}|_|_| |_| |_|_| |_| |_|\__,_|${RED}\__,_|\___/${CYAN}_/\_\\"; - echo -e "${ENDCOLOR}"; - -} diff --git a/tools/bin/sync.sh b/tools/bin/sync.sh deleted file mode 100644 index f1855ec..0000000 --- a/tools/bin/sync.sh +++ /dev/null @@ -1,195 +0,0 @@ -#!/bin/bash - -#Config file: -source ~/.sync.d/sync.conf; - -#Script file: - -# Check there is a notify-send program installed on the system -which notify-send -isNotifySend=$? - -#Function section: - -# Check is local directory is a Git repository -function is_ldir_a_git_repo() { - cd ${LDIR} - git status > /dev/null 2>&1; - return $?; -} - -# Check is local directory is a clone of remote directory (just git clone) -function is_ldir_a_rdir_clone() { - cd ${LDIR}; - git remote get-url origin | grep -q ${RDIR} - return $?; -} - -# Push changes to remote repo -function update_rdir() { - cd ${LDIR}; - git add --all; - git commit -m "Pushing changes."; - git push -u origin main; - if [ $? -eq 0 ]; then - output "Remote directory is now up to date." "ok"; - return 0; - else - output "Problem ocurred when trying update remote directory" "warn"; - return 1; - fi -} - -# Create git repo on local directory -function initialize_ldir_git() { - cd ${LDIR}; - git init -b main; - git remote add origin ssh://${RUSER}@${RSERVER}${RDIR}; - return $?; -} - -# Clone local directory from remote repo. Just clone. -function clone_rdir() { - git clone ssh://${RUSER}@${RSERVER}${RDIR} ${LDIR} - if [ $? -eq 0 ]; then - output "Local directory was already cloned from remote directory." "ok"; - else - output "Problem ocurred when trying to clone remote directory." "warn"; - fi -} - -# Getting info about local dir updates, before pull -function get_update_info() { - cd ${LDIR}; - git remote update > /dev/null 2>&1; -} - -# Determining on git status hints, there updates for local directory -function is_ldir_need_to_update() { - cd ${LDIR}; - git status | grep -q 'git pull'; - return $?; -} - -# Here is the same as above, but to other side -function is_rdir_need_to_update() { - cd ${LDIR}; - git status | grep -Eq 'git add|git push' - return $?; -} - -# Pulling commits from remote repo -function update_ldir() { - cd ${LDIR}; - git pull > /dev/null 2>&1; - if [ $? -eq 0 ]; then - output "Local directory now is up to date." "ok"; - else - output "Problem occured when trying update local directory." "warn"; - fi -} - -# Hard to get this, if u using repos in normal way. The most popular way to get -# this isn't even implemented in this script. For future use, maybe. -function is_ther_conflict() { - cd ${LDIR}; - git push -u origin main | grep -q 'rejected'; - if [ $? -eq 0 ]; then - output "Conflict ocurred. There are significant diffrences betwen local and remote dirs. Move changes outside local directory and delete him. Try synchronize dirs once again and put changes back" "bad"; - else - output "Problem ocurred when trying update remote directory." "warn"; - fi -} - -# Simple way to comunicate with user. If u have notify-send command, you get -# notifications, if not just type messages in stdout in terminal. -function output() { - argv1=$@; - icon=$(echo $argv1 | sed 's,\ ,\n,g' | tail -1); - msg=$(echo $argv1 | sed -e "s,\ $icon,,g" -e 's/^[[:space:]]*//g'); - - if [ "$icon" = "ok" ]; then - nsIcon="emblem-synchronizing"; - elif [ "$icon" = "warn" ]; then - nsIcon="dialog-warning"; - elif [ "$icon" = "bad" ]; then - nsIcon="process-stop"; - fi - - if [ $isNotifySend -eq 0 ]; then - notify-send "Sync" "$msg" --icon=$nsIcon - else - echo "$msg"; - fi -} - -# Authentication with PKI is required, for this script, so if don't point any -# key in config file, script will generate one pair and try upload them to the -# server. -if [ ! "$KEYFILE" ]; then - ssh-keygen -f ${HOME}/id_rsa - ssh-copy-id ${SSHOPTS} -i ${HOME}/id_rsa ${RUSER}@${RSERVER} -fi - -# Check there is a remote directory -ssh ${SSHOPTS} ${RUSER}@${RSERVER} "[ -d ${RDIR} ]"; -if [ $? -ne 0 ]; then - # If not, create the hole path and initialize remote dir as Git repository. - ssh ${SSHOPTS} ${RUSER}@${RSERVER} "mkdir -p ${RDIR}" - ssh ${SSHOPTS} ${RUSER}@${RSERVER} "cd ${RDIR} && git init --bare -b main"; - # Empty repo flag - empty=0 -fi - -# Initializing local directory -if [ ! -d ${LDIR} ] && [ "$empty" ]; then - # Just create dir structures and initialize them as git repos - mkdir -p ${LDIR} - initialize_ldir_git; - output "Local directory was already created. Remote directory seems to be empty. Nothing to do. Exiting." "warn"; - exit 0; -elif [ -d ${LDIR} ] && [ "$empty" ]; then - # Local dir already exist - is_ldir_a_git_repo; - if [ $? -eq 0 ]; then - # Local dir is git repo - is_ldir_a_rdir_clone; - if [ $? -eq 0 ]; then - # Local dir is remote repo clone. Push dir content to remote repo. - update_rdir; - exit 0; - else - # Local dir is other repo. Refusing to use it. - output "Local directory is other repository than remote directory." "bad"; - exit 1; - fi - else - # Local dir isn't a repo, initialize them and push first commit. - initialize_ldir_git; - update_rdir; - exit 0; - fi -elif [ ! -d ${LDIR} ] && [ ! "$empty" ]; then - # Local directory doesn't exist, but remote dir isn't empty. Clone them. - clone_rdir; - exit 0; -fi -# Getting update info from remote repo -get_update_info; -# Determining that need to pull commits -is_ldir_need_to_update; -ldir_update=$?; -# or push to remote -is_rdir_need_to_update; -rdir_update=$?; -if [ $ldir_update -eq 0 ]; then - update_ldir; -elif [ $rdir_update -eq 0 ]; then - update_rdir; - if [ $? -ne 0 ]; then - is_ther_conflict; - fi -else - # If everything is up to date, nothing to do. - output "Everything is up to date." "ok"; -fi diff --git a/tools/sbin/immudex-create-media b/tools/sbin/immudex-create-media deleted file mode 100755 index 79cef35..0000000 --- a/tools/sbin/immudex-create-media +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash - -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; - -function help() { - echo "immudex-create-media - script used for write iso image to usb drive(mainly)"; - echo "@ 2024 morketsmerke.org"; - echo "Superuser (root) privileges are required."; - echo "Options:"; - echo " --i386-efi - creating 32-bit EFI usb drive with iso image"; - echo " (comapatible with immudex only iso images)"; - echo " --nuke - write 0 to 1st megabyte of disk"; - echo "Usage:"; - echo " $ immudex-create-media [--i386-efi] [--nuke] [iso_image]"; -} - -if [ $UID -ne 0 ]; then - echo "Permission denied!"; - help; - exit 1; -fi - -if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi -if [ "$1" ] && [ "$1" = "--nuke" ]; then target="nuke"; 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 [ ! "$target" ] || [ "$target" != "nuke" ]; then - if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then - iso=$1; - else - help; - exit 1; - fi -fi - -if [ "$target" = "i386-efi" ]; then - echo -n "Writing zeros to 1st megabyte on disk..."; - 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..."; - parted $disk mklabel msdos > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating FAT-32 partition..."; - 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..."; - mkfs.vfat ${disk}1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Creating /mnt/usb directory..."; - 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..."; - 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..."; - 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..."; - 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..."; - 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..."; - cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1; - 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..."; - 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..."; - touch /mnt/usb/DEBIAN > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - - echo -n "Umounting all mounted filesystems..."; - umount /mnt/usb /mnt/iso > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - -elif [ "$target" = "nuke" ]; then - echo -n "Writing zeros to 1st megabyte on disk..."; - dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi - -else - echo -n "Writing zeros to 1st megabyte on disk..."; - 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..." - 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/sbin/immudex-crypt b/tools/sbin/immudex-crypt deleted file mode 100755 index 964558d..0000000 --- a/tools/sbin/immudex-crypt +++ /dev/null @@ -1,177 +0,0 @@ -#!/bin/bash - -function help() { - - echo "immudex-crypt - script used for listing, open and close crypt_LUKS ppartitions"; - echo "@ 2024 morketsmerke.org"; - echo "Superuser (root) privileges are required."; - 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 "; - echo "# immudex-crypt open "; - echo "# immudex-crypt close immudex-crypt[0-9] | ic[0-9] | [0-9]"; -} - -function list() { - - mapperDeviceList=$(ls /dev/mapper | grep 'immudex-*' | 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 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\t\tSize:"; - - if [ "$luksDevicesList" ]; then - for lDevice in $luksDevicesList; do - lDeviceSize=$(lsblk | grep "$(basename $lDevice)" | awk '{printf $4}'); - echo -e "$lDevice\t\t$lDeviceSize"; - 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 - cryptsetup open $1 immudex-crypt${index}; - mkdir -p /media/${USER}/immudex-crypt${index}; - # Różnica w reprezentacji czasu modyfikacji miedzy Debian testing a stable i oldstable - #dmDevice=$(ls -l /dev/mapper/immudex-crypt${index} | awk '{printf $10}' | cut -d "/" -f 2); - lastField=$(ls -l /dev/mapper/immudex-crypt${index} | grep -o ' ' | wc -l); - dmDevice=$(ls -al /dev/mapper/immudex-crypt${index} | cut -d " " -f ${lastField}- | cut -d "/" -f2); - 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 - mkfs.ext4 /dev/mapper/immudex-crypt${index}; - else - echo "Refuse to mount."; - cryptsetup close immudex-crypt${index}; - exit 1; - fi - fi - mount /dev/mapper/immudex-crypt${index} /media/${USER}/immudex-crypt${index}; - if [ ! -e /ic${index} ]; then - 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 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 - umount -R $mountPoint; - cryptsetup close ${cryptfsName}; - else - 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 - 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 $RUID ]; then - if id $USER | grep -q $RUID; then - echo "User $USER is already owner of $mountPoint"; - fi - else - chown ${USER}:${USER} $mountPoint; - fi - fi -} - -if [ "$1" ]; then - - if [ $UID -ne 0 ]; then - echo "Permission denied!"; - help; - exit 1; - fi - - #immudex-crypt RUID is EUID of sudo, which spawning immudex-crypt - export RUID=$(grep '^Uid:' /proc/$(pidof -s sudo)/status | awk '{printf $2}'); - export USER=$(grep "$RUID" /etc/passwd | cut -d ":" -f1); - - 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/sbin/immudex-hostname b/tools/sbin/immudex-hostname deleted file mode 100755 index f461568..0000000 --- a/tools/sbin/immudex-hostname +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -if [ $UID -ne 0 ]; then - echo "Permission denied!"; - exit 1; -fi - -bootID=$(sed 's/-//g' /proc/sys/kernel/random/boot_id | cut -c 26-33); -if hostnamectl > /dev/null 2>&1; then - hName="$(hostnamectl | grep 'Chassis' | cut -d ":" -f 2 | awk '{printf $1}')-${bootID}"; -else - hName="$(dmidecode -s chassis-type | head -1 | tr [A-Z] [a-z])-${bootID}"; -fi - -hostnamectl set-hostname $hName; -sed -i "s/immudex/${hName}/g" /etc/hosts; -echo $hName | sudo tee /etc/hostname > /dev/null; diff --git a/tools/sbin/immudex-install b/tools/sbin/immudex-install deleted file mode 100755 index 0b0391b..0000000 --- a/tools/sbin/immudex-install +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -ENDCOLOR="\e[0m"; - -if [ $UID -ne 0 ]; then - echo "Permission denied!"; - exit 1; -fi - -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 - - dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - parted /dev/$disk mklabel msdos > /dev/null 2>&1; - parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1; - parted /dev/$disk set 1 boot on > /dev/null 2>&1; - parted /dev/$disk mkpart primary 101M 3G > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1; - mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1; - - #Setting label for partition - e2label /dev/${disk}2 "immudex" > /dev/null 2>&1; - - #mount root partition - mount /dev/${disk}2 /media > /dev/null 2>&1; - - #creating directories for efi partition - mkdir -p /media/boot/efi > /dev/null 2>&1; - - #mount efi partition - 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 - cp -rvv /run/live/medium/* /media > /dev/null 2>&1; - - sed -i '/set\ timeout=/ s/30/5/' /media/boot/grub/grub.cfg; - sed -i 's/bootfrom=removable //g' /media/boot/grub/grub.cfg; - - #removing unnecessary directories from second partition - rm -rf /media/isolinux > /dev/null 2>&1; - 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 - 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 - efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1; - - #Umount all mounted filesystems - 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 - - dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null - - parted /dev/$disk mklabel msdos > /dev/null 2>&1; - parted /dev/$disk mkpart primary 1 3G > /dev/null 2>&1; - parted /dev/$disk set 1 boot on > /dev/null 2>&1; - - if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi - - #formatting - mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1; - - #Setting label for partition is necessary for extlinux bootloader - e2label /dev/${disk}1 "immudex" > /dev/null 2>&1; - - #mount partition in /media directory - mount /dev/${disk}1 /media > /dev/null 2>&1; - - #Creating directory for extlinux - mkdir /media/extlinux > /dev/null 2>&1; - - #Instalation extlinux files in abovementioned directory - 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 - cp -rvv /run/live/medium/live /media > /dev/null; 2>&1; - - #installation extlinux MBR on first sector of hard drive (whole device) - 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; - rm extlinux.conf; - - #Unmounting filesystems - umount /media > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi -fi diff --git a/tools/sbin/immudex-nf b/tools/sbin/immudex-nf deleted file mode 100755 index 1653e1f..0000000 --- a/tools/sbin/immudex-nf +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; - -function fillTo8bits() { - OCT_BITS=$2; - FLAG=0; - if [ $OCT_BITS -lt 8 ]; then - while [ $OCT_BITS -lt 8 ]; do - if [ $FLAG -eq 1 ]; then - OCT="0${OCT}"; - else - OCT="0${1}"; - fi - OCT_BITS=$(echo -n $OCT | wc -c | awk '{printf $1}'); - FLAG=1; - done - echo "$OCT"; - else - echo "$OCT"; - fi -} - -function getBinaryOCT() { - OCT=$(echo "obase=2;${1}" | bc); - OCT_BITS=$(echo -n $OCT | wc -c | awk '{printf $1}'); - echo "$(fillTo8bits $OCT $OCT_BITS)"; -} - -function printHelp() { - echo "immudex-nf - script to search host in network by IP or MAC address"; - echo "morketsmerke.org @ 2025"; - echo; - echo "Options: "; - echo " --is-free - SYN and UDP scan for check is given IP address is free and useable"; - echo; - echo "Usage: "; - echo "# immudex-nf "; -} - -if [ "$1" ]; then - - if [ "$1" = "--is-free" ]; then - echo "Scanning..."; - sudo nmap -sS $2 | sudo tee /tmp/immudex-nf_syn.txt > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "SYN Scanning...[ ${GREEN}OK${ENDCOLOR} ]"; fi - sudo nmap -sU $2 | sudo tee /tmp/immudex-nf-udp.txt > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "UDP Scanning...[ ${GREEN}OK${ENDCOLOR} ]"; fi - cat /tmp/immudex-nf_syn.txt /tmp/immudex-nf-udp.txt; - else - IFACE=$(cat /proc/net/route | sed -n '2p' | awk '{printf $1}'); - IP=$(ip addr show dev ${IFACE} | grep 'inet\ ' | awk '{printf $2}' | cut -d "/" -f 1); - CIDR=$(ip addr show dev ${IFACE} | grep 'inet\ ' | awk '{printf $2}' | cut -d "/" -f 2); - - OCT1=$(getBinaryOCT $(echo $IP | grep -o '[0-9]*' | sed -n '1p')); - OCT2=$(getBinaryOCT $(echo $IP | grep -o '[0-9]*' | sed -n '2p')); - OCT3=$(getBinaryOCT $(echo $IP | grep -o '[0-9]*' | sed -n '3p')); - OCT4=$(getBinaryOCT $(echo $IP | grep -o '[0-9]*' | sed -n '4p')); - - binIP="${OCT1}${OCT2}${OCT3}${OCT4}"; - ipAfterCut=$(echo -n $binIP | cut -c 1-$CIDR); - netBinIPBits=$CIDR; - - netBinIP=$ipAfterCut; - while [ $netBinIPBits -lt 32 ]; do - netBinIP="${netBinIP}0"; - netBinIPBits=$(echo -n $netBinIP | wc -c | awk '{printf $1}'); - done - - netOCT1=$(echo -n $netBinIP | cut -c 1-8); - netOCT2=$(echo -n $netBinIP | cut -c 9-16); - netOCT3=$(echo -n $netBinIP | cut -c 17-24); - netOCT4=$(echo -n $netBinIP | cut -c 25-32); - - networkBinIP="${netOCT1}.${netOCT2}.${netOCT3}.${netOCT4}"; - #echo $networkBinIP; - - netDecOCT1=$(echo "ibase=2;${netOCT1}" | bc); - netDecOCT2=$(echo "ibase=2;${netOCT2}" | bc); - netDecOCT3=$(echo "ibase=2;${netOCT3}" | bc); - netDecOCT4=$(echo "ibase=2;${netOCT4}" | bc); - - networkIP="${netDecOCT1}.${netDecOCT2}.${netDecOCT3}.${netDecOCT4}"; - echo "Network IP: $networkIP"; - echo "Scanning..."; - file="/tmp/immudex-nf_result.txt"; - sudo nmap -sP "${networkIP}/${CIDR}" | sudo tee ${file} >> /dev/null; - if [ $? -eq 0 ]; then echo -e "Scanning...[ ${GREEN}OK${ENDCOLOR} ]"; fi - query=$1; - if $(echo $query | grep -q '\:'); then - offset="- 2"; - field=5; - else - offset="+ 2"; - field="3-"; - fi - - foundLine=$(grep -n $query $file | cut -d ":" -f 1); - lineNumber=$(expr $foundLine $offset); - result=$(sed -n "${lineNumber}p" $file | cut -d " " -f ${field}); - echo "Result: $result"; - fi -else - printHelp; -fi diff --git a/tools/sbin/immudex-updates b/tools/sbin/immudex-updates deleted file mode 100755 index d91a67d..0000000 --- a/tools/sbin/immudex-updates +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -RED="\e[31m"; -GREEN="\e[32m"; -YELLOW="\e[33m"; -ENDCOLOR="\e[0m"; - -#FILE="/tmp/immudex-updates.txt"; - -function getVerFromRSSFeed() { - URL=$1; - echo $(curl $URL 2> /dev/null | grep '' | sed -n '2p' | sed -e 's/<title>//g' -e 's,,,g' | awk '{printf $1}') -} -echo "Obtaining updates information:"; -echo " |"; -if [ -x /usr/bin/librewolf ]; then - URL="https://codeberg.org/librewolf/source/releases.rss"; - newLibrewolfVer=$(getVerFromRSSFeed $URL); - currentLibrewolfVer=$(apt list --installed 2>/dev/null | grep 'librewolf' | awk '{printf $2}'); - if ! [ "$currentLibrewolfVer" = "$newLibrewolfVer" ]; then - echo -e " \`- New Librewolf version (${GREEN}${newLibrewolfVer}${ENDCOLOR}) is available."; - echo " |"; - fi -fi - -if [ -x /usr/local/bin/ncspot ]; then - URL="https://github.com/hrkfdn/ncspot/releases.atom"; - newNcspotVer=$(getVerFromRSSFeed $URL); - currentNcspotVer=$(ncspot -V | awk '{printf $2}'); - if ! [ "$currentNcspotVer" = "$newNcspotVer" ]; then - echo -e " \`- New ncspot version (${GREEN}${newNcspotVer}${ENDCOLOR}) is available."; - echo " |"; - fi -fi - -if [ -x /usr/local/bin/nu ]; then - URL="https://github.com/nushell/nushell/releases.atom"; - newNushellVer=$(getVerFromRSSFeed $URL); - currentNushellVer=$(nu -v | awk '{printf $1}'); - if ! [ "$currentNushellVer" = "$NewNushellVer" ]; then - echo -e " \`- New nushell version (${GREEN}${newNushellVer}${ENDCOLOR}) is available."; - echo " |"; - fi -fi - -if [ -x /usr/local/bin/nextcloud ]; then - currentNextcloudVersion=$(/usr/local/bin/nextcloud -v 2> /dev/null | grep '^Nextcloud version' | awk '{printf $3}'); - URL="https://github.com/nextcloud-releases/desktop/releases.atom"; - newNextcloudVersion=$(curl $URL 2> /dev/null | grep -o '.*' | grep -v 'rc' | sed -n '2p' | sed -e 's,,,' -e 's,,,' | awk '{printf $2}'); - if ! [ "$currentNextcloudVersion" = "$newNextcloudVersion" ]; then - echo -e " \`- New Nextcloud version (${GREEN}${newNextcloudVersion}${ENDCOLOR}) is available."; - echo " |"; - fi -fi - -debianVersion=$(cut -d "." -f 1 /etc/debian_version); -URL="https://micronews.debian.org/feeds/feed.rss"; -newDebianVersion=$(curl $URL 2>/dev/null | grep -o "Updated Debian ${debianVersion}: ${debianVersion}.[0-9]*" | sed -n '1p' | awk '{printf $4}'); -if [ "$newDebianVersion" ]; then - if ! [ "$newDebianVersion" = "$(cat /etc/debian_version)" ]; then - echo -e " \`- New Debian version (${YELLOW}${newDebianVersion}${ENDCOLOR})."; - echo " |"; - fi -fi - -sudo apt update > /dev/null 2>&1; -packagesToUpdate=$(expr $(apt list --upgradable 2> /dev/null | wc -l) - 1); -if [ $packagesToUpdate -lt 0 ]; then packagesToUpdate=0; fi - -if [ $packagesToUpdate -lt 10 ]; then color=${GREEN}; -elif [ $packagesToUpdate -lt 50 ]; then color=${YELLOW}; -else color=${RED}; -fi - -echo -e " \`- ${color}${packagesToUpdate}${ENDCOLOR} packages ready to update."; diff --git a/tools/sbin/immudex-upgrade b/tools/sbin/immudex-upgrade deleted file mode 100755 index c1507fa..0000000 --- a/tools/sbin/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 "@ 2024 morketsmerke.org"; - echo "Superuser (root) privileges are required."; - echo "Options:"; - echo " --check - check there are upgrades for immudex"; - echo " --upgrade - upgrade immudex from given source"; - #echo " --myversion - prints images current commit message"; - echo " --myversion - prints image details"; - echo " --compilation-date - prints date of image creation"; - echo " --packages-upgradable [--security] - updates apt (packages) list and"; - echo " prints available to upgrade packages, with --security modificator"; - echo " prints only pacakages from security repository branch"; -} - -if [ $UID -ne 0 ]; then - echo "Permission denied!"; - help; - exit 1; -fi - -if [ "$1" ]; then - if [ "$1" ] && [ "$1" = "--check" ]; then - if check_distro_commit; then - echo -e "${GREEN}This${ENDCOLOR} is the latest version of immudex"; - else - echo -e "There is a ${RED}new${ENDCOLOR} version of immudex:"; - echo "==================================================="; - check_distro_commit --print; - fi - elif [ "$1" ] && [ "$1" = "--upgrade" ]; then - part=$(blkid | grep 'LABEL="immudex"' | awk '{printf $1}' | cut -d ":" -f 1); - if mount | grep -q "$part"; then - echo -n "Mounting iso image..."; - mount $2 /mnt > /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - mountPointList=$(mount | grep "$part" | awk '{printf $3" "}'); - for mountPoint in $mountPointList; do - echo -n "Unlocking $mountPoint ..."; - mount $part $mountPoint -o remount,rw > /dev/null 2>&1; - if [ $? -eq 0 ]; then - echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; - else - echo -e "[ ${RED}FAIL${ENDCOLOR} ]"; - fi - done - echo "Copying immudex files to the disk..."; - cp -vv /mnt/live/* ${mountPoint}/live; - if [ $? -eq 0 ]; then - echo -e "Copying immudex files to the disk...[ ${GREEN}OK${ENDCOLOR} ]"; - else - echo -e "Copying immudex files to the disk...[ ${RED}FAIL${ENDCOLOR} ]"; - fi - else - echo -n "Mounting immudex partition..."; - mount $part /mnt >> /dev/null 2>&1; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - echo "Copying immudex files to the disk..."; - cp -vv /run/live/medium/live/* /mnt/live; - if [ $? -eq 0 ]; then - echo -e "Copying immudex files to the disk...[ ${GREEN}OK${ENDCOLOR} ]"; - else - echo -e "Copying immudex files to the disk...[ ${RED}FAIL${ENDCOLOR} ]"; - fi - fi - if $(sudo efibootmgr > /dev/null 2>&1); then - echo "Copying grub config to the disk..."; - if [ "$mountPoint" ]; then - cp -vv /mnt/boot/grub/grub.cfg ${mountPoint}/boot/grub/grub.cfg; - if [ $? -eq 0 ]; then - echo -e "Copying grub config to the disk...[ ${GREEN}OK${ENDCOLOR} ]"; - sed -i '/set\ timeout=/ s/30/5/' ${mountPoint}/boot/grub/grub.cfg; - sed -i 's/bootfrom=removable //g' ${mountPoint}/boot/grub/grub.cfg; - else - echo -e "Copying grub config to the disk...[ ${RED}FAIL${ENDCOLOR} ]"; - fi - else - cp -vv /run/live/medium/boot/grub/grub.cfg /mnt/boot/grub/grub.cfg; - if [ $? -eq 0 ]; then - echo -e "Copying grub config to the disk...[ ${GREEN}OK${ENDCOLOR} ]"; - sed -i '/set\ timeout=/ s/30/5/' /mnt/boot/grub/grub.cfg; - sed -i 's/bootfrom=removable //g' /mnt/boot/grub/grub.cfg; - else - echo -e "Copying grub config to the disk...[ ${RED}FAIL${ENDCOLOR} ]"; - fi - fi - fi - elif [ "$1" ] && [ "$1" = "--myversion" ]; then - #if [ -d /tmp/immudex ]; then - # (cd /tmp/immudex && git pull > /dev/null 2>&1) - #else - # git clone https://github.com/xf0r3m/immudex /tmp/immudex; - #fi - #(cd /tmp/immudex && git show $(cat /run/live/medium/live/version)) - cat /run/live/medium/live/changelog; - elif [ "$1" ] && [ "$1" = "--packages-upgradable" ]; then - apt update; - if [ "$2" ] && [ "$2" = "--security" ]; then - apt list --upgradable | grep 'security'; - else - apt list --upgradable; - fi - elif [ "$1" ] && [ "$1" = "--compilation-date" ]; then - eval $(grep '^COMPILATION_DATE' /run/live/medium/live/changelog); - echo "Image was created: $COMPILATION_DATE"; - else - help; - exit 1; - fi -else - help; - exit 1; -fi diff --git a/versions/base.sh b/versions/base.sh index ab829cf..bf9513f 100644 --- a/versions/base.sh +++ b/versions/base.sh @@ -39,12 +39,18 @@ dpkg-reconfigure console-setup; install_packages task-desktop task-xfce-desktop; #Usunięcie pakietów make oraz gimp - 22.11.2025; -install_packages firejail ufw cryptsetup lsof extlinux grub-efi-amd64 efibootmgr bash-completion etherwake wakeonlan cifs-utils wget figlet vim-gtk3 redshift irssi nmap nfs-common remmina python3-pip ffmpeg debootstrap squashfs-tools xorriso syslinux-efi grub-pc-bin grub-efi-amd64-bin mtools dosfstools chrony python3-venv isolinux rsync mutt openvpn netselect-apt gvfs-backends dnsutils lolcat cdparanoia icedax thunderbird nextcloud-desktop extrepo; +install_packages firejail ufw cryptsetup lsof extlinux grub-efi-amd64 efibootmgr bash-completion etherwake wakeonlan cifs-utils wget figlet vim-gtk3 redshift irssi nmap nfs-common remmina python3-pip ffmpeg debootstrap squashfs-tools xorriso syslinux-efi grub-pc-bin grub-efi-amd64-bin mtools dosfstools chrony python3-venv isolinux rsync mutt openvpn netselect-apt gvfs-backends dnsutils lolcat cdparanoia icedax thunderbird nextcloud-desktop extrepo wireshark mc minicom; extrepo enable librewolf; apt update; install_packages librewolf; +cd; + +git clone https://github.com/xf0r3m/xfcedebian; +cd xfcedebian; +bash install.sh --immudex; + if [ -f /usr/bin/youtube-dl ]; then rm /usr/bin/youtube-dl; fi ytdlpVer=$(curl https://github.com/yt-dlp/yt-dlp/releases.atom 2>/dev/null | grep '.*$' | sed -n '2p' | sed 's/\ /\n/g' | tail -1 | sed 's,,,'); @@ -54,54 +60,25 @@ wget https://github.com/yt-dlp/yt-dlp/releases/download/${ytdlpVer}/yt-dlp -O /u ln -s /usr/bin/yt-dlp /usr/bin/youtube-dl; cd; +wget https://ftp.morketsmerke.org/youtube-search/python3-youtube-search_2.2.0.deb +apt install ./python3-youtube-search_2.2.0.deb -y -git clone https://github.com/xf0r3m/xfcedebian; -cd xfcedebian; -bash install.sh --immudex; - -cd; +git clone https://git.morketsmerke.org/git/immudex-tools; +cp -vv ~/immudex-tools/bin/* /usr/local/bin; -#Wyłączenie narzędzia immudex-autostart-x4notes - 22.11.2025 -cp -vv ~/immudex/tools/bin/immudex-branch /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-import-gpgkeys /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-import-sshkeys /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-meteo /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-morketsmerke /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-motd2 /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-padlock /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-pl /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-secured-librewolf /usr/local/bin; -#Wyłączenie narzędzia immudex-protected - 22.11.2025 -cp -vv ~/immudex/tools/bin/immudex-shoutcasts /usr/local/bin; -cp -vv ~/immudex/tools/bin/immudex-version /usr/local/bin; -#Nowe narzędzie immudex-cdrip - 27.08.2025; -cp -vv ~/immudex/tools/bin/immudex-cdrip /usr/local/bin; -#Wyłaczenie immudex-run - 22.11.2025 -cp -vv ~/immudex/tools/bin/immudex-run /usr/local/bin; - -#Właczenie nowej wersji immudex-ytplay (immudex-ytplay2) - 13.09.2025 -pythonVersion=$(python3 -V | awk '{printf $2}' | cut -d "." -f 1-2); -mv /usr/lib/python${pythonVersion}/EXTERNALLY-MANAGED /usr/lib/python${pythonVersion}/EXTERNALLY-MANAGED.old; -wget https://ftp.morketsmerke.org/youtube-search/youtube_search-2.1.2-py3-none-any.whl -O /tmp/youtube_search-2.1.2-py3-none-any.whl; -pip install /tmp/youtube_search-2.1.2-py3-none-any.whl; -mv /usr/lib/python${pythonVersion}/EXTERNALLY-MANAGED.old /usr/lib/python${pythonVersion}/EXTERNALLY-MANAGED; -cp -vv ~/immudex/tools/bin/immudex-ytplay2 /usr/local/bin; -ln -s /usr/local/bin/immudex-ytplay2 /usr/local/bin/immudex-ytplay; - -cp -vv ~/immudex/tools/bin/library.sh /usr/local/bin; -cp -vv ~/immudex/tools/bin/idle-clic /usr/local/bin; -cp -vv ~/immudex/tools/bin/sync.sh /usr/local/bin; +git clone https://git.morketsmerke.org/git/immudex-only-tools; +cp -vv ~/immudex-only-tools/bin/* /usrlocal/bin; chmod +x /usr/local/bin/*; -cp -vv ~/immudex/tools/sbin/immudex-create-media /usr/local/sbin; -cp -vv ~/immudex/tools/sbin/immudex-crypt /usr/local/sbin; -cp -vv ~/immudex/tools/sbin/immudex-hostname /usr/local/sbin; -cp -vv ~/immudex/tools/sbin/immudex-install /usr/local/sbin; -cp -vv ~/immudex/tools/sbin/immudex-upgrade /usr/local/sbin; -#Wyłączenie narzędzi immudex-update i immudex-nf - 22.11.2025 +cp -vv ~/immudex-tools/sbin/* /usr/local/sbin; +cp -vv ~/immudex-only-tools/sbin/* /usr/local/sbin; chown root:root /usr/local/sbin/*; chmod 544 /usr/local/sbin/*; +cp -vv ~/immudex-tools/misc/motd.conf /etc/motd.conf; +cp -vv ~/immudex-only-tools/misc/immudex-hostname.service /etc/systemd/system; +systemctl enable immudex-hostname.service; + cp -rvv ~/immudex/files/libreoffice /etc/skel/.config; cp -vv ~/immudex/files/firejail.config /etc/firejail; cp -vv ~/immudex/files/redshift.conf /etc/skel/.config; @@ -120,17 +97,14 @@ fi cp -vv ~/immudex/launchers/*.desktop /usr/share/applications; cp -vv ~/immudex/files/whiskermenu-1.rc /etc/skel/.config/xfce4/panel/whiskermenu-1.rc; -cp -vv ~/immudex/files/immudex_hostname.service /etc/systemd/system; - cp -vv ~/immudex/launchers/16844254192.desktop /etc/skel/.config/xfce4/panel/launcher-5; tar -xzvf ~/immudex/files/mozilla.tgz -C /etc/skel; -systemctl enable immudex_hostname.service; cat >> /etc/bash.bashrc << EOL if [ ! -f /tmp/.motd ]; then -/usr/local/bin/immudex-motd2 +/usr/local/bin/immudex-motd touch /tmp/.motd; fi EOL @@ -138,8 +112,6 @@ EOL echo "alias immudex-chhome='export HOME=\$(pwd)'" >> /etc/bash.bashrc; echo "alias immudex-changelogs='immudex-upgrade --check --print'" >> /etc/bash.bashrc; echo "alias immudex-version='cat /run/live/medium/live/changelog'" >> /etc/bash.bashrc; -echo "alias teamviewer_prepare='sudo sed -i '/^xf0r3m/s,/home/xf0r3m,/ic0,' /etc/passwd'" >> /etc/bash.bashrc; -echo "alias teamviewer_restore='sudo sed -i '/^xf0r3m/s,/ic0,/home/xf0r3m,' /etc/passwd'" >> /etc/bash.bashrc; chmod u+s /usr/bin/ping; @@ -170,9 +142,4 @@ echo "root:${rootPassword}" | chpasswd; usermod -L root; # Miejsce na twoje zmiany, przed poleceniem 'tidy' -cd /tmp -wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb -apt install -y ./teamviewer_amd64.deb -kill $(pidof gpg-agent) - tidy;