From: xf0r3m Date: Thu, 21 May 2026 13:46:51 +0000 (+0200) Subject: Dodanie katalogu immudex-complete-project X-Git-Url: https://gitweb.morketsmerke.org/?a=commitdiff_plain;h=a4078eb379ec63e96086b77a857b33d772d74fc3;p=immudex.git Dodanie katalogu immudex-complete-project --- diff --git a/immudex-complete-project/immudex-branch b/immudex-complete-project/immudex-branch new file mode 100755 index 0000000..3c49dc2 --- /dev/null +++ b/immudex-complete-project/immudex-branch @@ -0,0 +1,47 @@ +#!/bin/bash + +function help() { + echo "immudex-branch it's a conky helper script, which returns Debian version"; + echo "used for build immudex. This information is used in 'Info:' section"; + echo "in conky widget as complement in name of immudex version."; + echo; + echo "Usage: immudex-branch [-h] [-v]"; + echo; + echo "Options:"; + echo " -h Print this message."; + echo " -v Print information about version, author and copyrights."; + echo; + echo "Examples:"; + echo " immudex-branch Prints version of Debian used for immudex build with hyphen on start of." + echo " immudex-branch -h Prints this message."; + echo " immudex-branch -v Print information about version, author and copyrights."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-branch 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; + +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + elif [ "$1" = "-v" ]; then + version; + fi +else + 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 +fi diff --git a/immudex-complete-project/immudex-branch.1 b/immudex-complete-project/immudex-branch.1 new file mode 100644 index 0000000..227acd2 --- /dev/null +++ b/immudex-complete-project/immudex-branch.1 @@ -0,0 +1,49 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-BRANCH "1" "May 2026" "immudex-branch 1.1" "User Commands" +.SH NAME +immudex-branch \- it's a conky helper script, which returns Debian version used for build immudex. +.SH SYNOPSIS +.B immudex-branch +[\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +immudex\-branch it's a conky helper script, which returns Debian version +used for build immudex. This information is used in 'Info:' section +in conky widget as complement in name of immudex version. +.SH OPTIONS +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-v\fR +Print information about version, author and copyrights. +.SH EXAMPLES +.TP +immudex\-branch +Prints version of Debian used for immudex build with hyphen on start of. +.TP +immudex\-branch \-h +Prints this message. +.TP +immudex\-branch \-v +Print information about version, author and copyrights. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-branch +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-branch +programs are properly installed at your site, the command +.IP +.B info immudex-branch +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-cdrip b/immudex-complete-project/immudex-cdrip new file mode 100755 index 0000000..17cff8c --- /dev/null +++ b/immudex-complete-project/immudex-cdrip @@ -0,0 +1,148 @@ +#!/bin/bash + +function XMLScrap() { + echo -n $(grep -o "<${1}>.*" $2 \ + | sed "s,<${1}>,," \ + | sed "s,,," \ + | sed 's,&,and,g'); +} + +function help() { + echo "immudex-cdrip it's a bash script for collect audio tracks from Audio CD's."; + echo "Script apart form ripping Audio CD's, reads metadata, check it on music"; + echo "databases and creates properly named directories and audio files."; + echo; + echo "Usage: immudex-cdrip [-h] [-g] [-o] [-r] [-v]"; + echo; + echo "Options:"; + echo " -h Print this message."; + echo " -g Getting metadata from Audio CD without ripping."; + echo " -o Rips audio tracks from Audio CD, without renaming based Audio CD metadata"; + echo " -r Rips audio tracks from Audio CD, create Artist/Album folders and rename tracks according to AudioCD metadata."; + echo " -v Print information about version, author and copyrights."; + echo; + echo "Examples:"; + echo " immudex-cdrip Print this message"; + echo " immudex-cdrip -g Get metadata from Audio CD"; + echo " immudex-cdrip -o Rip tracks form Audio CD, without renaming. Could be useful with less popular artists."; + echo " immudex-cdrip -r Rips Audio CD and names dirs and files with Audio CD data."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-cdrip 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +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 +# exit 1; +#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 + +if [ "$1" ] && [ "$1" = "-h" ]; then + help; + exit 0; +fi + +if [ "$1" ] && [ "$1" = "-v" ]; then + version; + exit 0; +fi + +help; diff --git a/immudex-complete-project/immudex-cdrip.1 b/immudex-complete-project/immudex-cdrip.1 new file mode 100644 index 0000000..496c9ed --- /dev/null +++ b/immudex-complete-project/immudex-cdrip.1 @@ -0,0 +1,61 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-CDRIP "1" "May 2026" "immudex-cdrip 1.1" "User Commands" +.SH NAME +immudex-cdrip \- BASH script for collect audio tracks from Audio CD's +.SH SYNOPSIS +.B immudex-cdrip +[\fI\,-h\/\fR] [\fI\,-g\/\fR] [\fI\,-o\/\fR] [\fI\,-r\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +immudex\-cdrip it's a bash script for collect audio tracks from Audio CD's. +Script apart form ripping Audio CD's, reads metadata, check it on music +databases and creates properly named directories and audio files. +.SH OPTIONS +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-g\fR +Getting metadata from Audio CD without ripping. +.TP +\fB\-o\fR +Rips audio tracks from Audio CD, without renaming based Audio CD metadata +.TP +\fB\-r\fR +Rips audio tracks from Audio CD, create Artist/Album folders and rename tracks according to AudioCD metadata. +.TP +\fB\-v\fR +Print information about version, author and copyrights. +.SH EXAMPLES +.TP +immudex\-cdrip +Print this message +.TP +immudex\-cdrip \-g +Get metadata from Audio CD +.TP +immudex\-cdrip \-o +Rip tracks form Audio CD, without renaming. Could be useful with less popular artists. +.TP +immudex\-cdrip \-r +Rips Audio CD and names dirs and files with Audio CD data. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-cdrip +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-cdrip +programs are properly installed at your site, the command +.IP +.B info immudex-cdrip +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-complete-functions b/immudex-complete-project/immudex-complete-functions new file mode 100644 index 0000000..2636a31 --- /dev/null +++ b/immudex-complete-project/immudex-complete-functions @@ -0,0 +1,47 @@ +#!/bin/bash + +disk_list() { + i=0; + diskList=(); + for disk in $(ls -l /dev/ | grep 'disk' | grep '\ 0\ ' | awk '{printf $NF" "}'); do + diskList[$i]="/dev/${disk}"; + i=$(expr $i + 1); + done + echo -n ${diskList[@]}; +} + +idx_simple_options_complete() { + local cur; + + COMPREPLY=(); + cur=${COMP_WORDS[COMP_CWORD]}; + + if [ $(expr $COMP_CWORD % 2) -eq 1 ]; then + COMPREPLY=( $(compgen -W '-h -v' -- $cur) ); + elif [ $(expr $COMP_CWORD % 2) -eq 0 ]; then + return 0; + fi + return 0; +} + + +idx_create_media_complete() { + local cur prev + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]}; + prev=${COMP_WORDS[COMP_CWORD-1]}; + + if [ $(expr $COMP_CWORD % 2) -eq 1 ]; then + COMPREPLY=( $(compgen -W '-d -i -n -e32 -h -v' -- $cur) ); + elif [ $(expr $COMP_CWORD % 2) -eq 0 ]; then + case "$prev" in + '-d') COMPREPLY=( $(compgen -W "$(disk_list)" -- $cur) );; + '-i') COMPREPLY=( $(compgen -f -X "!*.iso" $cur) );; + '-n') COMPREPLY=( $(compgen -W "$(disk_list)" -- $cur) );; + '-e32') COMPREPLY=( $(compgen -W "$(disk_list)" -- $cur) );; + *);; + esac + fi + return 0 +} diff --git a/immudex-complete-project/immudex-create-media b/immudex-complete-project/immudex-create-media new file mode 100755 index 0000000..c9bd76d --- /dev/null +++ b/immudex-complete-project/immudex-create-media @@ -0,0 +1,135 @@ +#!/bin/bash + +GREEN="\e[32m"; +YELLOW="\e[33m"; +ENDCOLOR="\e[0m"; + +function help() { + echo "immudex-create-media it's script used for write iso image to usb drive."; + echo "Script writes .iso file to usb stick - make it then bootable. This" + echo "script prepare usb disks for 32-bit EFI systems." + echo "Superuser (root) privileges are required."; + echo; + echo "Usage: immudex-create-media [-e32 immudex.iso /dev/sdX] [-h] [-l file.iso /dev/sdX] [-n /dev/sdX] [-v]"; + echo; + echo "Options:"; + echo " -e32 immudex.iso /dev/sdX Creating 32-bit EFI bootable usb drive with iso image. (Compatibile with immudex images only.)"; + echo " --help Print this message."; + echo " -l file.iso /dev/sdX Load file.iso to /dev/sdX drive."; + echo " -n /dev/sdX Write 0's to 1st megabyte of disk, wiping partition table."; + echo " -v Print information about version, author and copyrights."; + echo; + echo "Exmaples:"; + echo " immudex-create-media Print this message."; + echo " immudex-create-media -l /dev/sdX file.iso Writes iso file to usb stick, made it bootable."; + echo " immudex-create-media -e32 /dev/sdX immudex.iso Create 32-bit EFI bootable usb stick with immudex."; + echo " immudex-create-media -n /dev/sdX Writes first MB with 0's, deleting partition table"; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-create-media 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ $UID -ne 0 ]; then + echo "Permission denied!"; + help; + exit 1; +fi + +if [ "$1" ] && [ "$1" = "-h" ]; then help; exit 0; fi +if [ "$1" ] && [ "$1" = "-v" ]; then version; exit 0; fi + +if [ "$1" ] && [ "$1" = "-e32" ]; then target="i386-efi"; shift; fi +if [ "$1" ] && [ "$1" = "-n" ]; then target="nuke"; shift; fi +if [ "$1" ] && [ "$1" = "-l" ]; then target="load"; shift; fi +if [ "$1" ] && $(echo $1 | grep -q '\.iso'); then + iso=$1; shift; +fi +if [ "$1" ] && $(echo $1 | grep -q '/dev/'); then + disk=$1; shift; +else + help; + exit 1; +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 + +elif [ "$target" = "load" ]; 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 "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 +else + help; + exit 1; +fi diff --git a/immudex-complete-project/immudex-create-media.1 b/immudex-complete-project/immudex-create-media.1 new file mode 100644 index 0000000..7c0c75c --- /dev/null +++ b/immudex-complete-project/immudex-create-media.1 @@ -0,0 +1,62 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-CREATE-MEDIA "1" "May 2026" "immudex-create-media 1.1" "User Commands" +.SH NAME +immudex-create-media \- BASH script used for write iso image to usb drive. +.SH SYNOPSIS +.B immudex-create-media +[\fI\,-e32 immudex.iso /dev/sdX\/\fR] [\fI\,-h\/\fR] [\fI\,-l file.iso /dev/sdX\/\fR] [\fI\,-n /dev/sdX\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +immudex\-create\-media it's script used for write iso image to usb drive. +Script writes .iso file to usb stick \- make it then bootable. This +script prepare usb disks for 32\-bit EFI systems. +Superuser (root) privileges are required. +.SH OPTIONS +.TP +\fB\-e32\fR immudex.iso \fI\,/dev/sdX\/\fP +Creating 32\-bit EFI bootable usb drive with iso image. (Compatibile with immudex images only.) +.TP +\fB\-\-help\fR +Print this message. +.TP +\fB\-l\fR file.iso \fI\,/dev/sdX\/\fP +Load file.iso to \fI\,/dev/sdX\/\fP drive. +.TP +\fB\-n\fR \fI\,/dev/sdX\/\fP +Write 0's to 1st megabyte of disk, wiping partition table. +.TP +\fB\-v\fR +Print information about version, author and copyrights. +.SS "Exmaples:" +.TP +immudex\-create\-media +Print this message. +.TP +immudex\-create\-media \fB\-l\fR \fI\,/dev/sdX\/\fP file.iso +Writes iso file to usb stick, made it bootable. +.TP +immudex\-create\-media \fB\-e32\fR \fI\,/dev/sdX\/\fP immudex.iso +Create 32\-bit EFI bootable usb stick with immudex. +.TP +immudex\-create\-media \fB\-n\fR \fI\,/dev/sdX\/\fP +Writes first MB with 0's, deleting partition table +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-create-media +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-create-media +programs are properly installed at your site, the command +.IP +.B info immudex-create-media +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-crypt b/immudex-complete-project/immudex-crypt new file mode 100755 index 0000000..fdc6875 --- /dev/null +++ b/immudex-complete-project/immudex-crypt @@ -0,0 +1,202 @@ +#!/bin/bash + +function help() { + + echo "immudex-crypt is script used for listing, open, close and create crypt_LUKS partitions."; + echo "Script creates 'immudex-crypt' mount points, every mount point end up with 'index'."; + echo "Index is order number of opening crypt_LUKS devices via 'immudex-crypt' The first"; + echo "opened device will have index equal 0, second = 1, and so on and on."; + echo "Superuser (root) privileges are required."; + echo; + echo "Usage: immudex-crypt [-c index] [-f /dev/partition] [-h] [-l] [-o /dev/crypt_LUKS_device] [-v]"; + echo; + echo "Options:"; + echo " -c INDEX/icINDEX/immudex-cryptINDEX Unmounting and close opened crypt_LUKS devices."; + echo " -f /dev/partition Preparing device for crypt_LUKS."; + echo " -h Prints this message."; + echo " -l Prints list of opened and available crypt_LUKS devices."; + echo " -o /dev/crypt_LUKS_device Opening and mount crypt_LUKS device (it creates mount point, if not exist)."; + echo " -v Print information about version, author and copyrights."; + echo; + echo "Examples:"; + echo " immudex-crypt -l List available crypt_LUKS devices in the system."; + echo " immudex-crypt -f /dev/sdX Create crypt_LUKS device from given partition."; + echo " immudex-crypt -o /dev/sdX Open given crypt_LUKS device (with mounting file system, of course)."; + echo " immudex-crypt -c 0 Close first opened crypt_LUKS device in the system."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-crypt 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +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=$(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=$(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)" | sed -n '1p' | 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}; + 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 ! $(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 + if $(pidof -sq sudo); then + export RUID=$(grep '^Uid:' /proc/$(pidof -s sudo)/status | awk '{printf $2}'); + export USER=$(grep "$RUID" /etc/passwd | cut -d ":" -f1); + fi + + option=$1; + value=$2; + + case $option in + "-l") list;; + "-o") if [ "$value" ]; then open $value; + else help; exit 1; + fi;; + "-c") if [ "$value" ]; then close $value; + else help; exit 1; + fi;; + "-f") if [ "$value" ]; then + create $value; + open $value; + set_ownership $value; + else help; exit 1; + fi;; + "-h") help; exit 0;; + "-v") version; exit 0;; + *) help;; + esac +else + help; exit 1; +fi diff --git a/immudex-complete-project/immudex-crypt.1 b/immudex-complete-project/immudex-crypt.1 new file mode 100644 index 0000000..6eccb44 --- /dev/null +++ b/immudex-complete-project/immudex-crypt.1 @@ -0,0 +1,66 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-CRYPT "1" "May 2026" "immudex-crypt 1.1" "User Commands" +.SH NAME +immudex-crypt \- BASH script used for listing, open, close and create crypt_LUKS partitions. +.SH SYNOPSIS +.B immudex-crypt +[\fI\,-c index\/\fR] [\fI\,-f /dev/partition\/\fR] [\fI\,-h\/\fR] [\fI\,-l\/\fR] [\fI\,-o /dev/crypt_LUKS_device\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +immudex\-crypt is script used for listing, open, close and create crypt_LUKS partitions. +Script creates 'immudex\-crypt' mount points, every mount point end up with 'index'. +Index is order number of opening crypt_LUKS devices via 'immudex\-crypt' The first +opened device will have index equal 0, second = 1, and so on and on. +Superuser (root) privileges are required. +.SH OPTIONS +.TP +\fB\-c\fR INDEX/icINDEX/immudex\-cryptINDEX +Unmounting and close opened crypt_LUKS devices. +.TP +\fB\-f\fR \fI\,/dev/partition\/\fP +Preparing device for crypt_LUKS. +.TP +\fB\-h\fR +Prints this message. +.TP +\fB\-l\fR +Prints list of opened and available crypt_LUKS devices. +.TP +\fB\-o\fR \fI\,/dev/crypt_LUKS_device\/\fP +Opening and mount crypt_LUKS device (it creates mount point, if not exist). +.TP +\fB\-v\fR +Print information about version, author and copyrights. +.SH EXAMPLES +.TP +immudex\-crypt \-l +List available crypt_LUKS devices in the system. +.TP +immudex\-crypt \-f /dev/sdX +Create crypt_LUKS device from given partition. +.TP +immudex\-crypt \-o /dev/sdX +Open given crypt_LUKS device (with mounting file system, of course). +.TP +immudex\-crypt \-c 0 +Close first opened crypt_LUKS device in the system. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-crypt +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-crypt +programs are properly installed at your site, the command +.IP +.B info immudex-crypt +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-hostname b/immudex-complete-project/immudex-hostname new file mode 100755 index 0000000..5f0af48 --- /dev/null +++ b/immudex-complete-project/immudex-hostname @@ -0,0 +1,58 @@ +#!/bin/bash + +function help() { + echo "immudex-hostname it's a main executional script for immudex-hostname"; + echo "service. The script job is to change set appropriate name for this"; + echo "host based on computer chassis and 7 last chars from boot ID." + echo; + echo "Usage: immudex-hostname [-h] [-v]"; + echo; + echo "Options:"; + echo " -h Print this message."; + echo " -v Print information about version, author and copyrights." + echo; + echo "Examples:"; + echo " immudex-hostname Set apropriate hostname, usually executed by systemd."; + echo " immudex-hostname -h Print this message."; + echo " immudex-hostname -v Print information about version, author and copyrights."; + echo; + echo "Files:"; + echo " /usr/lib/systemd/system/immudex-hostname.service Systemd unit file, to run immudex-hostname script as a service."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-hostname 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; + +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + elif [ "$1" = "-v" ]; then + version; + fi +else + 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; +fi diff --git a/immudex-complete-project/immudex-hostname.1 b/immudex-complete-project/immudex-hostname.1 new file mode 100644 index 0000000..1f0dc13 --- /dev/null +++ b/immudex-complete-project/immudex-hostname.1 @@ -0,0 +1,53 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-HOSTNAME "1" "May 2026" "immudex-hostname 1.1" "User Commands" +.SH NAME +immudex-hostname \- it's a main executional script for immudex-hostname service. +.SH SYNOPSIS +.B immudex-hostname +[\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +immudex\-hostname it's a main executional script for immudex\-hostname +service. The script job is to change set appropriate name for this +host based on computer chassis and 7 last chars from boot ID. +.SH OPTIONS +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-v\fR +Print information about version, author and copyrights. +.SH FILES +.TP +\fI\,/usr/lib/systemd/system/immudex\-hostname.service\/\fP +Systemd unit file, to run immudex\-hostname script as a service. +.SH EXAMPLES +.TP +immudex\-hostname +Set apropriate hostname, usually executed by systemd. +.TP +immudex\-hostname \-h +Print this message. +.TP +immudex\-hostname \-v +Print information about version, author and copyrights. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-hostname +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-hostname +programs are properly installed at your site, the command +.IP +.B info immudex-hostname +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-import-gpgkeys b/immudex-complete-project/immudex-import-gpgkeys new file mode 100755 index 0000000..e653a6b --- /dev/null +++ b/immudex-complete-project/immudex-import-gpgkeys @@ -0,0 +1,46 @@ +#!/bin/bash + +function help() { + echo "it's a script for import GPG keys and owner trust. GPG keys can be used"; + echo "by 'pass' - POSIX compatibile password manager or signing. It's very"; + echo "helpful, when your keys are in files in encrypted datastore."; + echo "Script requires to store GPG keys in home dir or change home dir before"; + echo "execute a script."; + echo; + echo "Usage: immudex-import-gpgkeys [-h] [-v]"; + echo; + echo "Options:"; + echo " -h Print this message."; + echo " -v Print information about version, author and copyrights"; + echo; + echo "Examples:"; + echo " immudex-import-gpgkeys Import GPG keys and owner trust."; + echo " immudex-import-gpgkeys -h Print this message."; + echo " immudex-import-gpgkeys -v Print information about version, author and copyrights."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-import-gpgkeys 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + elif [ "$1" = "-v" ]; then + version; + fi +else + 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 +fi diff --git a/immudex-complete-project/immudex-import-gpgkeys.1 b/immudex-complete-project/immudex-import-gpgkeys.1 new file mode 100644 index 0000000..0b58ac0 --- /dev/null +++ b/immudex-complete-project/immudex-import-gpgkeys.1 @@ -0,0 +1,51 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-IMPORT-GPGKEYS "1" "May 2026" "immudex-import-gpgkeys 1.1" "User Commands" +.SH NAME +immudex-import-gpgkeys \- it's a script for import GPG keys and owner trust. +.SH SYNOPSIS +.B immudex-import-gpgkeys +[\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +it's a script for import GPG keys and owner trust. GPG keys can be used +by 'pass' \- POSIX compatibile password manager or signing. It's very +helpful, when your keys are in files in encrypted datastore. +Script requires to store GPG keys in home dir or change home dir before +execute a script. +.SH OPTIONS +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-v\fR +Print information about version, author and copyrights +.SH EXAMPLES +.TP +immudex\-import\-gpgkeys +Import GPG keys and owner trust. +.TP +immudex\-import\-gpgkeys \-h +Print this message. +.TP +immudex\-import\-gpgkeys \-v +Print information about version, author and copyrights. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-import-gpgkeys +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-import-gpgkeys +programs are properly installed at your site, the command +.IP +.B info immudex-import-gpgkeys +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-import-sshkeys b/immudex-complete-project/immudex-import-sshkeys new file mode 100755 index 0000000..6f7a72d --- /dev/null +++ b/immudex-complete-project/immudex-import-sshkeys @@ -0,0 +1,63 @@ +#!/bin/bash + +function help() { + echo "it's a script for copying OpenSSH client files such as keys and config file into user native home directory."; + echo "This command should be run in other home directory, where ssh keys are stored."; + echo; + echo "Usage: immudex-import-sshkeys [-i] [-h] [-v]"; + echo; + echo "Options:"; + echo " -i Import hostnames and adresses to /etc/host file (sudo required) from SSH config file if exist."; + echo " -h Print this message."; + echo " -v Print information about version, author and copyrights."; + echo; + echo "Examples:"; + echo " immudex-import-sshkeys Import OpenSSH client files into user native home dir."; + echo " immudex-import-sshkeys -i Import OpenSSH client files and create DNS resolve database in /etc/hosts by taking data from OpenSSH client config file, if exist."; + echo " immudex-import-sshkeys -h Print this message."; + echo " immudex-import-sshkeys -v Print information about version, author and copyrights." + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-import-sshkeys 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + elif [ "$1" = "-v" ]; then + version; + fi +else +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 +fi diff --git a/immudex-complete-project/immudex-import-sshkeys.1 b/immudex-complete-project/immudex-import-sshkeys.1 new file mode 100644 index 0000000..bc26d50 --- /dev/null +++ b/immudex-complete-project/immudex-import-sshkeys.1 @@ -0,0 +1,54 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-IMPORT-SSHKEYS "1" "May 2026" "immudex-import-sshkeys 1.1" "User Commands" +.SH NAME +immudex-import-sshkeys \- it's a script for copying OpenSSH client files such as keys and config file into user native home directory +.SH SYNOPSIS +.B immudex-import-sshkeys +[\fI\,-i\/\fR] [\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +it's a script for copying OpenSSH client files such as keys and config file into user native home directory. +This command should be run in other home directory, where ssh keys are stored. +.SH OPTIONS +.TP +\fB\-i\fR +Import hostnames and adresses to \fI\,/etc/host\/\fP file (sudo required) from SSH config file if exist. +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-v\fR +Print information about version, author and copyrights. +.SH EXAMPLES +.TP +immudex\-import\-sshkeys +Import OpenSSH client files into user native home dir. +.TP +immudex\-import\-sshkeys \-i +Import OpenSSH client files and create DNS resolve database in /etc/hosts by taking data from OpenSSH client config file, if exist. +.TP +immudex\-import\-sshkeys \-h +Print this message. +.TP +immudex\-import\-sshkeys \-v +Print information about version, author and copyrights. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-import-sshkeys +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-import-sshkeys +programs are properly installed at your site, the command +.IP +.B info immudex-import-sshkeys +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-install b/immudex-complete-project/immudex-install new file mode 100755 index 0000000..e77f7d0 --- /dev/null +++ b/immudex-complete-project/immudex-install @@ -0,0 +1,210 @@ +#!/bin/bash + +RED="\e[31m"; +GREEN="\e[32m"; +ENDCOLOR="\e[0m"; + +function help() { + echo "it's a script for installation immudex LiveCD images on computer hard"; + echo "disk. This program runs interactivly and the one thing you need to do"; + echo "is choose a right disk for installation. That's all, but if you using"; + echo "custom images, you may need change partition size for immudex image." + echo "It's hard to imagine, how it's possible to create images bigger than 3"; + echo "GB. It would happens. More space in this partition is also needed for"; + echo "upgrades tasks. So if your image is bigger than 2 GiB, you need to "; + echo "change size of this partition before you start instalation."; + echo "Recomended size is 3 times the image size. The partition size can be"; + echo "changed via below described option."; + echo "This script requires superuser (root) privileges."; + echo; + echo "Usage: immudex-install [-p 3G] [-h] [-v]"; + echo; + echo "Options:"; + echo " -p 3G This option change a partition size with immudex image. Usefull for custom builds. By default it's 3GB."; + echo " -h Print this message."; + echo " -v Print information about version, author and copyrights."; + echo; + echo "Examples:"; + echo " immudex-install Standard execution, instalation immudex LiveCD on computer hard disk."; + echo " immudex-install -p 6G Run install script for custom immudex image build."; + echo " immudex-install -h Print this message."; + echo " immudex-install -v Print information about version, author and copyrights."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-install 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; + +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + exit 0; + elif [ "$1" = "-v" ]; then + version; + exit 0; + fi +fi +if [ "$1" ]; then + if $(echo $1 | grep -q '-p'); then + idxPartSize=$2; + else + idxPartSize="3G"; + fi +else + idxPartSize="3G"; +fi + +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 $idxPartSize > /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 $idxPartSize > /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/immudex-complete-project/immudex-install.1 b/immudex-complete-project/immudex-install.1 new file mode 100644 index 0000000..fccf14f --- /dev/null +++ b/immudex-complete-project/immudex-install.1 @@ -0,0 +1,63 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-INSTALL "1" "May 2026" "immudex-install 1.1" "User Commands" +.SH NAME +immudex-install \- immudex installation script +.SH SYNOPSIS +.B immudex-install +[\fI\,-p 3G\/\fR] [\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +it's a script for installation immudex LiveCD images on computer hard +disk. This program runs interactivly and the one thing you need to do +is choose a right disk for installation. That's all, but if you using +custom images, you may need change partition size for immudex image. +It's hard to imagine, how it's possible to create images bigger than 3 +GB. It would happens. More space in this partition is also needed for +upgrades tasks. So if your image is bigger than 2 GiB, you need to +change size of this partition before you start instalation. +Recomended size is 3 times the image size. The partition size can be +changed via below described option. +This script requires superuser (root) privileges. +.SH OPTIONS +.TP +\fB\-p\fR 3G +This option change a partition size with immudex image. Usefull for custom builds. By default it's 3GB. +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-v\fR +Print information about version, author and copyrights. +.SH EXAMPLES +.TP +immudex\-install +Standard execution, instalation immudex LiveCD on computer hard disk. +.TP +immudex\-install \-p 6G +Run install script for custom immudex image build. +.TP +immudex\-install \-h +Print this message. +.TP +immudex\-install \-v +Print information about version, author and copyrights. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-install +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-install +programs are properly installed at your site, the command +.IP +.B info immudex-install +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-meteo b/immudex-complete-project/immudex-meteo new file mode 100755 index 0000000..fadb5f5 --- /dev/null +++ b/immudex-complete-project/immudex-meteo @@ -0,0 +1,47 @@ +#!/bin/bash + +function help() { + echo "immudex-meteo script fetching weather status from wttr.in webpage." + echo "The weather status is availabel to get in 3 formats described below"; + echo "in options."; + echo; + echo "Usage: immudex-meteo [-s|-l|-m location] [-h] [-v]"; + echo; + echo "Options:"; + echo " -s location Short human readable format with one small ascii art."; + echo " -l location Long format, more readable, weather for every stage of the day and 2-day forecast"; + echo " -m location Micro format, one line with details (current weather)"; + echo " -h Prints this message"; + echo " -v Prints information about version, author and copyrights"; + echo; + echo "Exmaples:"; + echo " immudex-meteo -s London Current weather in London in short format."; + echo " immudex-meteo -l Berlin Weather for whole day in Berlin and 2-day forecast."; + echo " immudex-meteo -m Warszawa One line with weather information from Warsaw, good for motd's or resources monitors."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-meteo 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ "$1" ]; then + case $1 in + "-s") curl wttr.in/${2}?0\&lang=pl;; + "-l") curl wttr.in/${2}?lang=pl;; + "-m") curl wttr.in/${2}?format=4;; + "-h") help; exit 0;; + "-v") version; exit 0;; + *) help; exit 1;; + esac +else + help; + exit 1; +fi diff --git a/immudex-complete-project/immudex-meteo.1 b/immudex-complete-project/immudex-meteo.1 new file mode 100644 index 0000000..7105eb8 --- /dev/null +++ b/immudex-complete-project/immudex-meteo.1 @@ -0,0 +1,58 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-METEO "1" "May 2026" "immudex-meteo 1.1" "User Commands" +.SH NAME +immudex-meteo \- BASH script fetching weather status from wttr.in webpage. +.SH SYNOPSIS +.B immudex-meteo +[\fI\,-s|-l|-m location\/\fR] [\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +immudex\-meteo script fetching weather status from wttr.in webpage. +The weather status is availabel to get in 3 formats described below +in options. +.SH OPTIONS +.TP +\fB\-s\fR location +Short human readable format with one small ascii art. +.TP +\fB\-l\fR location +Long format, more readable, weather for every stage of the day and 2\-day forecast +.TP +\fB\-m\fR location +Micro format, one line with details (current weather) +.TP +\fB\-h\fR +Prints this message +.TP +\fB\-v\fR +Prints information about version, author and copyrights +.SS "Exmaples:" +.TP +immudex\-meteo \fB\-s\fR London +Current weather in London in short format. +.TP +immudex\-meteo \fB\-l\fR Berlin +Weather for whole day in Berlin and 2\-day forecast. +.TP +immudex\-meteo \fB\-m\fR Warszawa +One line with weather information from Warsaw, good for motd's or resources monitors. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-meteo +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-meteo +programs are properly installed at your site, the command +.IP +.B info immudex-meteo +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-morketsmerke b/immudex-complete-project/immudex-morketsmerke new file mode 100755 index 0000000..acbced6 --- /dev/null +++ b/immudex-complete-project/immudex-morketsmerke @@ -0,0 +1,90 @@ +#!/bin/bash + +function help() { + echo "script for fetch and adjust morketsmerke.org site"; + echo "as offline available source of information."; + echo "By default script open downloaded site in terminal via W3M browser with"; + echo "monochrome mode."; + echo; + echo "Usage: immudex-morketsmerke [-b] [-h] [-v]"; + echo; + echo "Options:"; + echo " -b Launching fetched site in default application for open html sites."; + echo " -h Print this message."; + echo " -v Print information about version, author and copyrights"; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-morketsmerke 1.0"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +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 + +} + +if [ "$1" ] && [ "$1" = "-h" ]; then + help; + exit 0; +elif [ "$1" ] && [ "$1" = "-v" ]; then + version; + exit +else + morketsmerke_path=/usr/share/doc/morketsmerke; + + if [ ! -d $morketsmerke_path ]; then + /usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1; + if [ $? -eq 0 ]; then + install_morketsmerke; + else + echo "There is no internet connection."; + exit 1; + fi + fi + if [ "$1" ] && [ "$1" = "-b" ]; then + xdg-open ${morketsmerke_path}/index.html; + else + w3m -M ${morketsmerke_path}/index.html; + fi +fi diff --git a/immudex-complete-project/immudex-morketsmerke.1 b/immudex-complete-project/immudex-morketsmerke.1 new file mode 100644 index 0000000..36233ee --- /dev/null +++ b/immudex-complete-project/immudex-morketsmerke.1 @@ -0,0 +1,43 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-MORKETSMERKE "1" "May 2026" "immudex-morketsmerke 1.0" "User Commands" +.SH NAME +immudex-morketsmerke \- Fetch and adjust morketsmerke.org site +.SH SYNOPSIS +.B immudex-morketsmerke +[\fI\,-b\/\fR] [\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +script for fetch and adjust morketsmerke.org site +as offline available source of information. +By default script open downloaded site in terminal via W3M browser with +monochrome mode. +.SH OPTIONS +.TP +\fB\-b\fR +Launching fetched site in default application for open html sites. +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-v\fR +Print information about version, author and copyrights +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-morketsmerke +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-morketsmerke +programs are properly installed at your site, the command +.IP +.B info immudex-morketsmerke +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-motd b/immudex-complete-project/immudex-motd new file mode 100755 index 0000000..0d3fa8c --- /dev/null +++ b/immudex-complete-project/immudex-motd @@ -0,0 +1,107 @@ +#!/bin/bash + + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + echo "immudex-motd prints configurable message of the day."; + echo "Information and its quantity can be changed via the configuration file."; + echo "Script using figlet basic font and lolcat for print header of message."; + echo; + echo "Usage: immudex-motd [-h] [-v]"; + echo; + echo "Options:"; + echo " -h Print this message."; + echo " -v Print information about version, author and copyright"; + echo; + echo "Files:"; + echo " /etc/motd.conf Script configuration file."; + echo " /usr/share/doc/immudex-motd/motd.conf.sample Example configuration file."; + echo; + echo "Examples:"; + echo " immudex-motd Run a script."; + echo; + echo "Report bugs to "; + exit 0; + fi + if [ "$1" = "-v" ]; then + echo "immudex-motd 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; + exit 0; + fi +fi + +if [ -f /etc/motd.conf ]; then + source /etc/motd.conf; +else + source /usr/share/doc/immudex-motd/motd.conf.sample; +fi + +echo -en "\e[1m"; echo "$(hostname)" | /usr/bin/figlet | lolcat; echo -en "\e[0m"; +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 [ "$MOUNT_POINTS" ]; then + echo -e " \tMount points:\tFree/Total\t(Usage%)"; + for mountPoint in $MOUNT_POINTS; do + if $(df -h 2>/dev/null | grep -q "${mountPoint}"); then + diskSize=$(df -h 2> /dev/null | grep "${mountPoint}" | awk '{printf $2}'); + diskFree=$(df -h 2> /dev/null | grep "${mountPoint}" | awk '{printf $4}'); + diskUsage_perc=$(df -h 2> /dev/null | grep "${mountPoint}" | sed 's/%//' | awk '{printf $5}'); + echo -e "\t$(echo $mountPoint | sed 's,\$,,'):\t\t${diskFree}/${diskSize}\t(${diskUsage_perc}%)"; + fi + done +fi +if $(echo $OPTIONS | grep -q 'cryptparts'); then + 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 +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; +if [ -x /usr/local/bin/immudex-meteo ]; then +echo "Weather:"; + if [ "$LOCATION" ]; then + /usr/local/bin/immudex-meteo --micro $LOCATION; + fi +fi +echo; +if [ "$FOOTER" ]; then + echo -e "$FOOTER"; +fi +echo; +echo "===================================================================="; diff --git a/immudex-complete-project/immudex-motd.1 b/immudex-complete-project/immudex-motd.1 new file mode 100644 index 0000000..c924db1 --- /dev/null +++ b/immudex-complete-project/immudex-motd.1 @@ -0,0 +1,50 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-MOTD "1" "May 2026" "immudex-motd 1.1" "User Commands" +.SH NAME +immudex-motd \- Prints configurable message of the day. +.SH SYNOPSIS +.B immudex-motd +[\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +immudex\-motd prints configurable message of the day. +Information and its quantity can be changed via the configuration file. +Script using figlet basic font and lolcat for print header of message. +.SH OPTIONS +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-v\fR +Print information about version, author and copyright +.SH FILES +.TP +\fI\,/etc/motd.conf\/\fP +Script configuration file. +.TP +\fI\,/usr/share/doc/immudex\-motd/motd.conf.sample\/\fP +Example configuration file. +.SH EXAMPLES +.TP +immudex\-motd +Run a script. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-motd +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-motd +programs are properly installed at your site, the command +.IP +.B info immudex-motd +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-padlock b/immudex-complete-project/immudex-padlock new file mode 100755 index 0000000..6e0560d --- /dev/null +++ b/immudex-complete-project/immudex-padlock @@ -0,0 +1,120 @@ +#!/bin/bash + +function help(){ + echo "it's a switch script. This script, if there is more than one cryptdisk"; + echo "gives a change to choose a cryptdisk and starts opening him. After"; + echo "sucessful opening, it spawns a terminal window with CWD sets up on"; + echo "choosed cryptdisk mountpoint and change the launcher icon in the bottom"; + echo "panel, which informs user, there are a opened cryptdisks. When user,"; + echo "execute script once again, he close all opened cryptdisk either that"; + echo "not open with this script. At least he tries. In some cases it will be"; + echo "impossible, because there are processes which using this cryptdisk or"; + echo "inside this mount point there is other mount point. This is signaled,"; + echo "by apropriate notification."; + echo "This script needs superuser (root) privileges, but using sudo command"; + echo "is implemented inside the script, you don't needed to launch this"; + echo "via sudo."; + echo; + echo "Usage: immudex-padlock [-h] [-v]"; + echo; + echo "Example:"; + echo " immudex-padlock Standard script execution, explained above."; + echo " immudex-padlock -h Print this message."; + echo " immudex-padlock -v Print information about version, author and copyrights."; + echo; + echo "Files:"; + echo " /usr/share/icons/padlock-icon.png Symlink, original launcher icon."; + echo " /usr/share/icons/changes-prevent.png Original, closed padlock icon."; + echo " /usr/share/icons/changes-allow.png Original, open padlock icon."; + echo " /etc/skel/.config/xfce4/panel/launcher-14/16844255236.desktop XFCE4 bottom panel script activator."; + echo; + echo "Report bugs to "; +} + +function version(){ + echo "immudex-padlock 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +launcher="/home/${USER}/.config/xfce4/panel/launcher-14/16844255236.desktop"; + +function main_unlock() { + sudo /usr/local/sbin/immudex-crypt --open=$1; + index=$(basename $(sudo /usr/local/sbin/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 +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + elif [ "$1" = "-v" ]; then + version; + fi +else + mapperDeviceList=$(ls /dev/mapper | grep 'immudex-*' | awk '{printf $1" "}'); + + if [ "$mapperDeviceList" ]; then lock; + else unlock; + fi +fi diff --git a/immudex-complete-project/immudex-padlock.1 b/immudex-complete-project/immudex-padlock.1 new file mode 100644 index 0000000..be93b4f --- /dev/null +++ b/immudex-complete-project/immudex-padlock.1 @@ -0,0 +1,65 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-PADLOCK "1" "May 2026" "immudex-padlock 1.1" "User Commands" +.SH NAME +immudex-padlock \- it's a switch script. This script, if there is more than one cryptdisk gives a change to choose a cryptdisk and starts opening him. +.SH SYNOPSIS +.B immudex-padlock +[\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +it's a switch script. This script, if there is more than one cryptdisk +gives a change to choose a cryptdisk and starts opening him. After +sucessful opening, it spawns a terminal window with CWD sets up on +choosed cryptdisk mountpoint and change the launcher icon in the bottom +panel, which informs user, there are a opened cryptdisks. When user, +execute script once again, he close all opened cryptdisk either that +not open with this script. At least he tries. In some cases it will be +impossible, because there are processes which using this cryptdisk or +inside this mount point there is other mount point. This is signaled, +by apropriate notification. +This script needs superuser (root) privileges, but using sudo command +is implemented inside the script, you don't needed to launch this +via sudo. +.SS "Example:" +.TP +immudex\-padlock +Standard script execution, explained above. +.TP +immudex\-padlock \fB\-h\fR +Print this message. +.TP +immudex\-padlock \fB\-v\fR +Print information about version, author and copyrights. +.SH FILES +.TP +\fI\,/usr/share/icons/padlock\-icon.png\/\fP +Symlink, original launcher icon. +.TP +\fI\,/usr/share/icons/changes\-prevent.png\/\fP +Original, closed padlock icon. +.TP +\fI\,/usr/share/icons/changes\-allow.png\/\fP +Original, open padlock icon. +.TP +/etc/skel/.config/xfce4/panel/launcher\-14/16844255236.desktop +XFCE4 bottom panel script activator. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-padlock +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-padlock +programs are properly installed at your site, the command +.IP +.B info immudex-padlock +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-pl b/immudex-complete-project/immudex-pl new file mode 100755 index 0000000..2425f37 --- /dev/null +++ b/immudex-complete-project/immudex-pl @@ -0,0 +1,146 @@ +#!/bin/bash + +GREEN="\e[32m"; +RED="\e[31m"; +YELLOW="\e[33m"; +ENDCOLOR="\e[0m"; +SYSTEM_CC=$(echo $LANG | cut -c 1-2); + +function help() { + echo "immudex-pl opening (play) links. Script creates menu from link list, which"; + echo "can be open via mpv (with yt-dlp hook). Normally links are open as"; + echo "audio stream. Script work in loop, which means you can change playback"; + echo "while the current one is still playing. When you need to exit type any letter instead of number."; + echo "Script is not only for YouTube Links, it can also open"; + echo "internet radios or shoutcasts. The link list can be downloaded and does"; + echo "not need to be stored on the target device. Script will delete the"; + echo "file at the end of its execution. "; + echo; + echo "Usage: immudex-pl [-V youtube_video_quality] [-h] [-v] link-list"; + echo; + echo "Options:"; + echo " -V 240p...1080p Open link as video."; + echo " -h Print this message."; + echo " -v Print information about version, author and copyrights."; + echo; + echo "Files:"; + echo " /usr/share/doc/immudex-pl/links.list.example Example link list file."; + echo; + echo "Examples:" + echo " immudex-pl ~/radio-links.txt Open given link list as audio stream."; + echo " immudex-pl -V 360p ./yt-links Open given link list as video in 360p format."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-pl 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ "$1" ] && [ $1 = "-V" ]; then + video=1; + shift; + if $(echo $1 | grep -q '[0-9]*p'); then + format=$(echo $1 | sed 's/p//g') + fi + shift; + file=$1; +elif [ "$1" ] && [ $1 = "-h" ]; then + help; + exit 0; +elif [ "$1" ] && [ $1 = "-v" ]; then + version; + exit 0; +else + file=$1; +fi + + +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-3); + if [ ! "$link" ]; then + linkName=$(echo $name | sed 's/_/\ /g'); + link=$(grep "$linkName" $file | cut -d ":" -f 2-3); + fi + if echo $link | grep -q "youtube"; then + link=$(echo $link | sed 's/\ //g'); + if [ "$video" ]; then + #ytplay -v $link -f $format + #format="--ytdl-format=$(grep "$link" $file | cut -d ":" -f 4-)"; + echo "Getting requested video format ID..."; + video=$(yt-dlp --list-formats $link 2>/dev/null | grep "$format" | sed -n '1p' | awk '{printf $1}') + if [ ! "$video" ]; then + echo -e "Getting requested video format ID...[ ${RED}FAILED${ENDCOLOR} ]"; + exit 1; + else + echo -e "Getting requested video format ID...[ ${GREEN}OK${ENDCOLOR} ]"; + fi + + echo "Getting appropiate audio format ID for video..."; + audio=$(yt-dlp --list-formats $link 2>/dev/null | grep 'audio only' | grep "$SYSTEM_CC" | sed -n '1p' | awk '{printf $1}'); + if [ ! "$audio" ]; then + echo -e "Getting audio format based on your locales...[ ${RED}FAILED${ENDCOLOR} ]"; + echo "Getting high quality audio stream format..."; + audio=$(yt-dlp --list-formats $link 2>/dev/null | grep 'audio only' | grep "high" | sed -n '1p' | awk '{printf $1}'); + if [ ! "$audio" ]; then + echo -e "No audio stream found...[ ${RED}FAILED${ENDCOLOR} ]"; + echo -e "There is no separate audio stream...[ ${YELLOW}FINE${ENDCOLOR} ]"; + #exit 1; + else + echo -e "Getting high quality audio stream format...[ ${GREEN}OK${ENDCOLOR} ]"; + fi + else + echo -e "Getting audio format based on your locales...[ ${GREEN}OK${ENDCOLOR} ]"; + fi + if [ ! "$audio" ]; then + fmat="--ytdl-format=${video}"; + else + fmat="--ytdl-format=${video}+${audio}"; + fi + echo "MPV is starting up..."; + mpv $fmat $link > /dev/null 2>&1 & MPVPID=$! + + else + #ytplay -a $link -f best[height=360] + format="--no-video"; + echo "MPV is starting up..."; + mpv $format $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/immudex-complete-project/immudex-pl.1 b/immudex-complete-project/immudex-pl.1 new file mode 100644 index 0000000..f65252b --- /dev/null +++ b/immudex-complete-project/immudex-pl.1 @@ -0,0 +1,58 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-PL "1" "May 2026" "immudex-pl 1.1" "User Commands" +.SH NAME +immudex-pl \- Opening (play) links from link list. +.SH SYNOPSIS +.B immudex-pl +[\fI\,-V youtube_video_quality\/\fR] [\fI\,-h\/\fR] [\fI\,-v\/\fR] \fI\,link-list\/\fR +.SH DESCRIPTION +immudex\-pl opening (play) links. Script creates menu from link list, which +can be open via mpv (with yt\-dlp hook). Normally links are open as +audio stream. Script work in loop, which means you can change playback +while the current one is still playing. When you need to exit type any letter instead of number. +Script is not only for YouTube Links, it can also open +internet radios or shoutcasts. The link list can be downloaded and does +not need to be stored on the target device. Script will delete the +file at the end of its execution. +.SH OPTIONS +.TP +\fB\-V\fR 240p...1080p +Open link as video. +.TP +\fB\-h\fR +Print this message. +.TP +\fB\-v\fR +Print information about version, author and copyrights. +.SH FILES +.TP +\fI\,/usr/share/doc/immudex\-pl/links.list.example\/\fP +Example link list file. +.SH EXAMPLES +.TP +immudex\-pl ~/radio\-links.txt +Open given link list as audio stream. +.TP +immudex\-pl \-V 360p ./yt\-links +Open given link list as video in 360p format. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-pl +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-pl +programs are properly installed at your site, the command +.IP +.B info immudex-pl +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-run b/immudex-complete-project/immudex-run new file mode 100755 index 0000000..5f16fdc --- /dev/null +++ b/immudex-complete-project/immudex-run @@ -0,0 +1,51 @@ +#!/bin/bash + +function help() { + echo "This script allows to run a program with pointed home dir on first"; + echo "opened LUKS partition via immudex-crypt tool. The most programs in"; + echo "Linux write some data in users home dirs. Doing this persistentaly"; + echo "in immudex is imposible, because all default users home dirs came back"; + echo "to state from image and wroted date are gone. Running programs via this"; + echo "scripts makes possible to save this date on first 'crypt'."; + echo "This script can be use to make your own activators easlly."; + echo; + echo "Usage: immudex-run [-h] [-v] program_name [program_args]"; + echo; + echo "Examples:"; + echo " immudex-run firefox-esr Run given program"; + echo " immudex-run -h Print this message"; + echo " immudex-run -v Print information about version, author and copyrights"; + echo; + echo "Report bugs to "; +} + +function version(){ + echo "immudex-run 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + exit 0; + elif [ "$1" = "-v" ]; then + version; + exit 0; + fi +fi + +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/immudex-complete-project/immudex-run.1 b/immudex-complete-project/immudex-run.1 new file mode 100644 index 0000000..1628272 --- /dev/null +++ b/immudex-complete-project/immudex-run.1 @@ -0,0 +1,46 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-RUN "1" "May 2026" "immudex-run 1.1" "User Commands" +.SH NAME +immudex-run \- Script for run a program in changed user home dir. +.SH SYNOPSIS +.B immudex-run +[\fI\,-h\/\fR] [\fI\,-v\/\fR] \fI\,program_name \/\fR[\fI\,program_args\/\fR] +.SH DESCRIPTION +This script allows to run a program with pointed home dir on first +opened LUKS partition via immudex\-crypt tool. The most programs in +Linux write some data in users home dirs. Doing this persistentaly +in immudex is imposible, because all default users home dirs came back +to state from image and wroted date are gone. Running programs via this +scripts makes possible to save this date on first 'crypt'. +This script can be use to make your own activators easlly. +.SH EXAMPLES +.TP +immudex\-run firefox\-esr +Run given program +.TP +immudex\-run \-h +Print this message +.TP +immudex\-run \-v +Print information about version, author and copyrights +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-run +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-run +programs are properly installed at your site, the command +.IP +.B info immudex-run +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-secured-firefox b/immudex-complete-project/immudex-secured-firefox new file mode 100755 index 0000000..593956f --- /dev/null +++ b/immudex-complete-project/immudex-secured-firefox @@ -0,0 +1,43 @@ +#!/bin/bash + +function help() { + echo "This tool running up a Firefox browser via firejail with sandboxing "; + echo "and forcing network interface to that we use to internet connection."; + echo; + echo "Usage: immudex-secured-firefox [-h] [-v]"; + echo; + echo "Exaples:"; + echo " immudex-secured-firefox Run secured browser."; + echo " immudex-secured-firefox -h Print this message."; + echo " immudex-secured-firefox -v Print information about version, author and copyrights"; + echo; + echo "Report bugs to "; +} + +function version(){ + echo "immudex-secured-firefox 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + exit 0; + elif [ "$1" = "-v" ]; then + version; + exit 0; + fi +fi + +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/immudex-complete-project/immudex-secured-firefox.1 b/immudex-complete-project/immudex-secured-firefox.1 new file mode 100644 index 0000000..0079f10 --- /dev/null +++ b/immudex-complete-project/immudex-secured-firefox.1 @@ -0,0 +1,41 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-SECURED-FIREFOX "1" "May 2026" "immudex-secured-firefox 1.1" "User Commands" +.SH NAME +immudex-secured-firefox \- Run secured firefox. +.SH SYNOPSIS +.B immudex-secured-firefox +[\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +This tool running up a Firefox browser via firejail with sandboxing +and forcing network interface to that we use to internet connection. +.SS "Exaples:" +.TP +immudex\-secured\-firefox +Run secured browser. +.TP +immudex\-secured\-firefox \fB\-h\fR +Print this message. +.TP +immudex\-secured\-firefox \fB\-v\fR +Print information about version, author and copyrights +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-secured-firefox +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-secured-firefox +programs are properly installed at your site, the command +.IP +.B info immudex-secured-firefox +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-secured-librewolf b/immudex-complete-project/immudex-secured-librewolf new file mode 100755 index 0000000..b37b615 --- /dev/null +++ b/immudex-complete-project/immudex-secured-librewolf @@ -0,0 +1,44 @@ +#!/bin/bash + +function help() { + echo "immudex-secured-librewolf, support for LibreWolf version. LibreWolf isn't"; + echo "part of immudex, but this tool officialy existed as a part of project."; + echo; + echo "Usage: immudex-secured-librewolf [-h] [-v]"; + echo; + echo "Examples:"; + echo " immudex-secured-librewolf Run sandboxed LibreWolf browser." + echo " immudex-secured-librewolf -h Print this messages." + echo " immudex-secured-librewolf -v Print information about version, author and copyrights."; + echo; + echo "Report bugs to "; +} + +function version(){ + echo "immudex-secured-librewolf 1.1"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ "$1" ]; then + if [ "$1" = "-h" ]; then + help; + exit; + elif [ "$1" = "-v" ]; then + version; + exit; + fi +fi + + +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/immudex-complete-project/immudex-secured-librewolf.1 b/immudex-complete-project/immudex-secured-librewolf.1 new file mode 100644 index 0000000..7d26f1d --- /dev/null +++ b/immudex-complete-project/immudex-secured-librewolf.1 @@ -0,0 +1,41 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH IMMUDEX-SECURED-LIBREWOLF "1" "May 2026" "immudex-secured-librewolf 1.1" "User Commands" +.SH NAME +immudex-secured-librewolf \- Run secured LibreWolf. +.SH SYNOPSIS +.B immudex-secured-librewolf +[\fI\,-h\/\fR] [\fI\,-v\/\fR] +.SH DESCRIPTION +immudex\-secured\-librewolf, support for LibreWolf version. LibreWolf isn't +part of immudex, but this tool officialy existed as a part of project. +.SH EXAMPLES +.TP +immudex\-secured\-librewolf +Run sandboxed LibreWolf browser. +.TP +immudex\-secured\-librewolf \-h +Print this messages. +.TP +immudex\-secured\-librewolf \-v +Print information about version, author and copyrights. +.SH AUTHOR +Written by xf0r3m. +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2026 morketsmerke.org +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +The full documentation for +.B immudex-secured-librewolf +is maintained as a Texinfo manual. If the +.B info +and +.B immudex-secured-librewolf +programs are properly installed at your site, the command +.IP +.B info immudex-secured-librewolf +.PP +should give you access to the complete manual. diff --git a/immudex-complete-project/immudex-shoutcasts b/immudex-complete-project/immudex-shoutcasts new file mode 100755 index 0000000..3c33211 --- /dev/null +++ b/immudex-complete-project/immudex-shoutcasts @@ -0,0 +1,162 @@ +#!/bin/bash + +GREEN="\e[32m"; +RED="\e[31m"; +ENDCOLOR="\e[0m"; +BOLD="\e[1m"; +BOLD_GREEN="\e[1;32m"; +BOLD_YELLOW="\e[1;33m"; +BOLD_BLUE="\e[1;34m"; + +function help() { + echo "immudex-shoutcasts script that search internet radios or shoutcasts in two sources xiph.org icecast"; + echo "directory and download .m3u file from radio-browser.info based on a space-separated keywords."; + echo "Data from radio-browser.info are limited to 30 results."; + echo; + echo "Usage: immudex-shoutcasts [--source=icecast | radio] [--help] [--version] --keywords=keyword1...keywordN"; + echo; + echo "Options:"; + echo " --source=icecast/radio This parameter specifies source, if we want define a source. It can be omitted, then both sources will be searched."; + echo " --keywords=keyword1...keywordsN This parameter is required, it pass keywords to search. Keywords are space-separated."; + echo " --help Print this message."; + echo " --version Print information about version, author and copyrights."; + echo; + echo "Examples:"; + echo " immudex-shoutcasts --keywords=Classic Rock Script will be search internet radios and shoutcast for 'Classic Rock' keywords"; + echo " immudex-shoutcasts --source=radio --keywords=lofi Script will be search internet radios (because source is given) for 'lofi' keyword"; + echo; + echo "Files:" + echo " /tmp/icecast.idx Temporary file, store search results from icecast directory for parsing."; + echo " /tmp/radio.idx Temporary file, downloaded .m3u file from radio-browser.info store search results for parsing."; + echo; + echo "Report bugs to "; +} + +function version() { + echo "immudex-shoutcasts 1.0"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + + +function getDataBetweenHtmlMarks() { + grep "$1" $2 | sed -n "${3}p" | cut -d ">" -f 2 | cut -d "<" -f 1; +} + +function listOfStations() { + query=$1; + src=$2; + + case $src in + "icecast") wget http://dir.xiph.org/search?q=$query -O /tmp/icecast.idx >> /dev/null 2>&1; + file="/tmp/icecast.idx";; + "radio") wget "https://de1.api.radio-browser.info/m3u/stations/search?limit=30&name=${query}&hidebroken=true&order=clickcount&reverse=true" -O /tmp/radio.idx >> /dev/null 2>&1; + file="/tmp/radio.idx"; + dos2unix $file; + esac + + if [ ! -f $file ]; then + echo -e "${RED}There is no internet connection or sources are currently"; + echo -e "unavailable.${ENDCOLOR}"; + exit 1; + fi + + case $src in + "icecast") amountOfStations=$(grep 'card-title' $file | wc -l);; + "radio") amountOfStations=$(grep '#EXTINF' $file | wc -l);; + esac + + case $src in + "icecast") echo -e "${BOLD}Icecast directory:${ENDCOLOR}";; + "radio") echo -e "${BOLD}radio-browser.info:${ENDCOLOR}";; + esac + + i=1; + while [ $i -le $amountOfStations ]; do + case $src in + "icecast") stationName=$(getDataBetweenHtmlMarks 'card-title' $file $i);; + "radio") stationName=$(grep '#EXTINF' $file | sed -n "${i}p" | cut -d "," -f 2-);; + esac + if [ "$src" = "icecast" ]; then + whatIsPlayingNow=$(getDataBetweenHtmlMarks 'card-subtitle' $file $i); + fi + case $src in + "icecast") link=$(grep 'Play' $file | sed -n "${i}p" | cut -d '"' -f 2);; + "radio") link=$(grep '://' $file | sed -n "${i}p");; + esac + echo -e "${BOLD}${i}.${ENDCOLOR} ${BOLD_YELLOW}${stationName}${ENDCOLOR}"; + if [ "$whatIsPlayingNow" ]; then + echo -e "\t${BOLD}Now playing:${ENDCOLOR} ${BOLD_BLUE}${whatIsPlayingNow}${ENDCOLOR}"; + unset whatIsPlayingNow; + fi + echo -e "\t${BOLD}Link:${ENDCOLOR} ${BOLD_GREEN}${link}${ENDCOLOR}"; + i=$(expr $i + 1); + done + unset i; + echo; +} + +if [ "$1" ]; then + + if [ "$1" ] && [ "$1" = "--help" ]; then + help; + exit 0; + elif [ "$1" ] && [ "$1" = "--version" ]; then + version; + exit 0; + fi + + option=$(echo $1 | cut -d '=' -f 1); + if [ "$option" = "--source" ]; then + src=$(echo $1 | cut -d '=' -f 2); + search=$(echo $* | cut -d '=' -f 3-); + elif [ "$option" = "--keywords" ]; then + search=$(echo $* | cut -d "=" -f 2-); + fi +else + help; + exit 1; +fi + +if [ "$src" ]; then + listOfStations "$search" $src; + if [ "$src" = "icecast" ]; then + file="/tmp/icecast.idx"; + else + file="/tmp/radio.idx"; + fi +else + listOfStations "$search" 'icecast'; + listOfStations "$search" 'radio'; + + PS3="source? "; + select src in 'icecast' 'radio'; do + case $src in + 'icecast') file="/tmp/icecast.idx";; + 'radio') file="/tmp/radio.idx";; + *) exit 0; + esac + break + done +fi + +echo -n "Station? "; +read station; +if $(echo $station | grep -q '[0-9]') && [ $station -le 30 ]; then + case $file in + '/tmp/icecast.idx') link=$(grep 'Play' $file | sed -n "${station}p" | cut -d '"' -f 2);; + '/tmp/radio.idx') link=$(grep '://' $file | sed -n "${station}p");; + esac + case $src in + "icecast") stationName=$(getDataBetweenHtmlMarks 'card-title' $file $station);; + "radio") stationName=$(grep '#EXTINF' $file | sed -n "${station}p" | cut -d "," -f 2-);; + esac + echo -e "${BOLD}Station:${ENDCOLOR} ${BOLD_YELLOW}${stationName}${ENDCOLOR}"; + mpv --no-video $link; +else + exit 0; +fi diff --git a/immudex-complete-project/immudex-upgrade b/immudex-complete-project/immudex-upgrade new file mode 100755 index 0000000..b9a849d --- /dev/null +++ b/immudex-complete-project/immudex-upgrade @@ -0,0 +1,146 @@ +#!/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 "Script for searching upgrades and upgrade immudex."; + echo "Superuser (root) privileges are required."; + echo; + echo "Usage: immudex-upgrade [--help] [--version] [--check] [--upgrade] [--myversion] [--compilation-date] [--packages-upgradable [--security]]"; + echo; + echo "Options:"; + echo " --check Check there are upgrades for immudex"; + echo " --upgrade Upgrade immudex from given source"; + echo " --myversion Prints image details"; + echo " --compilation-date Prints date of image creation"; + echo " --packages-upgradable [--security] Updates apt (packages) list and prints available to upgrade packages, with --security modificator prints only pacakages from security repository branch"; + echo " --help Prints this message."; + echo " --version Prints information about version, author and copyrights."; + echo; + echo "Report bugs to "; +} + +function version(){ + echo "immudex-upgrade 1.0"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ $UID -ne 0 ]; then + echo "Permission denied!"; + help; + exit 1; +fi + +if [ "$1" ]; then + if [ "$1" = "--help" ]; then + help; + exit 0; + elif [ "$1" = "--version" ]; then + version; + exit 0; + fi + 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/immudex-complete-project/immudex-version b/immudex-complete-project/immudex-version new file mode 100755 index 0000000..9c663f7 --- /dev/null +++ b/immudex-complete-project/immudex-version @@ -0,0 +1,39 @@ +#!/bin/bash + +function help() { + echo "Script returns first 7 signs of immudex commit ID."; + echo; + echo "Usage: immudex-version [--help] [--version]"; + echo; + echo "Options:"; + echo " --help Print this message."; + echo " --version Print information about version, author and copyrights."; + echo; + echo "Files:"; + echo " /run/live/medium/live/changelog Stores information about currently running immudex image."; + echo; + echo "Report bugs to "; +} + +function version(){ + echo "immudex-version 1.0"; + echo; + echo "Copyright (C) 2026 morketsmerke.org"; + echo "This is free software; see the source for copying conditions. There is NO"; + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; + echo; + echo "Written by xf0r3m."; +} + +if [ "$1" ]; then + if [ "$1" = "--help" ]; then + help; + exit 0; + elif [ "$1" = "--version" ]; then + version; + exit 0; + fi +fi + +eval $(grep '^COMMIT' /run/live/medium/live/changelog) +echo $COMMIT | awk '{printf $1}' | cut -c 1-7 diff --git a/immudex-complete-project/immudex-ytplay b/immudex-complete-project/immudex-ytplay new file mode 100755 index 0000000..4634065 --- /dev/null +++ b/immudex-complete-project/immudex-ytplay @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 + +import sys +import subprocess +import re +from youtube_search import YoutubeSearch + +def usage(): + + print('''immudex-ytplay script for playing a video or audio track from YouTube. Script +can search based on given keywords and return list of results. User choose +one of result or repeats searching with 'r' || 'R' answer to number from +list result. Then script quering YouTube for available formats and table +with possible format are printed. User have to put video and audio quality +from table in requested format: videoQualityID+audioQualityID. There are +a hint. Script is half-interactive. + +Usage: immudex-ytplay [--search='keyword1...keywordN' --video | --audio] [--video youtube_link] [--audio youtube_link] [--help] [--version] + +Options: + --search='keyword1...keywordN' --video/--audio Search given keywords on YouTube and play video or audiotrack. + --video YouTube_Link Play YouTube video. + --audio YouTube_Link Play only YouTube video audiotrack. + --help Print this message. + --version Print information about version, author and copyrights. + +Examples: + immudex-ytplay --search='lofi' --audio Script will be search a lofi keyword in YouTube and play only audio tracks from choosen video. + immudex-ytplay --video https://youtube.com/watch?v=... Script will be play a video from given link, of course is publicly available. + immudex-ytplay --audio https://youtube.com/watch?v=... Script will be play a audio track from given video link. The principle of video playback also applies here. + +Report bugs to ''') + +def version(): + print('''immudex-ytplay 1.0 + +Copyright (C) 2026 morketsmerke.org +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +Written by xf0r3m.''') + +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' | 'R' to reload search result or send any other key to quit: ") + if isinstance(i, str) and i != 'r' and i != 'R' and not re.search("[0-9]+", i): + sys.exit(0) + + i = int(i) - 1 + return(results[i]['id'], results[i]['title'], results[i]['channel'], results[i]['duration'], results[i]['publish_time']) + +def getFormat(videoID): + subprocess.run(['yt-dlp', '--list-formats', 'https://youtube.com/watch?v=' + videoID]) + f = input("Please choose youtube video format, you need put video+audio ID of quality in this format or type anything else to quit:") + if not re.search("[0-9]{3}\+[0-9]{3}|[0-9]{2}", f): + sys.exit(0) + else: + return f + +if len(sys.argv) == 2: + if sys.argv[1] == '--help': + usage() + sys.exit(0) + elif sys.argv[1] == '--version': + version() + sys.exit(0) + +if len(sys.argv) < 2: + usage() + sys.exit(2) + +option=sys.argv[1].split("=", 1)[0] + +if option == '--search': + if len(sys.argv) > 2: + if sys.argv[2] == '--video': + mode = "video" + elif sys.argv[2] == '--audio': + mode = "audio" + else: + usage() + sys.exit(2) + keywords = sys.argv[1].split("=", 1)[1] + + video = ytSearch(keywords) + subprocess.run('clear') + + if mode == 'audio': + ytFormat = "--no-video" + else: + ytFormat = "--ytdl-format=" + getFormat(video[0]) + + 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("===================================================================") + + subprocess.run(['mpv', ytFormat, 'https://youtube.com/watch?v=' + video[0]]) + else: + usage() + sys.exit(2) + +elif sys.argv[1] == '--audio': + if len(sys.argv) > 2: + link=sys.argv[2] + ytFormat="--no-video" + subprocess.run(['mpv', ytFormat, link]) + else: + usage() + sys.exit(2) + +elif sys.argv[1] == '--video': + if len(sys.argv) > 2: + link=sys.argv[2] + videoID=link[-11:] + ytFormat="--ytdl-format=" + getFormat(videoID) + subprocess.run(['mpv', ytFormat, link]) + else: + usage() + sys.exit(2) diff --git a/immudex-complete-project/library.sh b/immudex-complete-project/library.sh new file mode 100755 index 0000000..1ba9ed8 --- /dev/null +++ b/immudex-complete-project/library.sh @@ -0,0 +1,100 @@ +#!/bin/bash + + +#function help() { +# echo "This script does noting. It's a collection of functions uses by"; +# echo "other tools, by import this file into it self. Man page for this script"; +# echo "can be usefull for describe above mentioned functions."; +# echo; +# echo "Notes:"; +# echo -e " get_debian_branch() Can be used for convert Debian codename for Debian branch name\n"; +# echo -e " get_machine_arch() Used for getting information is this 32 or 64-bit architecture.\n"; +# echo -e " check_distro_commit() Is used for decide that you use a latest version immudex if there are commit ahead your image, this script returns 0, otherwise 1.\n"; +# echo -e " ascii_colors() Prints immudex name in ASCII manuali.\n"; +# echo; +# echo "Usage: source /usr/local/bin/library.sh"; +# echo; +# echo "Options:"; +# echo " There is no options... Function help and version are used only for generate man page file and will be comment out after this."; +# echo; +# echo "Report bugs to "; +#} + +#function version(){ +# echo "library.sh 1.0"; +# echo; +# echo "Copyright (C) 2026 morketsmerke.org"; +# echo "This is free software; see the source for copying conditions. There is NO"; +# echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; +# echo; +# echo "Written by xf0r3m."; +#} + + +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}"; + +} + +#if [ "$1" ]; then +# if [ "$1" = "--help" ]; then +# help; +# exit 0; +# elif [ "$1" = "--version" ]; then +# version; +# exit 0; +# fi +#fi