├── Makefile ├── README.md ├── bootstrap.sh ├── busybox-1_34_1.zip ├── dlc.gif ├── dlc.sh ├── makeself-2.4.5 ├── COPYING ├── README.md ├── VERSION ├── makeself-header.sh ├── makeself.1 ├── makeself.lsm ├── makeself.sh ├── test-orc └── test │ ├── appendtest │ ├── bashunit │ ├── LICENSE │ ├── README.md │ ├── bashunit.bash │ └── test_example │ ├── corrupttest │ ├── datetest │ ├── extracttest │ ├── infotest │ ├── secret_key.gpg │ ├── signtest │ ├── suidtest │ ├── tarextratest │ ├── variabletest │ ├── whitespacelicensetest │ └── whitespacetest ├── scripts ├── c_git.sh ├── c_ssh.sh ├── chromium.sh ├── command_history.sh ├── firefox.sh ├── frequent_apps.sh ├── google-chrome.sh ├── trash.sh └── vim.sh ├── setup.sh └── tools ├── avml-minimal └── sqlite3 /Makefile: -------------------------------------------------------------------------------- 1 | MAIN_PACKAGES=bash libgcc libstdc++ lsof musl iptables findutils audit-libs linux-pam sudo libcrypto1.1 libmagic musl openssl-dev libmagic pkgconf jq gawk ncurses net-tools 2 | COMMUNITY_PACKAGES=patchelf 3 | ALPINE_REPO=http://dl-cdn.alpinelinux.org/alpine/v3.10 4 | APK=http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/apk-tools-static-2.10.8-r0.apk 5 | 6 | all: clean dlc package 7 | 8 | dlc: 9 | mkdir alpine && cd alpine \ 10 | && wget $(APK) -O - | tar -xzv \ 11 | && mkdir -p run bin usr/bin usr/sbin target \ 12 | && cp -a ../busybox-1_34_1/busybox bin/busybox.static \ 13 | && chroot ./ /bin/busybox.static --install \ 14 | && ./sbin/apk.static -X $(ALPINE_REPO)/main -U --allow-untrusted -p ./ --initdb add $(MAIN_PACKAGES) \ 15 | && ./sbin/apk.static -X $(ALPINE_REPO)/community -U --allow-untrusted -p ./ add $(COMMUNITY_PACKAGES) \ 16 | && cp ../bootstrap.sh ../dlc.sh ./ \ 17 | && mkdir -p ../tools/ \ 18 | && cp -r ../tools ./ \ 19 | && cp -r ../scripts ./ 20 | chmod +x ./*.sh ./tools/* ./scripts/* 21 | 22 | package: 23 | # Copie de la config perso 24 | cp dlc.sh alpine/ 25 | chmod +x alpine/dlc.sh alpine/bootstrap.sh alpine/tools/* 26 | makeself-2.4.5/makeself.sh ./alpine DFIR_linux_collector dlc ./bootstrap.sh 27 | 28 | clean: 29 | rm -rf alpine DFIR_linux_collector output DLC_Collect* 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DFIR_Linux_Collector 2 | ![GitHub last commit](https://img.shields.io/github/last-commit/xophidia/DFIR_Linux_Collector) ![GitHub release-date](https://img.shields.io/github/release-date/xophidia/DFIR_Linux_Collector) 3 | 4 | Stand-alone collecting tools for Gnu/Linux 5 | - Very low impact on the host 6 | - No use of host binaries (anti hooking) 7 | - all binaries are included in the executable 8 | - Export in json format (log) / raw (dump ram) and Text format 9 | - Dump ram with avml (ref to compatilibilty https://github.com/microsoft/avml#tested-distributions) 10 | - The result is a compressed archive and a checksum file 11 | 12 | ## Compatibility 13 | 14 | 15 | 16 | | Distribution | Version | Ok | Error | Comments | 17 | | --- | --- | --- | --- | ---| 18 | | Ubuntu | 12 - 20 | :heavy_check_mark: | --- | --- | 19 | | Debian | > 8 | :heavy_check_mark: | --- | --- | 20 | | Fedora | 30 | :heavy_check_mark: | --- | --- | 21 | | CentOS | 7 | :heavy_check_mark: | --- | --- | 22 | | CentOS | 6 | --- | :heavy_multiplication_x: | Kernel too old | 23 | 24 | The other distributions are not yet tested, still in progress ... 25 | 26 | 27 | ## Quick start 28 | 29 | ![](dlc.gif) 30 | 31 | ``` 32 | git clone https://github.com/xophidia/DFIR_Linux_Collector.git 33 | cd DFIR_Linux_Collector 34 | ./setup.sh 35 | ``` 36 | ``` 37 | sudo ./DFIR_linux_collector 38 | Verifying archive integrity... 100% MD5 checksums are OK. All good. 39 | Uncompressing orc 100% 40 | 41 | 42 | 43 | ██████╗ ██╗ ██████╗ 44 | ██╔══██╗██║ ██╔════╝ 45 | ██║ ██║██║ ██║ 46 | ██║ ██║██║ ██║ 47 | ██████╔╝███████╗╚██████╗ 48 | ╚═════╝ ╚══════╝ ╚═════╝ 49 | 50 | DFIR Linux Collector 51 | 52 | 53 | 54 | Case Number : 10 55 | Description : linux_host 56 | Examiner Name : Xophidia 57 | Hostname : 10_01 58 | 59 | Dump generic artifacts 60 | + uname ....................[success] 61 | + env ......................[success] 62 | + uptime ...................[success] 63 | + lsmod ....................[success] 64 | + passwd ...................[success] 65 | + auth .....................[success] 66 | + syslog ...................[success] 67 | + date .....................[success] 68 | + who ......................[success] 69 | + cpuinfo ..................[success] 70 | + group ....................[success] 71 | + lsof .....................[success] 72 | + mount ....................[success] 73 | + sudoers ..................[success] 74 | 75 | 76 | Dump network artifacts 77 | + ip .......................[success] 78 | + netstat ..................[success] 79 | + arp ......................[success] 80 | 81 | 82 | Dump process artifacts 83 | + ps .......................[success] 84 | 85 | 86 | Dump user artifacts 87 | + c_ssh ....................[success] 88 | + firefox ..................[success] 89 | + c_git ....................[success] 90 | + chromium .................[success] 91 | + google-chrome ............[success] 92 | + command_history ..........[success] 93 | 94 | Dump artefacts / linux distribution 95 | + Debian-like artifacts 96 | + installer debug ..........[success] 97 | + installer syslog .........[success] 98 | 99 | ``` 100 | 101 | ### Artifacts 102 | 103 | :radio_button: Generic 104 | 105 | | Command / file | Json | Text | Raw | 106 | | --- | --- | --- | --- | 107 | | env | :heavy_check_mark: | --- | --- | 108 | |uptime| :heavy_check_mark: | --- | --- | 109 | |uname -a| :heavy_check_mark: | --- | --- | 110 | |lsmod| :heavy_check_mark: | --- | --- | 111 | |/etc/passwd| :heavy_check_mark: | --- | --- | 112 | |/etc/group| :heavy_check_mark: | --- | --- | 113 | |date| :heavy_check_mark: | --- | --- | 114 | |who |:heavy_check_mark: | --- | --- | 115 | |cpuinfo| :heavy_check_mark: | --- | --- | 116 | |lsof| --- | :heavy_check_mark: | --- | 117 | |sudoers| :heavy_check_mark: | --- | --- | 118 | |mount| :heavy_check_mark: | --- | --- | 119 | |fstab| :heavy_check_mark: | --- | --- | 120 | |last| :heavy_check_mark: | --- | --- | 121 | 122 | :radio_button: Ssh 123 | 124 | | Command / file | Json | Text | Raw | 125 | | --- | --- | --- | --- | 126 | | authorized_keys | :heavy_check_mark: | --- | --- | 127 | | known_hosts | :heavy_check_mark: | --- | --- | 128 | 129 | 130 | :radio_button: Network 131 | 132 | | Command / file | Json | Text | Raw | 133 | | --- | --- | --- | --- | 134 | | ip | :heavy_check_mark: | --- | --- | 135 | | netstat | :heavy_check_mark: | --- | --- | 136 | | arp | :heavy_check_mark: | --- | --- | 137 | 138 | :radio_button: Processus 139 | 140 | | Command / file | Json | Text | Raw | 141 | | --- | --- | --- | --- | 142 | | ps | :heavy_check_mark: | --- | --- | 143 | 144 | :radio_button: Browser 145 | 146 | | Command / file | Json | Text | Raw | 147 | | --- | --- | --- | --- | 148 | | Firefox | :heavy_check_mark: | --- | --- | 149 | | Google Chrome | :heavy_check_mark: | --- | --- | 150 | | Chromium | :heavy_check_mark: | --- | --- | 151 | 152 | :radio_button: Log 153 | 154 | | Command / file | Json | Text | Raw | 155 | | --- | --- | --- | --- | 156 | | auth.log | --- | :heavy_check_mark: | --- | 157 | | syslog| :heavy_check_mark: | --- | --- | 158 | 159 | :radio_button: Home 160 | 161 | | Command / file | Json | Text | Raw | 162 | | --- | --- | --- | --- | 163 | | .gitconfig | :heavy_check_mark: | --- | --- | 164 | | .command_history (bash + zsh) | :heavy_check_mark: | --- | :heavy_check_mark: | 165 | | .viminfo | --- | :heavy_check_mark: | --- | 166 | 167 | :radio_button: Desktop 168 | 169 | | Command / file | Json | Text | Raw | 170 | | --- | --- | --- | --- | 171 | | trash | --- | --- | :heavy_check_mark: | 172 | 173 | :radio_button: Files 174 | 175 | | Command / file | Json | Text | Raw | Csv | 176 | | --- | --- | --- | --- | --- | 177 | | hashes MD5 | :heavy_check_mark: | :heavy_check_mark: | --- | --- | 178 | | file perm | :heavy_check_mark: | --- | --- | --- | 179 | | timeline | --- | --- | --- |:heavy_check_mark:| 180 | 181 | 182 | :radio_button: Dump 183 | 184 | | Command / file | Json | Text | Raw | 185 | | --- | --- | --- | --- | 186 | | avml | --- | --- | :heavy_check_mark: | 187 | | LiME | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | 188 | | /boot/System.map-$(uname -r) | --- | --- | :heavy_check_mark: | 189 | | /boot/vmlinuz | --- | --- | :heavy_check_mark: | 190 | 191 | :radio_button: Antivirus 192 | 193 | | Command / file | Json | Text | Raw | 194 | | --- | --- | --- | --- | 195 | | ClamAV | :heavy_check_mark: | --- | --- | 196 | 197 | 198 | ## License 199 | 200 | 201 | All the code of the project is licensed under the GNU Lesser General Public License 202 | 203 | 204 | ## Contributors 205 | 206 | :godmode: xophidia https://github.com/xophidia 207 | :godmode: Dupss https://github.com/dupss 208 | :godmode: leludo84 https://github.com/leludo84 209 | 210 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!./bin/busybox.static sh 2 | 3 | export PATH=$PWD/bin:$PWD/sbin:$PWD/usr/bin:$PWD/usr/sbin 4 | export -n LD_LIBRARY_PATH 5 | export OUTPUT="output" 6 | 7 | echo "Preparing environment ..." 8 | # Changement path du linker pour les binaires liés dynamiquement (ex: python3) 9 | # https://www.it-swarm-fr.com/fr/linux/plusieurs-bibliotheques-glibc-sur-un-seul-hote/957545379/ 10 | #patcher également toutes les commandes utilisée (anti RK) 11 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /usr/bin/lsof 2>/dev/null 12 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /bin/bash 2>/dev/null 13 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /sbin/iptables 2>/dev/null 14 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /usr/bin/sudo 2>/dev/null 15 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /usr/bin/find 2>/dev/null 16 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /usr/bin/xargs 2>/dev/null 17 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /usr/bin/gawk 2>/dev/null 18 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /usr/bin/jq 2>/dev/null 19 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /usr/bin/sed 2>/dev/null 20 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /usr/bin/tput 2>/dev/null 21 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /sbin/arp 2>/dev/null 22 | chroot ./ /usr/bin/patchelf --set-interpreter $PWD/lib/ld-musl-x86_64.so.1 /bin/netstat 2>/dev/null 23 | mkdir output 24 | 25 | 26 | echo "Launching tools ..." 27 | export LD_LIBRARY_PATH=$PWD/lib:$PWD/usr/lib:$PWD/usr/lib/sudo 28 | 29 | 30 | if [ "$1" = "rescue" ]; then 31 | echo "**** Mode rescue. ****" 32 | echo "Les commandes que vous tapez sont sécurisées." 33 | bash 34 | echo "Fin mode rescue." 35 | else 36 | bash ./dlc.sh 2>&1 | tee $OUTPUT/dlc.log 37 | fi 38 | 39 | 40 | echo "" 41 | echo "Archive creation ..." 42 | 43 | tar -czvf $USER_PWD/DLC_Collect-$HOSTNAME-`date +%F`.tgz output/ 44 | 45 | echo "" 46 | echo "Making checksums ..." 47 | echo "MD5 => $(md5sum "$USER_PWD/DLC_Collect-$HOSTNAME-`date +%F`.tgz" | cut -f 1 -d " ")" >> $USER_PWD/DLC_Collect-$HOSTNAME-`date +%F`_Checksums.txt 48 | echo "SHA1 => $(sha1sum "$USER_PWD/DLC_Collect-$HOSTNAME-`date +%F`.tgz" | cut -f 1 -d " ")" >> $USER_PWD/DLC_Collect-$HOSTNAME-`date +%F`_Checksums.txt 49 | 50 | 51 | -------------------------------------------------------------------------------- /busybox-1_34_1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xophidia/DFIR_Linux_Collector/a544d6fef15940a880862ebad2120f84b3390b25/busybox-1_34_1.zip -------------------------------------------------------------------------------- /dlc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xophidia/DFIR_Linux_Collector/a544d6fef15940a880862ebad2120f84b3390b25/dlc.gif -------------------------------------------------------------------------------- /dlc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | #Todo 5 | # timedatectl 6 | # w (logged users) 7 | # faillog -a 8 | # chkconfig --list (list services) 9 | # cat /etc/pam.d/common/* 10 | 11 | # Set start date 12 | start=`date +%s` 13 | 14 | # Set collect mode methods 15 | list_method_light=(generic network process user artefactsDistribution exportRawKernelArtefacts antivirus) 16 | list_method_medium=(generic network process user artefactsDistribution exportRawKernelArtefacts antivirus interestFile) 17 | list_method_full=(generic network process user artefactsDistribution exportRawKernelArtefacts antivirus interestFile dump_ram) 18 | 19 | # OS list 20 | ver_dist=(redhat centos fedora debian lsb gentoo SuSE) 21 | 22 | # Fedora logs list 23 | log_fedora=(program.log storage.log yum.log syslog) 24 | 25 | # Custom scripts list 26 | action=(c_ssh firefox c_git chromium google-chrome command_history vim trash frequent_apps) 27 | 28 | # Set colors 29 | white=$(tput setaf 7) 30 | white_background=$(tput setab 7) 31 | black=$(tput setaf 0) 32 | blue=$(tput setaf 4) 33 | blue_background=$(tput setab 4) 34 | yellow=$(tput setaf 3) 35 | yellow_background=$(tput setab 3) 36 | green=$(tput setaf 2) 37 | green_background=$(tput setab 2) 38 | red=$(tput setaf 1) 39 | red_background=$(tput setab 1) 40 | normal=$(tput sgr0) 41 | bold=$(tput bold) 42 | 43 | function banner() 44 | { 45 | 46 | echo " 47 | 48 | 49 | 50 | ██████╗ ██╗ ██████╗ 51 | ██╔══██╗██║ ██╔════╝ 52 | ██║ ██║██║ ██║ 53 | ██║ ██║██║ ██║ 54 | ██████╔╝███████╗╚██████╗ 55 | ╚═════╝ ╚══════╝ ╚═════╝ 56 | 57 | DFIR Linux Collector 58 | 59 | 60 | " 61 | } 62 | 63 | 64 | function verif() 65 | { 66 | if [[ $1 -eq 0 ]]; then 67 | printf " ${red} + ${normal} $2 " 68 | size=$(wc -c <<< $2) 69 | val=$(( 26 - $size )) 70 | 71 | for (( i=0; i<$val; i++ )) 72 | do 73 | printf '.' 74 | done; 75 | printf "${green}[success]${normal}\n" 76 | else 77 | printf " ${red} + ${normal} $2 " 78 | size=$(wc -c <<< $2) 79 | val=$(( 26 - $size )) 80 | 81 | for (( i=0; i<$val; i++ )) 82 | do 83 | printf '.' 84 | done; 85 | printf "${red}[failed]${normal}\n" 86 | fi 87 | } 88 | 89 | 90 | 91 | function interestFile() 92 | { 93 | 94 | echo " 95 | Dump files artifacts" 96 | printf " ${yellow}-${normal} Please wait, it may take some time ...\n" 97 | 98 | 99 | #HASHS MD5 100 | 101 | outputpath="$OUTPUT/Hashes/" 102 | outfile="$outputpath/MD5_hashes.json" 103 | mkdir $outputpath 104 | find / -type f -xdev -executable -not \( -path "/proc/*" -o -path "/sys/*" \) -exec md5sum {} \; 2>/dev/null > $outputpath/MD5_hashes 105 | cat $outputpath/MD5_hashes | awk -F' ' 'BEGIN{print "{ \"MD5 Hashes\" : ["} {print "{\"hash\": \"",$1,"\", \"file\": \"",$2,"\"},"}' >> $outfile 106 | tmp=$(sed '$ s/.$//' $outfile) 107 | #Remove spaces 108 | tmp_final=$(echo $tmp| sed 's/\ //g') 109 | echo "$tmp_final],\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $outfile 110 | verif $? "MD5 Hashes (executable files)" 111 | 112 | #Files with interesting rights 113 | 114 | outfile=$OUTPUT/interest_files.json 115 | echo "{\"interest_files\": {" >> $outfile 116 | action=('-o=s' '-u=s' '-g=s') 117 | for act in ${action[@]} 118 | do 119 | echo "\"File ${act}\":[ ">> $outfile 120 | tmp=$(find / -xdev -path /proc -prune -o -type f -perm ${act} -exec echo "{\"Path\": \"{}\"}," \; 2>/dev/null | sed 's/\\/\\\\/g') 121 | echo $tmp | sed '$ s/.$//' >> $outfile 122 | echo "]," >> $outfile 123 | done 124 | 125 | finaltmp=$(sed '$ s/.$//' $outfile) 126 | echo "$finaltmp, \"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}}" > $outfile 127 | verif $? "interestFile" 128 | 129 | #TIMELINE 130 | 131 | outfile="$OUTPUT/timeline.csv" 132 | printf "Access Date,Access Time,Modify Date,Modify Time,Create Date,Create Time,Permissions,User ID,Group ID,File Size,Filename\n" >> $outfile 133 | find / -xdev -printf "%Ax,%AT,%Tx,%TT,%Cx,%CT,%m,%U,%G,%s,%p\n" 2>>/dev/null >> $outfile 134 | if [[ ! -z "$outfile" ]]; then 135 | verif "0" "timeline" 136 | else 137 | verif $? "timeline" 138 | fi 139 | } 140 | 141 | function exportRawKernelArtefacts() 142 | { 143 | 144 | echo " 145 | Dump kernel artifacts" 146 | 147 | test -f /boot/vmlinuz-$(uname -r) 148 | 149 | if [[ $? -eq 0 ]]; then 150 | cp /boot/vmlinuz-$(uname -r) $OUTPUT/vmlinuz-$(uname -r) 151 | verif $? "vmlinuz" 152 | fi 153 | 154 | test -f /boot/System.map-$(uname -r) 155 | 156 | if [[ $? -eq 0 ]]; then 157 | cp /boot/System.map-$(uname -r) $OUTPUT/System.map-$(uname -r) 158 | verif $? "System.map" 159 | fi 160 | 161 | 162 | } 163 | 164 | 165 | function artefactsDistribution() 166 | { 167 | 168 | echo " 169 | Dump artifacts / linux distribution" 170 | 171 | for distr in ${ver_dist[@]} 172 | do 173 | test -f /etc/$distr-release 174 | if [[ $? -eq 0 ]]; then 175 | export distri_id=$distr 176 | fi 177 | done 178 | 179 | 180 | case $distri_id in 181 | 182 | "lsb" | "debian") 183 | printf " ${red} + ${normal} Debian-like artifacts \n" 184 | test -f /var/log/installer/debug 185 | if [[ $? -eq 0 ]]; then 186 | more /var/log/installer/debug > $OUTPUT/$distri_id"installer_debug.txt" 187 | verif $? "installer debug" 188 | fi 189 | test -f /var/log/installer/syslog 190 | if [[ $? -eq 0 ]]; then 191 | more /var/log/installer/syslog > $OUTPUT/$distri_id"installer_syslog.txt" 192 | verif $? "installer syslog" 193 | fi 194 | test -f /var/log/auth.log 195 | if [[ $? -eq 0 ]]; then 196 | more /var/log/auth.log > $OUTPUT/gen_auth 197 | verif $? "auth" 198 | fi 199 | 200 | more /var/log/syslog | sed 's/\\/\\\\/g' | sed s/"\""/"'"/g | sed s/"\t"//g | awk 'BEGIN{print "{ \"syslog\" : ["} {print "{\"data\": \"",$0,"\"},"} END{print "]}"} ENDFILE{print "{\"data\": \"",$0,"\"}"}'| jq 'del(.auth[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_syslog.json 201 | verif $? "syslog" 202 | ;; 203 | 204 | "redhat" | "fedora" | "centos" ) 205 | printf " ${red} + ${normal} RedHat-like artifacts \n" 206 | for el in ${log_fedora[@]} 207 | do 208 | test -f /var/log/anaconda/$el 209 | if [[ $? -eq 0 ]]; then 210 | more /var/log/anaconda/$el > $OUTPUT/fedora_installer_anaconda.$el 211 | 212 | fi 213 | done 214 | ;; 215 | 216 | "gentoo") 217 | echo "gentoo" 218 | ;; 219 | 220 | "SuSE") 221 | printf " ${red} + ${normal} Suse-like artifacts \n" 222 | ;; 223 | 224 | *) 225 | ;; 226 | esac 227 | 228 | } 229 | 230 | 231 | 232 | function generic() 233 | { 234 | 235 | echo " 236 | Dump generic artifacts" 237 | jq --raw-input '{"uname": '.'}' < <(uname -a) | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_uname.json 238 | verif $? "uname" 239 | 240 | env | awk -F= 'BEGIN{print "{ \"env\" : ["} {print "{\"envars\": \"",$1,"\", \"data\": \"",$2,"\"},"} END{print "]}"} ENDFILE{print " {\"envars\": \"",$1,"\", \"data\": \"",$2,"\"}"}' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_env.json 241 | verif $? "env" 242 | 243 | jq --raw-input '{"uptime": '.'}' < <(uptime) | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_uptime.json 244 | verif $? "uptime" 245 | 246 | lsmod | awk 'BEGIN{print "{ \"lsmod\" : ["} {print " {\"Module\": \"",$1,"\", \"Size\": \"",$2,"\", \"UsedBy\": \"",$3,"\", \"NotTainted\": \"",$4,"\"},"} END{print "]}"} ENDFILE{print " {\"Module\": \"",$1,"\", \"Size\": \"",$2,"\", \"UsedBy\": \"",$3,"\", \"NotTainted\": \"",$4,"\"}"}' | jq 'del(.env[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_lsmod.json 247 | verif $? "lsmod" 248 | 249 | more /etc/passwd | awk -F: 'BEGIN{print "{ \"pwd\" : ["} {print " {\"user\": \"",$1,"\", \"user_group\": \"",$3,$4,"\",\"Home\": \"",$6,"\",\"shell\": \"",$7"\"},"} END{print "]}"} ENDFILE{print " {\"user\": \"",$1,"\", \"user_group\": \"",$3,$4,"\",\"Home\": \"",$6,"\",\"shell\": \"",$7"\"}"}' | jq 'del(.pwd[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_passwd.json 250 | verif $? "passwd" 251 | 252 | jq --raw-input '{"date": '.'}' < <(date) | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' >$OUTPUT/gen_date.json 253 | verif $? "date" 254 | 255 | jq --raw-input '{"who": '.'}' < <(who) | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' >$OUTPUT/gen_who.json 256 | verif $? "who" 257 | 258 | more /proc/cpuinfo | awk -F':' 'BEGIN{print "{ \"cpuinfo\" : ["} gsub(/[[:blank:]]/,"",$1) gsub(/[[:blank:]]/,"",$2) {print "{\"id\": \""$1"\", \"data\": \""$2"\"},"} END{print "]}"} ENDFILE{print "{\"id\": \"",$1,"\", \"data\": \"",$2,"\"}"}' | jq 'del(.cpuinfo[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' >$OUTPUT/gen_cpuinfo.json 259 | verif $? "cpuinfo" 260 | 261 | more /etc/group | awk -F':' 'BEGIN{print "{ \"group\" : ["} {print "{\"user\": \"",$1,"\", \"group\": \"",$3,"\"},"} END{print "]}"} ENDFILE {print "{\"user\": \"",$1,"\", \"group\": \"",$3,"\"}"}' | jq 'del(.group[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' >$OUTPUT/gen_group.json 262 | verif $? "group" 263 | 264 | lsof > $OUTPUT/gen_lsof 2>/dev/null 265 | verif $? "lsof" 266 | 267 | mount 2>/dev/null | awk 'BEGIN{print "{ \"mount\" : ["} {print "{\"device\": \""$1"\", \"mountpoint\": \""$3"\", \"type\": \""$5"\", \"attributes\": \""$6"\"},"} END{print "]}"} ENDFILE {print "{\"device\": \"",$1,"\", \"mountpoint\": \"",$3,"\", \"type\": \"",$5,"\", \"attributes\": \"",$6,"\"}"}' | jq 'del(.mount[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_mount.json 268 | verif $? "mount" 269 | 270 | more /etc/sudoers | grep -v '#\|Defaults' | awk 'NF' | awk '$1=$1' |awk -F= 'BEGIN{print "{ \"sudoers\" : ["} {print "{\"user\": \""$1"\", \"data\": \""$2"\"},"} END{print "]}"} ENDFILE{print "{\"user\": \""$1"\", \"data\": \""$2"\"}"}' | jq 'del(.sudoers[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_sudoers.json 271 | verif $? "sudoers" 272 | 273 | more /etc/fstab | grep -v '#\|Defaults' | awk 'NF' | awk '$1=$1' |awk -F: 'BEGIN{print "{ \"fstab\" : ["} {print "{\"line\": \""$1"\"},"} END{print "]}"} ENDFILE{print "{\"line\": \""$1"\"}"}' | jq 'del(.fstab[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/gen_fstab.json 274 | verif $? "fstab" 275 | 276 | 277 | #Last 278 | outfile="$OUTPUT/gen_last.json" 279 | echo "{ \"last\": [" >> $outfile 280 | last | while read line 281 | do 282 | if [ ! -z "$line" ]; then 283 | echo \"${line}\",>> $outfile 284 | fi 285 | done 286 | tmp_last=$(sed '$ s/.$//' $outfile) 287 | echo "$tmp_last],\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $outfile 288 | verif $? "last" 289 | 290 | } 291 | 292 | function antivirus() 293 | { 294 | test -f /var/log/syslog 295 | if [[ $? -eq 0 ]]; then 296 | echo " 297 | 298 | Dump antivirus artifacts" 299 | 300 | # CLamAV 301 | clamav_version=$(cat /var/log/syslog | grep freshclam | grep "Local version" | awk -F: '{print $7}' | cut -d " " -f2 | tail -1) 302 | update_date=$(cat /var/log/syslog | grep freshclam | grep "daily.cld" | tail -1 | cut -d " " -f1-3) 303 | sign=$(cat /var/log/syslog | grep freshclam | grep "daily.cld" | tail -1 | cut -d "(" -f2 | cut -d "," -f1 | cut -d " " -f2) 304 | 305 | echo "{ \"ClamAV\" : { \"Version\": \"$clamav_version\",\"Update date\": \"$update_date\",\"Signature\": \"$sign\"}}" | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/av.json 306 | verif $? "ClamAV" 307 | fi 308 | } 309 | 310 | 311 | function network() 312 | { 313 | echo " 314 | 315 | Dump network artifacts" 316 | 317 | jq --raw-input '{"ip_info": [inputs | capture("^[0-9]+: (?[^[:space:]]+)[[:space:]]+inet (?[^[:space:]/]+)(/(?[[:digit:]]+))?")]}' < <(ip -o addr list) | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/network_ip.json 318 | verif $? "ip" 319 | 320 | netstat -r -n | sed -e '1,2d' | awk 'BEGIN{print "{ \"netstat\": ["} {print " {\"Destination\": \"",$1,"\", \"Gateway\": \"",$2,"\", \"Genmask\": \"",$3,"\", \"Iface\": \"",$8,"\"},"} END{print "]}"} ENDFILE{print " {\"Destination\": \"",$1,"\", \"Gateway\": \"",$2,"\", \"Genmask\": \"",$8,"\", \"Iface\": \"",$4,"\"}"}' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' | jq 'del(.netstat[-1:])' > $OUTPUT/network_netstat.json 321 | verif $? "netstat" 322 | 323 | 324 | arp |sed -e '1d'| awk 'BEGIN{print "{ \"arp\" : ["} {print " {\"Address\": \"",$1,"\", \"HWType\": \"",$2,"\", \"HWaddress\": \"",$3,"\", \"Flags\": \"",$4,"\", \"Iface\": \"",$5,"\"},"} END{print "]}"} ENDFILE{print " {\"Address\": \"",$1,"\", \"HWType\": \"",$2,"\", \"HWaddress\": \"",$3,"\", \"Flags\": \"",$4,"\", \"Iface\": \"",$5,"\"}"}' | jq 'del(.arp[-1:])' |jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/network_arp.json 325 | verif $? "arp" 326 | 327 | } 328 | 329 | 330 | function process() 331 | { 332 | echo " 333 | 334 | Dump process artifacts" 335 | ps -o user,group,pid,ppid,stat,args | awk 'BEGIN{print "{ \"ps\" : ["} {print " {\"USER\": \"",$1,"\", \"GROUP\": \"",$2,"\", \"PID\": \"",$3,"\", \"PPID\": \"",$4,"\", \"STAT\": \"",$5,"\", \"CMD\": \"",$6,"\"},"} END{print "]}"} ENDFILE {print " {\"USER\": \"",$1,"\", \"GROUP\": \"",$2,"\", \"PID\": \"",$3,"\", \"PPID\": \"",$4,"\", \"STAT\": \"",$5,"\", \"CMD\": \"",$6,"\"}"}' | jq 'del(.ps[-1:])' | jq --arg l_user "$user" --arg l_host "$host" --arg l_caseNumber "$caseNumber" --arg l_desc "$desc" '. + {metadata: { "Case Number": ($l_caseNumber), "Description" : ($l_desc), "Username": ($l_user), "Hostname": ($l_host) } }' > $OUTPUT/processus_ps.json 336 | verif $? "ps" 337 | } 338 | 339 | 340 | function user() 341 | { 342 | echo " 343 | 344 | Dump user artifacts" 345 | for act in ${action[@]} 346 | do 347 | bash ./scripts/$act.sh 2>/dev/null 348 | verif $? $act 349 | done 350 | } 351 | 352 | 353 | 354 | function dump_ram() 355 | { 356 | echo " 357 | 358 | Dump RAM" 359 | ./tools/avml-minimal $OUTPUT/memory_dump.raw 360 | verif $? "RAM" 361 | } 362 | 363 | 364 | function collect() 365 | { 366 | local -n list_method=$1 367 | 368 | for method in ${list_method[@]} 369 | do 370 | $method 371 | done 372 | } 373 | 374 | banner 375 | 376 | read -p " Case Number : " caseNumber 377 | while [ -z "$caseNumber" ] 378 | do 379 | echo "${red}You must enter a case number${normal}" 380 | read -p " Case Number : " caseNumber 381 | done 382 | 383 | read -p " Description : " desc 384 | while [ -z "$desc" ] 385 | do 386 | echo "${red}You must enter a description${normal}" 387 | read -p " Description : " desc 388 | done 389 | 390 | 391 | read -p " Examiner Name : " user 392 | while [ -z "$user" ] 393 | do 394 | echo "${red}You must enter an Examiner Name${normal}" 395 | read -p " Examiner Name : " user 396 | done 397 | 398 | 399 | read -p " Hostname : " host 400 | while [ -z "$host" ] 401 | do 402 | echo "${red}You must enter a HostName${normal}" 403 | read -p " Hostname : " host 404 | done 405 | 406 | # pour les scripts externes 407 | 408 | export user="$user" 409 | export host="$host" 410 | export desc="$desc" 411 | export caseNumber="$caseNumber" 412 | 413 | echo "" 414 | echo "${white_background}${black}===========================" 415 | echo "Please select collect mode:" 416 | echo "===========================" 417 | PS3="Choose an option [1-4]:${normal} " 418 | options=("Light" "Medium (Light mode + File Artifacts)" "Full (Medium mode + Memory Dump)" "Quit") 419 | select opt in "${options[@]}" 420 | do 421 | case $opt in 422 | "Light") 423 | echo "" 424 | echo "${blue_background}${bold}>>>>>>>> Light mode selected <<<<<<<<${normal}" 425 | echo "" 426 | collect list_method_light 427 | break 428 | ;; 429 | "Medium (Light mode + File Artifacts)") 430 | echo "" 431 | echo "${yellow_background}${bold}>>>>>>>> Medium mode selected <<<<<<<<${normal}" 432 | echo "" 433 | collect list_method_medium 434 | break 435 | ;; 436 | "Full (Medium mode + Memory Dump)") 437 | echo "" 438 | echo "${red_background}${bold}>>>>>>>> Full mode selected <<<<<<<<${normal}" 439 | echo "" 440 | collect list_method_full 441 | break 442 | ;; 443 | "Quit") 444 | echo "${red}Bye!${normal}" 445 | exit 0 446 | ;; 447 | *) echo "${red_background}Invalid option, please retry! $REPLY${normal}";; 448 | esac 449 | done 450 | 451 | 452 | # Set end time 453 | end=`date +%s` 454 | runtime=$((end-start)) 455 | 456 | 457 | echo "" 458 | echo "#################################" 459 | echo "${green}Collect completed in $((runtime / 60))min $((runtime % 60))sec${normal}" 460 | echo "#################################" 461 | echo "" 462 | 463 | -------------------------------------------------------------------------------- /makeself-2.4.5/COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /makeself-2.4.5/README.md: -------------------------------------------------------------------------------- 1 | [![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) 2 | ![Build Status](https://github.com/megastep/makeself/workflows/CI/badge.svg) 3 | 4 | # makeself - Make self-extractable archives on Unix 5 | 6 | [makeself.sh][1] is a small shell script that generates a self-extractable 7 | compressed tar archive from a directory. The resulting file appears as a shell script 8 | (many of those have a **.run** suffix), and can be launched as is. The archive 9 | will then uncompress itself to a temporary directory and an optional arbitrary 10 | command will be executed (for example an installation script). This is pretty 11 | similar to archives generated with WinZip Self-Extractor in the Windows world. 12 | Makeself archives also include checksums for integrity self-validation (CRC 13 | and/or MD5/SHA256 checksums). 14 | 15 | The makeself.sh script itself is used only to create the archives from a 16 | directory of files. The resultant archive is actually a compressed (using 17 | gzip, bzip2, or compress) TAR archive, with a small shell script stub at the 18 | beginning. This small stub performs all the steps of extracting the files, 19 | running the embedded command, and removing the temporary files when done. 20 | All the user has to do to install the software contained in such an 21 | archive is to "run" the archive, i.e **sh nice-software.run**. I recommend 22 | using the ".run" (which was introduced by some Makeself archives released by 23 | Loki Software) or ".sh" suffix for such archives not to confuse the users, 24 | so that they will know they are actually shell scripts (with quite a lot of binary data 25 | attached to them though!). 26 | 27 | I am trying to keep the code of this script as portable as possible, i.e it is 28 | not relying on any bash-specific features and only calls commands that are 29 | installed on any functioning UNIX-compatible system. This script as well as 30 | the archives it generates should run on any Unix flavor, with any compatible 31 | Bourne shell, provided of course that the compression programs are available. 32 | 33 | As of version 2.1, Makeself has been rewritten and tested on the following 34 | platforms : 35 | 36 | * Linux (all distributions) 37 | * Sun Solaris (8 and above) 38 | * HP-UX (tested on 11.0 and 11i on HPPA RISC) 39 | * SCO OpenUnix and OpenServer 40 | * IBM AIX 5.1L 41 | * macOS (Darwin) 42 | * SGI IRIX 6.5 43 | * FreeBSD 44 | * UnicOS / Cray 45 | * Cygwin (Windows) 46 | 47 | If you successfully run Makeself and/or archives created with it on another 48 | system, then please [let me know][2]! 49 | 50 | Examples of publicly available archives made using makeself are : 51 | 52 | * Game patches and installers for [Id Software][3] games like Quake 3 for Linux or Return To Castle Wolfenstein ; 53 | * All game patches released by [Loki Software][4] for the Linux version of popular games ; 54 | * The [nVidia drivers][5] for Linux 55 | * The installer for the Linux version of [Google Earth][6] 56 | * The [VirtualBox][7] installers for Linux 57 | * The [Makeself][1] distribution itself ;-) 58 | * and countless others... 59 | 60 | **Important note for Apache users:** By default, most Web servers will think that Makeself archives are regular text files and thus they may show up as text in a Web browser. The correct way to prevent this is to add a MIME type for this file format, like so (in httpd.conf) : 61 | 62 | `AddType application/x-makeself .run` 63 | 64 | **Important note for certain GNU/Linux distributions:** Archives created with Makeself prior to v2.1.2 were using an old syntax for the _head_ and _tail_ Unix commands that is being progressively obsoleted in their GNU forms. Therefore you may have problems uncompressing some of these archives. A workaround for this is to set the environment variable $_POSIX2_VERSION to enable the old syntax, i.e. : 65 | 66 | `export _POSIX2_VERSION=199209` 67 | 68 | ## Usage 69 | 70 | The syntax of makeself is the following: 71 | 72 | ``` 73 | makeself.sh [args] archive_dir file_name label startup_script [script_args] 74 | ``` 75 | 76 | * _args_ are optional options for Makeself. The available ones are : 77 | 78 | * **`--version`** : Prints the version number on stdout, then exits immediately 79 | * **`--gzip`** : Use gzip for compression (the default on platforms on which gzip is commonly available, like Linux) 80 | * **`--bzip2`** : Use bzip2 instead of gzip for better compression. The bzip2 command must be available in the command path. It is recommended that the archive prefix be set to something like '.bz2.run', so that potential users know that they'll need bzip2 to extract it. 81 | * **`--pbzip2`** : Use pbzip2 instead of gzip for better and faster compression on machines having multiple CPUs. The pbzip2 command must be available in the command path. It is recommended that the archive prefix be set to something like '.bz2.run', so that potential users know that they'll need bzip2 to extract it. 82 | * **`--xz`** : Use xz instead of gzip for better compression. The xz command must be available in the command path. It is recommended that the archive prefix be set to something like '.xz.run' for the archive, so that potential users know that they'll need xz to extract it. 83 | * **`--lzo`** : Use lzop instead of gzip for better compression. The lzop command must be available in the command path. It is recommended that the archive prefix be set to something like `.lzo.run` for the archive, so that potential users know that they'll need lzop to extract it. 84 | * **`--lz4`** : Use lz4 instead of gzip for better compression. The lz4 command must be available in the command path. It is recommended that the archive prefix be set to something like '.lz4.run' for the archive, so that potential users know that they'll need lz4 to extract it. 85 | * **`--zstd`** : Use zstd instead of gzip for better compression. The zstd command must be available in the command path. It is recommended that the archive prefix be set to something like '.zstd.run' for the archive, so that potential users know that they'll need zstd to extract it. 86 | * **`--pigz`** : Use pigz for compression. 87 | * **`--base64`** : Encode the archive to ASCII in Base64 format instead of compressing (base64 command required). 88 | * **`--gpg-encrypt`** : Encrypt the archive using `gpg -ac -z $COMPRESS_LEVEL`. This will prompt for a password to encrypt with. Assumes that potential users have `gpg` installed. 89 | * **`--ssl-encrypt`** : Encrypt the archive using `openssl aes-256-cbc -a -salt`. This will prompt for a password to encrypt with. Assumes that the potential users have the OpenSSL tools installed. 90 | * **`--compress`** : Use the UNIX `compress` command to compress the data. This should be the default on all platforms that don't have gzip available. 91 | * **`--nocomp`** : Do not use any compression for the archive, which will then be an uncompressed TAR. 92 | * **`--complevel`** : Specify the compression level for gzip, bzip2, pbzip2, zstd, xz, lzo or lz4. (defaults to 9) 93 | * **`--threads`** : Specify the number of threads to be used by compressors that support parallelization. Omit to use compressor's default. Most useful (and required) for opting into xz's threading, usually with `--threads=0` for all available cores. pbzip2 and pigz are parallel by default, and setting this value allows limiting the number of threads they use. 94 | * **`--notemp`** : The generated archive will not extract the files to a temporary directory, but in a new directory created in the current directory. This is better to distribute software packages that may extract and compile by themselves (i.e. launch the compilation through the embedded script). 95 | * **`--current`** : Files will be extracted to the current directory, instead of in a subdirectory. This option implies `--notemp` above. 96 | * **`--follow`** : Follow the symbolic links inside of the archive directory, i.e. store the files that are being pointed to instead of the links themselves. 97 | * **`--append`** _(new in 2.1.x)_: Append data to an existing archive, instead of creating a new one. In this mode, the settings from the original archive are reused (compression type, label, embedded script), and thus don't need to be specified again on the command line. 98 | * **`--header`** : Makeself uses a separate file to store the header stub, called `makeself-header.sh`. By default, it is assumed that it is stored in the same location as makeself.sh. This option can be used to specify its actual location if it is stored someplace else. 99 | * **`--cleanup`** : Specify a script that is run when execution is interrupted or finishes successfully. The script is executed with the same environment and initial `script_args` as `startup_script`. 100 | * **`--copy`** : Upon extraction, the archive will first extract itself to a temporary directory. The main application of this is to allow self-contained installers stored in a Makeself archive on a CD, when the installer program will later need to unmount the CD and allow a new one to be inserted. This prevents "Filesystem busy" errors for installers that span multiple CDs. 101 | * **`--nox11`** : Disable the automatic spawning of a new terminal in X11. 102 | * **`--nowait`** : When executed from a new X11 terminal, disable the user prompt at the end of the script execution. 103 | * **`--nomd5`** and **`--nocrc`** : Disable the creation of a MD5 / CRC checksum for the archive. This speeds up the extraction process if integrity checking is not necessary. 104 | * **`--sha256`** : Adds a SHA256 checksum for the archive. This is in addition to the MD5 / CRC checksums unless `--nomd5` is also used. 105 | * **`--lsm` _file_** : Provide and LSM file to makeself, that will be embedded in the generated archive. LSM files are describing a software package in a way that is easily parseable. The LSM entry can then be later retrieved using the `--lsm` argument to the archive. An example of a LSM file is provided with Makeself. 106 | * **`--tar-format opt`** : Specify the tar archive format (default is ustar); you may use any value accepted by your tar command (such as posix, v7, etc). 107 | * **`--tar-extra opt`** : Append more options to the tar command line. 108 | 109 | For instance, in order to exclude the `.git` directory from the packaged archive directory using the GNU `tar`, one can use `makeself.sh --tar-extra "--exclude=.git" ...` 110 | 111 | * **`--keep-umask`** : Keep the umask set to shell default, rather than overriding when executing self-extracting archive. 112 | * **`--packaging-date date`** : Use provided string as the packaging date instead of the current date. 113 | * **`--license`** : Append a license file. 114 | * **`--nooverwrite`** : Do not extract the archive if the specified target directory already exists. 115 | * **`--help-header file`** : Add a header to the archive's `--help` output. 116 | * `archive_dir` is the name of the directory that contains the files to be archived 117 | * `file_name` is the name of the archive to be created 118 | * `label` is an arbitrary text string describing the package. It will be displayed while extracting the files. 119 | * `startup_script` is the command to be executed _from within_ the directory of extracted files. Thus, if you wish to execute a program contained in this directory, you must prefix your command with `./`. For example, `./program` will be fine. The `script_args` are additional arguments for this command. 120 | 121 | Here is an example, assuming the user has a package image stored in a **/home/joe/mysoft**, and he wants to generate a self-extracting package named 122 | **mysoft.sh**, which will launch the "setup" script initially stored in /home/joe/mysoft : 123 | 124 | `makeself.sh /home/joe/mysoft mysoft.sh "Joe's Nice Software Package" ./setup 125 | ` 126 | 127 | Here is also how I created the [makeself.run][9] archive which contains the Makeself distribution : 128 | 129 | `makeself.sh --notemp makeself makeself.run "Makeself by Stephane Peter" echo "Makeself has extracted itself" ` 130 | 131 | Archives generated with Makeself can be passed the following arguments: 132 | 133 | * **`--keep`** : Prevent the files to be extracted in a temporary directory that will be removed after the embedded script's execution. The files will then be extracted in the current working directory and will stay here until you remove them. 134 | * **`--verbose`** : Will prompt the user before executing the embedded command 135 | * **`--target dir`** : Allows to extract the archive in an arbitrary place. 136 | * **`--nox11`** : Do not spawn a X11 terminal. 137 | * **`--confirm`** : Prompt the user for confirmation before running the embedded command. 138 | * **`--info`** : Print out general information about the archive (does not extract). 139 | * **`--lsm`** : Print out the LSM entry, if it is present. 140 | * **`--list`** : List the files in the archive. 141 | * **`--check`** : Check the archive for integrity using the embedded checksums. Does not extract the archive. 142 | * **`--nochown`** : By default, a `chown -R` command is run on the target directory after extraction, so that all files belong to the current user. This is mostly needed if you are running as root, as tar will then try to recreate the initial user ownerships. You may disable this behavior with this flag. 143 | * **`--tar`** : Run the tar command on the contents of the archive, using the following arguments as parameter for the command. 144 | * **`--noexec`** : Do not run the embedded script after extraction. 145 | * **`--noexec-cleanup`** : Do not run the embedded cleanup script. 146 | * **`--nodiskspace`** : Do not check for available disk space before attempting to extract. 147 | * **`--cleanup-args`** : Specify arguments to be passed to the cleanup script. Wrap value in quotes to specify multiple arguments. 148 | 149 | Any subsequent arguments to the archive will be passed as additional arguments to the embedded command. You must explicitly use the `--` special command-line construct before any such options to make sure that Makeself will not try to interpret them. 150 | 151 | ## Startup Script 152 | 153 | The startup script must be a regular Shell script. 154 | 155 | Within the startup script, you can use the `$USER_PWD` variable to get the path of the folder from which the self-extracting script is executed. This is especially useful to access files that are located in the same folder as the script, as shown in the example below. 156 | 157 | `my-self-extracting-script.sh --fooBarFileParameter foo.bar` 158 | 159 | ## Building and Testing 160 | 161 | Clone the git repo and execute `git submodule update --init --recursive` to obtain all submodules. 162 | 163 | * To make a release: `make` 164 | * To run all tests: `make test` 165 | 166 | ## Maven Usage 167 | 168 | Makeself is now supported by the following maven plugin [makeself-maven-plugin](https://github.com/hazendaz/makeself-maven-plugin). Please refer to project for usage and report any bugs in regards to maven plugin on that project. 169 | 170 | ## License 171 | 172 | Makeself itself is covered by the [GNU General Public License][8] (GPL) version 2 and above. Archives generated by Makeself don't have to be placed under this license (although I encourage it ;-)), since the archive itself is merely data for Makeself. 173 | 174 | ## Contributing 175 | 176 | I will gladly consider merging your pull requests on the [GitHub][10] repository. However, please keep the following in mind: 177 | 178 | * One of the main purposes of Makeself is portability. Do not submit patches that will break supported platforms. The more platform-agnostic, the better. 179 | * Please explain clearly what the purpose of the patch is, and how you achieved it. 180 | 181 | ## Download 182 | 183 | Get the latest official distribution [here][9] (version 2.4.2). 184 | 185 | The latest development version can be grabbed from [GitHub][10]. Feel free to submit any patches there through the fork and pull request process. 186 | 187 | ## Version history 188 | 189 | * **v1.0:** Initial public release 190 | * **v1.1:** The archive can be passed parameters that will be passed on to the embedded script, thanks to John C. Quillan 191 | * **v1.2:** Cosmetic updates, support for bzip2 compression and non-temporary archives. Many ideas thanks to Francois Petitjean. 192 | * **v1.3:** More patches from Bjarni R. Einarsson and Francois Petitjean: Support for no compression (`--nocomp`), script is no longer mandatory, automatic launch in an xterm, optional verbose output, and -target archive option to indicate where to extract the files. 193 | * **v1.4:** Many patches from Francois Petitjean: improved UNIX compatibility, automatic integrity checking, support of LSM files to get info on the package at run time.. 194 | * **v1.5.x:** A lot of bugfixes, and many other patches, including automatic verification through the usage of checksums. Version 1.5.5 was the stable release for a long time, even though the Web page didn't get updated ;-). Makeself was also officially made a part of the [Loki Setup installer][11], and its source is being maintained as part of this package. 195 | * **v2.0:** Complete internal rewrite of Makeself. The command-line parsing was vastly improved, the overall maintenance of the package was greatly improved by separating the stub from makeself.sh. Also Makeself was ported and tested to a variety of Unix platforms. 196 | * **v2.0.1:** First public release of the new 2.0 branch. Prior versions are officially obsoleted. This release introduced the `--copy` argument that was introduced in response to a need for the [UT2K3][12] Linux installer. 197 | * **v2.1.0:** Big change : Makeself can now support multiple embedded tarballs, each stored separately with their own checksums. An existing archive can be updated with the `--append` flag. Checksums are also better managed, and the `--nochown` option for archives appeared. 198 | * **v2.1.1:** Fixes related to the Unix compression (compress command). Some Linux distributions made the insane choice to make it unavailable, even though gzip is capable of uncompressing these files, plus some more bugfixes in the extraction and checksum code. 199 | * **v2.1.2:** Some bug fixes. Use head -n to avoid problems with POSIX conformance. 200 | * **v2.1.3:** Bug fixes with the command line when spawning terminals. Added `--tar`, `--noexec` for archives. Added `--nomd5` and `--nocrc` to avoid creating checksums in archives. The embedded script is now run through "eval". The `--info` output now includes the command used to create the archive. A man page was contributed by Bartosz Fenski. 201 | * **v2.1.4:** Fixed `--info` output. Generate random directory name when extracting files to . to avoid problems. Better handling of errors with wrong permissions for the directory containing the files. Avoid some race conditions, Unset the $CDPATH variable to avoid problems if it is set. Better handling of dot files in the archive directory. 202 | * **v2.1.5:** Made the md5sum detection consistent with the header code. Check for the presence of the archive directory. Added `--encrypt` for symmetric encryption through gpg (Eric Windisch). Added support for the digest command on Solaris 10 for MD5 checksums. Check for available disk space before extracting to the target directory (Andreas Schweitzer). Allow extraction to run asynchronously (patch by Peter Hatch). Use file descriptors internally to avoid error messages (patch by Kay Tiong Khoo). 203 | * **v2.1.6:** Replaced one dot per file progress with a realtime progress percentage and a spinning cursor. Added `--noprogress` to prevent showing the progress during the decompression. Added `--target` dir to allow extracting directly to a target directory. (Guy Baconniere) 204 | * **v2.2.0:** First major new release in years! Includes many bugfixes and user contributions. Please look at the [project page on Github][10] for all the details. 205 | * **v2.3.0:** Support for archive encryption via GPG or OpenSSL. Added LZO and LZ4 compression support. Options to set the packaging date and stop the umask from being overriden. Optionally ignore check for available disk space when extracting. New option to check for root permissions before extracting. 206 | * **v2.3.1:** Various compatibility updates. Added unit tests for Travis CI in the GitHub repo. New `--tar-extra`, `--untar-extra`, `--gpg-extra`, `--gpg-asymmetric-encrypt-sign` options. 207 | * **v2.4.0:** Added optional support for SHA256 archive integrity checksums. 208 | * **v2.4.2:** New --cleanup and --cleanup-args arguments for cleanup scripts. Added threading support for supported compressors. Now supports zstd compression. 209 | * **v2.4.3:** Make explicit POSIX tar archives for increased compatibility. 210 | * **v2.4.4:** Fixed various compatibility issues (no longer use POSIX tar archives), Github Actions to check on Solaris and FreeBSD. 211 | * **v2.4.5:** Added `--tar-format` option to set the tar archive format (default is ustar) 212 | 213 | ## Links 214 | 215 | * Check out the ["Loki Setup"][11] installer, used to install many Linux games and other applications, and of which I am the co-author. Since the demise of Loki, I am now the official maintainer of the project, and it is now being hosted here on GitHub. 216 | * Bjarni R. Einarsson also wrote the **setup.sh** installer script, inspired by Makeself. [Check it out !][14] 217 | 218 | ## Contact 219 | 220 | This script was written by [Stéphane Peter][15] (megastep at megastep.org). Any enhancements and suggestions are welcome. 221 | 222 | Contributions were included from John C. Quillan, Bjarni R. Einarsson, 223 | Francois Petitjean, Ryan C. Gordon, and many contributors on GitHub. If you think I forgot 224 | your name, don't hesitate to contact me. 225 | 226 | This project is now hosted on GitHub. Feel free to submit patches and bug reports on the [project page][10]. 227 | 228 | * * * 229 | 230 | [Stephane Peter][2] 231 | 232 | [1]: http://makeself.io/ 233 | [2]: mailto:megastep@megastep.org 234 | [3]: http://www.idsoftware.com/ 235 | [4]: http://www.lokigames.com/products/myth2/updates.php3 236 | [5]: http://www.nvidia.com/ 237 | [6]: http://earth.google.com/ 238 | [7]: http://www.virtualbox.org/ 239 | [8]: http://www.gnu.org/copyleft/gpl.html 240 | [9]: https://github.com/megastep/makeself/releases/download/release-2.4.5/makeself-2.4.5.run 241 | [10]: https://github.com/megastep/makeself 242 | [11]: https://github.com/megastep/loki_setup/ 243 | [12]: http://www.unrealtournament2003.com/ 244 | [13]: http://www.icculus.org/ 245 | [14]: http://bre.klaki.net/programs/setup.sh/ 246 | [15]: https://stephanepeter.com/ 247 | -------------------------------------------------------------------------------- /makeself-2.4.5/VERSION: -------------------------------------------------------------------------------- 1 | 2.4.5 2 | -------------------------------------------------------------------------------- /makeself-2.4.5/makeself-header.sh: -------------------------------------------------------------------------------- 1 | cat << EOF > "$archname" 2 | #!/bin/sh 3 | # This script was generated using Makeself $MS_VERSION 4 | # The license covering this archive and its contents, if any, is wholly independent of the Makeself license (GPL) 5 | 6 | ORIG_UMASK=\`umask\` 7 | if test "$KEEP_UMASK" = n; then 8 | umask 077 9 | fi 10 | 11 | CRCsum="$CRCsum" 12 | MD5="$MD5sum" 13 | SHA="$SHAsum" 14 | SIGNATURE="$Signature" 15 | TMPROOT=\${TMPDIR:=/tmp} 16 | USER_PWD="\$PWD" 17 | export USER_PWD 18 | ARCHIVE_DIR=\`dirname "\$0"\` 19 | export ARCHIVE_DIR 20 | 21 | label="$LABEL" 22 | script="$SCRIPT" 23 | scriptargs="$SCRIPTARGS" 24 | cleanup_script="${CLEANUP_SCRIPT}" 25 | licensetxt="$LICENSE" 26 | helpheader='$HELPHEADER' 27 | targetdir="$archdirname" 28 | filesizes="$filesizes" 29 | totalsize="$totalsize" 30 | keep="$KEEP" 31 | nooverwrite="$NOOVERWRITE" 32 | quiet="n" 33 | accept="n" 34 | nodiskspace="n" 35 | export_conf="$EXPORT_CONF" 36 | decrypt_cmd="$DECRYPT_CMD" 37 | skip="$SKIP" 38 | 39 | print_cmd_arg="" 40 | if type printf > /dev/null; then 41 | print_cmd="printf" 42 | elif test -x /usr/ucb/echo; then 43 | print_cmd="/usr/ucb/echo" 44 | else 45 | print_cmd="echo" 46 | fi 47 | 48 | if test -d /usr/xpg4/bin; then 49 | PATH=/usr/xpg4/bin:\$PATH 50 | export PATH 51 | fi 52 | 53 | if test -d /usr/sfw/bin; then 54 | PATH=\$PATH:/usr/sfw/bin 55 | export PATH 56 | fi 57 | 58 | unset CDPATH 59 | 60 | MS_Printf() 61 | { 62 | \$print_cmd \$print_cmd_arg "\$1" 63 | } 64 | 65 | MS_PrintLicense() 66 | { 67 | PAGER=\${PAGER:=more} 68 | if test x"\$licensetxt" != x; then 69 | PAGER_PATH=\`exec <&- 2>&-; which \$PAGER || command -v \$PAGER || type \$PAGER\` 70 | if test -x "\$PAGER_PATH"; then 71 | echo "\$licensetxt" | \$PAGER 72 | else 73 | echo "\$licensetxt" 74 | fi 75 | if test x"\$accept" != xy; then 76 | while true 77 | do 78 | MS_Printf "Please type y to accept, n otherwise: " 79 | read yn 80 | if test x"\$yn" = xn; then 81 | keep=n 82 | eval \$finish; exit 1 83 | break; 84 | elif test x"\$yn" = xy; then 85 | break; 86 | fi 87 | done 88 | fi 89 | fi 90 | } 91 | 92 | MS_diskspace() 93 | { 94 | ( 95 | df -kP "\$1" | tail -1 | awk '{ if (\$4 ~ /%/) {print \$3} else {print \$4} }' 96 | ) 97 | } 98 | 99 | MS_dd() 100 | { 101 | blocks=\`expr \$3 / 1024\` 102 | bytes=\`expr \$3 % 1024\` 103 | # Test for ibs, obs and conv feature 104 | if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 conv=sync 2> /dev/null; then 105 | dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\ 106 | { test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\ 107 | test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null 108 | else 109 | dd if="\$1" bs=\$2 skip=1 2> /dev/null 110 | fi 111 | } 112 | 113 | MS_dd_Progress() 114 | { 115 | if test x"\$noprogress" = xy; then 116 | MS_dd "\$@" 117 | return \$? 118 | fi 119 | file="\$1" 120 | offset=\$2 121 | length=\$3 122 | pos=0 123 | bsize=4194304 124 | while test \$bsize -gt \$length; do 125 | bsize=\`expr \$bsize / 4\` 126 | done 127 | blocks=\`expr \$length / \$bsize\` 128 | bytes=\`expr \$length % \$bsize\` 129 | ( 130 | dd ibs=\$offset skip=1 count=0 2>/dev/null 131 | pos=\`expr \$pos \+ \$bsize\` 132 | MS_Printf " 0%% " 1>&2 133 | if test \$blocks -gt 0; then 134 | while test \$pos -le \$length; do 135 | dd bs=\$bsize count=1 2>/dev/null 136 | pcent=\`expr \$length / 100\` 137 | pcent=\`expr \$pos / \$pcent\` 138 | if test \$pcent -lt 100; then 139 | MS_Printf "\b\b\b\b\b\b\b" 1>&2 140 | if test \$pcent -lt 10; then 141 | MS_Printf " \$pcent%% " 1>&2 142 | else 143 | MS_Printf " \$pcent%% " 1>&2 144 | fi 145 | fi 146 | pos=\`expr \$pos \+ \$bsize\` 147 | done 148 | fi 149 | if test \$bytes -gt 0; then 150 | dd bs=\$bytes count=1 2>/dev/null 151 | fi 152 | MS_Printf "\b\b\b\b\b\b\b" 1>&2 153 | MS_Printf " 100%% " 1>&2 154 | ) < "\$file" 155 | } 156 | 157 | MS_Help() 158 | { 159 | cat << EOH >&2 160 | \${helpheader}Makeself version $MS_VERSION 161 | 1) Getting help or info about \$0 : 162 | \$0 --help Print this message 163 | \$0 --info Print embedded info : title, default target directory, embedded script ... 164 | \$0 --lsm Print embedded lsm entry (or no LSM) 165 | \$0 --list Print the list of files in the archive 166 | \$0 --check Checks integrity of the archive 167 | \$0 --verify-sig key Verify signature agains a provided key id 168 | 169 | 2) Running \$0 : 170 | \$0 [options] [--] [additional arguments to embedded script] 171 | with following options (in that order) 172 | --confirm Ask before running embedded script 173 | --quiet Do not print anything except error messages 174 | --accept Accept the license 175 | --noexec Do not run embedded script (implies --noexec-cleanup) 176 | --noexec-cleanup Do not run embedded cleanup script 177 | --keep Do not erase target directory after running 178 | the embedded script 179 | --noprogress Do not show the progress during the decompression 180 | --nox11 Do not spawn an xterm 181 | --nochown Do not give the target folder to the current user 182 | --chown Give the target folder to the current user recursively 183 | --nodiskspace Do not check for available disk space 184 | --target dir Extract directly to a target directory (absolute or relative) 185 | This directory may undergo recursive chown (see --nochown). 186 | --tar arg1 [arg2 ...] Access the contents of the archive through the tar command 187 | --ssl-pass-src src Use the given src as the source of password to decrypt the data 188 | using OpenSSL. See "PASS PHRASE ARGUMENTS" in man openssl. 189 | Default is to prompt the user to enter decryption password 190 | on the current terminal. 191 | --cleanup-args args Arguments to the cleanup script. Wrap in quotes to provide 192 | multiple arguments. 193 | -- Following arguments will be passed to the embedded script 194 | EOH 195 | } 196 | 197 | MS_Verify_Sig() 198 | { 199 | GPG_PATH=\`exec <&- 2>&-; which gpg || command -v gpg || type gpg\` 200 | MKTEMP_PATH=\`exec <&- 2>&-; which mktemp || command -v mktemp || type mktemp\` 201 | test -x "\$GPG_PATH" || GPG_PATH=\`exec <&- 2>&-; which gpg || command -v gpg || type gpg\` 202 | test -x "\$MKTEMP_PATH" || MKTEMP_PATH=\`exec <&- 2>&-; which mktemp || command -v mktemp || type mktemp\` 203 | offset=\`head -n "\$skip" "\$1" | wc -c | tr -d " "\` 204 | temp_sig=\`mktemp -t XXXXX\` 205 | echo \$SIGNATURE | base64 --decode > "\$temp_sig" 206 | gpg_output=\`MS_dd "\$1" \$offset \$totalsize | LC_ALL=C "\$GPG_PATH" --verify "\$temp_sig" - 2>&1\` 207 | gpg_res=\$? 208 | rm -f "\$temp_sig" 209 | if test \$gpg_res -eq 0 && test \`echo \$gpg_output | grep -c Good\` -eq 1; then 210 | if test \`echo \$gpg_output | grep -c \$sig_key\` -eq 1; then 211 | test x"\$quiet" = xn && echo "GPG signature is good" >&2 212 | else 213 | echo "GPG Signature key does not match" >&2 214 | exit 2 215 | fi 216 | else 217 | test x"\$quiet" = xn && echo "GPG signature failed to verify" >&2 218 | exit 2 219 | fi 220 | } 221 | 222 | MS_Check() 223 | { 224 | OLD_PATH="\$PATH" 225 | PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"} 226 | MD5_ARG="" 227 | MD5_PATH=\`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum\` 228 | test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which md5 || command -v md5 || type md5\` 229 | test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which digest || command -v digest || type digest\` 230 | PATH="\$OLD_PATH" 231 | 232 | SHA_PATH=\`exec <&- 2>&-; which shasum || command -v shasum || type shasum\` 233 | test -x "\$SHA_PATH" || SHA_PATH=\`exec <&- 2>&-; which sha256sum || command -v sha256sum || type sha256sum\` 234 | 235 | if test x"\$quiet" = xn; then 236 | MS_Printf "Verifying archive integrity..." 237 | fi 238 | offset=\`head -n "\$skip" "\$1" | wc -c | tr -d " "\` 239 | fsize=\`cat "\$1" | wc -c | tr -d " "\` 240 | if test \$totalsize -ne \`expr \$fsize - \$offset\`; then 241 | echo " Unexpected archive size." >&2 242 | exit 2 243 | fi 244 | verb=\$2 245 | i=1 246 | for s in \$filesizes 247 | do 248 | crc=\`echo \$CRCsum | cut -d" " -f\$i\` 249 | if test -x "\$SHA_PATH"; then 250 | if test x"\`basename \$SHA_PATH\`" = xshasum; then 251 | SHA_ARG="-a 256" 252 | fi 253 | sha=\`echo \$SHA | cut -d" " -f\$i\` 254 | if test x"\$sha" = x0000000000000000000000000000000000000000000000000000000000000000; then 255 | test x"\$verb" = xy && echo " \$1 does not contain an embedded SHA256 checksum." >&2 256 | else 257 | shasum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$SHA_PATH \$SHA_ARG" | cut -b-64\`; 258 | if test x"\$shasum" != x"\$sha"; then 259 | echo "Error in SHA256 checksums: \$shasum is different from \$sha" >&2 260 | exit 2 261 | elif test x"\$quiet" = xn; then 262 | MS_Printf " SHA256 checksums are OK." >&2 263 | fi 264 | crc="0000000000"; 265 | fi 266 | fi 267 | if test -x "\$MD5_PATH"; then 268 | if test x"\`basename \$MD5_PATH\`" = xdigest; then 269 | MD5_ARG="-a md5" 270 | fi 271 | md5=\`echo \$MD5 | cut -d" " -f\$i\` 272 | if test x"\$md5" = x00000000000000000000000000000000; then 273 | test x"\$verb" = xy && echo " \$1 does not contain an embedded MD5 checksum." >&2 274 | else 275 | md5sum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$MD5_PATH \$MD5_ARG" | cut -b-32\`; 276 | if test x"\$md5sum" != x"\$md5"; then 277 | echo "Error in MD5 checksums: \$md5sum is different from \$md5" >&2 278 | exit 2 279 | elif test x"\$quiet" = xn; then 280 | MS_Printf " MD5 checksums are OK." >&2 281 | fi 282 | crc="0000000000"; verb=n 283 | fi 284 | fi 285 | if test x"\$crc" = x0000000000; then 286 | test x"\$verb" = xy && echo " \$1 does not contain a CRC checksum." >&2 287 | else 288 | sum1=\`MS_dd_Progress "\$1" \$offset \$s | CMD_ENV=xpg4 cksum | awk '{print \$1}'\` 289 | if test x"\$sum1" != x"\$crc"; then 290 | echo "Error in checksums: \$sum1 is different from \$crc" >&2 291 | exit 2 292 | elif test x"\$quiet" = xn; then 293 | MS_Printf " CRC checksums are OK." >&2 294 | fi 295 | fi 296 | i=\`expr \$i + 1\` 297 | offset=\`expr \$offset + \$s\` 298 | done 299 | if test x"\$quiet" = xn; then 300 | echo " All good." 301 | fi 302 | } 303 | 304 | MS_Decompress() 305 | { 306 | if test x"\$decrypt_cmd" != x""; then 307 | { eval "\$decrypt_cmd" || echo " ... Decryption failed." >&2; } | eval "$GUNZIP_CMD" 308 | else 309 | eval "$GUNZIP_CMD" 310 | fi 311 | 312 | if test \$? -ne 0; then 313 | echo " ... Decompression failed." >&2 314 | fi 315 | } 316 | 317 | UnTAR() 318 | { 319 | if test x"\$quiet" = xn; then 320 | tar \$1vf - $UNTAR_EXTRA 2>&1 || { echo " ... Extraction failed." >&2; kill -15 \$$; } 321 | else 322 | tar \$1f - $UNTAR_EXTRA 2>&1 || { echo Extraction failed. >&2; kill -15 \$$; } 323 | fi 324 | } 325 | 326 | MS_exec_cleanup() { 327 | if test x"\$cleanup" = xy && test x"\$cleanup_script" != x""; then 328 | cleanup=n 329 | cd "\$tmpdir" 330 | eval "\"\$cleanup_script\" \$scriptargs \$cleanupargs" 331 | fi 332 | } 333 | 334 | MS_cleanup() 335 | { 336 | echo 'Signal caught, cleaning up' >&2 337 | MS_exec_cleanup 338 | cd "\$TMPROOT" 339 | rm -rf "\$tmpdir" 340 | eval \$finish; exit 15 341 | } 342 | 343 | finish=true 344 | xterm_loop= 345 | noprogress=$NOPROGRESS 346 | nox11=$NOX11 347 | copy=$COPY 348 | ownership=$OWNERSHIP 349 | verbose=n 350 | cleanup=y 351 | cleanupargs= 352 | sig_key= 353 | 354 | initargs="\$@" 355 | 356 | while true 357 | do 358 | case "\$1" in 359 | -h | --help) 360 | MS_Help 361 | exit 0 362 | ;; 363 | -q | --quiet) 364 | quiet=y 365 | noprogress=y 366 | shift 367 | ;; 368 | --accept) 369 | accept=y 370 | shift 371 | ;; 372 | --info) 373 | echo Identification: "\$label" 374 | echo Target directory: "\$targetdir" 375 | echo Uncompressed size: $USIZE KB 376 | echo Compression: $COMPRESS 377 | if test x"$ENCRYPT" != x""; then 378 | echo Encryption: $ENCRYPT 379 | fi 380 | echo Date of packaging: $DATE 381 | echo Built with Makeself version $MS_VERSION 382 | echo Build command was: "$MS_COMMAND" 383 | if test x"\$script" != x; then 384 | echo Script run after extraction: 385 | echo " " \$script \$scriptargs 386 | fi 387 | if test x"$copy" = xcopy; then 388 | echo "Archive will copy itself to a temporary location" 389 | fi 390 | if test x"$NEED_ROOT" = xy; then 391 | echo "Root permissions required for extraction" 392 | fi 393 | if test x"$KEEP" = xy; then 394 | echo "directory \$targetdir is permanent" 395 | else 396 | echo "\$targetdir will be removed after extraction" 397 | fi 398 | exit 0 399 | ;; 400 | --dumpconf) 401 | echo LABEL=\"\$label\" 402 | echo SCRIPT=\"\$script\" 403 | echo SCRIPTARGS=\"\$scriptargs\" 404 | echo CLEANUPSCRIPT=\"\$cleanup_script\" 405 | echo archdirname=\"$archdirname\" 406 | echo KEEP=$KEEP 407 | echo NOOVERWRITE=$NOOVERWRITE 408 | echo COMPRESS=$COMPRESS 409 | echo filesizes=\"\$filesizes\" 410 | echo totalsize=\"\$totalsize\" 411 | echo CRCsum=\"\$CRCsum\" 412 | echo MD5sum=\"\$MD5sum\" 413 | echo SHAsum=\"\$SHAsum\" 414 | echo SKIP=\"\$skip\" 415 | exit 0 416 | ;; 417 | --lsm) 418 | cat << EOLSM 419 | EOF 420 | eval "$LSM_CMD" 421 | cat << EOF >> "$archname" 422 | EOLSM 423 | exit 0 424 | ;; 425 | --list) 426 | echo Target directory: \$targetdir 427 | offset=\`head -n "\$skip" "\$0" | wc -c | tr -d " "\` 428 | for s in \$filesizes 429 | do 430 | MS_dd "\$0" \$offset \$s | MS_Decompress | UnTAR t 431 | offset=\`expr \$offset + \$s\` 432 | done 433 | exit 0 434 | ;; 435 | --tar) 436 | offset=\`head -n "\$skip" "\$0" | wc -c | tr -d " "\` 437 | arg1="\$2" 438 | shift 2 || { MS_Help; exit 1; } 439 | for s in \$filesizes 440 | do 441 | MS_dd "\$0" \$offset \$s | MS_Decompress | tar "\$arg1" - "\$@" 442 | offset=\`expr \$offset + \$s\` 443 | done 444 | exit 0 445 | ;; 446 | --check) 447 | MS_Check "\$0" y 448 | exit 0 449 | ;; 450 | --verify-sig) 451 | sig_key="\$2" 452 | shift 2 || { MS_Help; exit 1; } 453 | MS_Verify_Sig "\$0" 454 | ;; 455 | --confirm) 456 | verbose=y 457 | shift 458 | ;; 459 | --noexec) 460 | script="" 461 | cleanup_script="" 462 | shift 463 | ;; 464 | --noexec-cleanup) 465 | cleanup_script="" 466 | shift 467 | ;; 468 | --keep) 469 | keep=y 470 | shift 471 | ;; 472 | --target) 473 | keep=y 474 | targetdir="\${2:-.}" 475 | shift 2 || { MS_Help; exit 1; } 476 | ;; 477 | --noprogress) 478 | noprogress=y 479 | shift 480 | ;; 481 | --nox11) 482 | nox11=y 483 | shift 484 | ;; 485 | --nochown) 486 | ownership=n 487 | shift 488 | ;; 489 | --chown) 490 | ownership=y 491 | shift 492 | ;; 493 | --nodiskspace) 494 | nodiskspace=y 495 | shift 496 | ;; 497 | --xwin) 498 | if test "$NOWAIT" = n; then 499 | finish="echo Press Return to close this window...; read junk" 500 | fi 501 | xterm_loop=1 502 | shift 503 | ;; 504 | --phase2) 505 | copy=phase2 506 | shift 507 | ;; 508 | --ssl-pass-src) 509 | if test x"$ENCRYPT" != x"openssl"; then 510 | echo "Invalid option --ssl-pass-src: \$0 was not encrypted with OpenSSL!" >&2 511 | exit 1 512 | fi 513 | decrypt_cmd="\$decrypt_cmd -pass \$2" 514 | shift 2 || { MS_Help; exit 1; } 515 | ;; 516 | --cleanup-args) 517 | cleanupargs="\$2" 518 | shift 2 || { MS_Help; exit 1; } 519 | ;; 520 | --) 521 | shift 522 | break ;; 523 | -*) 524 | echo Unrecognized flag : "\$1" >&2 525 | MS_Help 526 | exit 1 527 | ;; 528 | *) 529 | break ;; 530 | esac 531 | done 532 | 533 | if test x"\$quiet" = xy -a x"\$verbose" = xy; then 534 | echo Cannot be verbose and quiet at the same time. >&2 535 | exit 1 536 | fi 537 | 538 | if test x"$NEED_ROOT" = xy -a \`id -u\` -ne 0; then 539 | echo "Administrative privileges required for this archive (use su or sudo)" >&2 540 | exit 1 541 | fi 542 | 543 | if test x"\$copy" \!= xphase2; then 544 | MS_PrintLicense 545 | fi 546 | 547 | case "\$copy" in 548 | copy) 549 | tmpdir="\$TMPROOT"/makeself.\$RANDOM.\`date +"%y%m%d%H%M%S"\`.\$\$ 550 | mkdir "\$tmpdir" || { 551 | echo "Could not create temporary directory \$tmpdir" >&2 552 | exit 1 553 | } 554 | SCRIPT_COPY="\$tmpdir/makeself" 555 | echo "Copying to a temporary location..." >&2 556 | cp "\$0" "\$SCRIPT_COPY" 557 | chmod +x "\$SCRIPT_COPY" 558 | cd "\$TMPROOT" 559 | exec "\$SCRIPT_COPY" --phase2 -- \$initargs 560 | ;; 561 | phase2) 562 | finish="\$finish ; rm -rf \`dirname \$0\`" 563 | ;; 564 | esac 565 | 566 | if test x"\$nox11" = xn; then 567 | if tty -s; then # Do we have a terminal? 568 | : 569 | else 570 | if test x"\$DISPLAY" != x -a x"\$xterm_loop" = x; then # No, but do we have X? 571 | if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable 572 | GUESS_XTERMS="xterm gnome-terminal rxvt dtterm eterm Eterm xfce4-terminal lxterminal kvt konsole aterm terminology" 573 | for a in \$GUESS_XTERMS; do 574 | if type \$a >/dev/null 2>&1; then 575 | XTERM=\$a 576 | break 577 | fi 578 | done 579 | chmod a+x \$0 || echo Please add execution rights on \$0 580 | if test \`echo "\$0" | cut -c1\` = "/"; then # Spawn a terminal! 581 | exec \$XTERM -e "\$0 --xwin \$initargs" 582 | else 583 | exec \$XTERM -e "./\$0 --xwin \$initargs" 584 | fi 585 | fi 586 | fi 587 | fi 588 | fi 589 | 590 | if test x"\$targetdir" = x.; then 591 | tmpdir="." 592 | else 593 | if test x"\$keep" = xy; then 594 | if test x"\$nooverwrite" = xy && test -d "\$targetdir"; then 595 | echo "Target directory \$targetdir already exists, aborting." >&2 596 | exit 1 597 | fi 598 | if test x"\$quiet" = xn; then 599 | echo "Creating directory \$targetdir" >&2 600 | fi 601 | tmpdir="\$targetdir" 602 | dashp="-p" 603 | else 604 | tmpdir="\$TMPROOT/selfgz\$\$\$RANDOM" 605 | dashp="" 606 | fi 607 | mkdir \$dashp "\$tmpdir" || { 608 | echo 'Cannot create target directory' \$tmpdir >&2 609 | echo 'You should try option --target dir' >&2 610 | eval \$finish 611 | exit 1 612 | } 613 | fi 614 | 615 | location="\`pwd\`" 616 | if test x"\$SETUP_NOCHECK" != x1; then 617 | MS_Check "\$0" 618 | fi 619 | offset=\`head -n "\$skip" "\$0" | wc -c | tr -d " "\` 620 | 621 | if test x"\$verbose" = xy; then 622 | MS_Printf "About to extract $USIZE KB in \$tmpdir ... Proceed ? [Y/n] " 623 | read yn 624 | if test x"\$yn" = xn; then 625 | eval \$finish; exit 1 626 | fi 627 | fi 628 | 629 | if test x"\$quiet" = xn; then 630 | # Decrypting with openssl will ask for password, 631 | # the prompt needs to start on new line 632 | if test x"$ENCRYPT" = x"openssl"; then 633 | echo "Decrypting and uncompressing \$label..." 634 | else 635 | MS_Printf "Uncompressing \$label" 636 | fi 637 | fi 638 | res=3 639 | if test x"\$keep" = xn; then 640 | trap MS_cleanup 1 2 3 15 641 | fi 642 | 643 | if test x"\$nodiskspace" = xn; then 644 | leftspace=\`MS_diskspace "\$tmpdir"\` 645 | if test -n "\$leftspace"; then 646 | if test "\$leftspace" -lt $USIZE; then 647 | echo 648 | echo "Not enough space left in "\`dirname \$tmpdir\`" (\$leftspace KB) to decompress \$0 ($USIZE KB)" >&2 649 | echo "Use --nodiskspace option to skip this check and proceed anyway" >&2 650 | if test x"\$keep" = xn; then 651 | echo "Consider setting TMPDIR to a directory with more free space." 652 | fi 653 | eval \$finish; exit 1 654 | fi 655 | fi 656 | fi 657 | 658 | for s in \$filesizes 659 | do 660 | if MS_dd_Progress "\$0" \$offset \$s | MS_Decompress | ( cd "\$tmpdir"; umask \$ORIG_UMASK ; UnTAR xp ) 1>/dev/null; then 661 | if test x"\$ownership" = xy; then 662 | (cd "\$tmpdir"; chown -R \`id -u\` .; chgrp -R \`id -g\` .) 663 | fi 664 | else 665 | echo >&2 666 | echo "Unable to decompress \$0" >&2 667 | eval \$finish; exit 1 668 | fi 669 | offset=\`expr \$offset + \$s\` 670 | done 671 | if test x"\$quiet" = xn; then 672 | echo 673 | fi 674 | 675 | cd "\$tmpdir" 676 | res=0 677 | if test x"\$script" != x; then 678 | if test x"\$export_conf" = x"y"; then 679 | MS_BUNDLE="\$0" 680 | MS_LABEL="\$label" 681 | MS_SCRIPT="\$script" 682 | MS_SCRIPTARGS="\$scriptargs" 683 | MS_ARCHDIRNAME="\$archdirname" 684 | MS_KEEP="\$KEEP" 685 | MS_NOOVERWRITE="\$NOOVERWRITE" 686 | MS_COMPRESS="\$COMPRESS" 687 | MS_CLEANUP="\$cleanup" 688 | export MS_BUNDLE MS_LABEL MS_SCRIPT MS_SCRIPTARGS 689 | export MS_ARCHDIRNAME MS_KEEP MS_NOOVERWRITE MS_COMPRESS 690 | fi 691 | 692 | if test x"\$verbose" = x"y"; then 693 | MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] " 694 | read yn 695 | if test x"\$yn" = x -o x"\$yn" = xy -o x"\$yn" = xY; then 696 | eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$?; 697 | fi 698 | else 699 | eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$? 700 | fi 701 | if test "\$res" -ne 0; then 702 | test x"\$verbose" = xy && echo "The program '\$script' returned an error code (\$res)" >&2 703 | fi 704 | fi 705 | 706 | MS_exec_cleanup 707 | 708 | if test x"\$keep" = xn; then 709 | cd "\$TMPROOT" 710 | rm -rf "\$tmpdir" 711 | fi 712 | eval \$finish; exit \$res 713 | EOF 714 | -------------------------------------------------------------------------------- /makeself-2.4.5/makeself.1: -------------------------------------------------------------------------------- 1 | .TH "MAKESELF" "1" "2.4.5" 2 | .SH "NAME" 3 | makeself \- An utility to generate self-extractable archives. 4 | .SH "SYNTAX" 5 | .B makeself [\fIoptions\fP] archive_dir file_name label 6 | .B [\fIstartup_script\fP] [\fIargs\fP] 7 | .SH "DESCRIPTION" 8 | This program is a free (GPL) utility designed to create self-extractable 9 | archives from a directory. 10 | .SH "OPTIONS" 11 | The following options are supported. 12 | .TP 15 13 | .B -v, --version 14 | Prints out the makeself version number and exits. 15 | .TP 16 | .B -h, --help 17 | Print out help information. 18 | .TP 19 | .B --tar-quietly 20 | Suppress verbose output from the tar command 21 | .TP 22 | .B --quiet 23 | Do not print any messages other than errors 24 | .TP 25 | .B --gzip 26 | Compress using gzip (default if detected). 27 | .TP 28 | .B --bzip2 29 | Compress using bzip2. 30 | .TP 31 | .B --pbzip2 32 | Compress using pbzip2. 33 | .TP 34 | .B --xz 35 | Compress using xz. 36 | .TP 37 | .B --lzo 38 | Compress using lzop. 39 | .TP 40 | .B --lz4 41 | Compress using lz4. 42 | .TP 43 | .B --compress 44 | Compress using the UNIX 'compress' command. 45 | .TP 46 | .B --nocomp 47 | Do not compress the data. 48 | .TP 49 | .B --complevel lvl 50 | Specify the compression level for gzip,bzip2,pbzui2,xz,lzo or lz4 51 | .TP 52 | .B --notemp 53 | The archive will create archive_dir in the current directory and 54 | uncompress in ./archive_dir. 55 | .TP 56 | .B --copy 57 | Upon extraction, the archive will first copy itself to a temporary directory. 58 | .TP 59 | .B --append 60 | Append more files to an existing makeself archive. The label and startup scripts will then be ignored. 61 | .TP 62 | .B --current 63 | Files will be extracted to the current directory. Both --current and --target dir imply --notemp. 64 | .TP 65 | .B --target dir 66 | Extract directly to a target directory. Directory path can be either absolute or relative. 67 | .TP 68 | .B --header file 69 | Specify location of the header script. 70 | .TP 71 | .B --cleanup file 72 | Specify a cleanup script that executes on interrupt and when finished successfully. 73 | .TP 74 | .B --follow 75 | Follow the symlinks in the archive. 76 | .TP 77 | .B --noprogress 78 | Do not show the progress during the decompression. 79 | .TP 80 | .B --nox11 81 | Disable automatic spawn of an xterm if running in X11. 82 | .TP 83 | .B --nowait 84 | Do not wait for user input after executing embedded program from an xterm. 85 | .TP 86 | .B --nomd5 87 | Do not create a MD5 checksum for the archive. 88 | .TP 89 | .B --nocrc 90 | Do not create a CRC32 checksum for the archive. 91 | .TP 92 | .B --lsm file 93 | LSM file describing the package. 94 | .B --packaging-date date 95 | Use provided string as the packaging date instead of the current date. 96 | .SH "EXAMPLES" 97 | Here is an example, assuming the user has a package image stored in a /home/joe/mysoft, 98 | and he wants to generate a self-extracting package named mysoft.sh, which will launch 99 | the "setup" script initially stored in /home/joe/mysoft: 100 | .TP 101 | makeself.sh /home/joe/mysoft mysoft.sh "Joe's Nice Software Package" ./setup 102 | .TP 103 | Here is also how I created the makeself.run archive which contains the Makeself distribution: 104 | .TP 105 | makeself.sh --notemp makeself makeself.run "Makeself by Stephane Peter" echo "Makeself has extracted itself" 106 | .SH "AUTHORS" 107 | Makeself has been written by Stéphane Peter . 108 | .BR 109 | This man page was originally written by Bartosz Fenski for the 110 | Debian GNU/Linux distribution (but it may be used by others). 111 | -------------------------------------------------------------------------------- /makeself-2.4.5/makeself.lsm: -------------------------------------------------------------------------------- 1 | Begin3 2 | Title: makeself.sh 3 | Version: 2.4.5 4 | Description: makeself.sh is a shell script that generates a self-extractable 5 | tar.gz archive from a directory. The resulting file appears as a shell 6 | script, and can be launched as is. The archive will then uncompress 7 | itself to a temporary directory and an arbitrary command will be 8 | executed (for example an installation script). This is pretty similar 9 | to archives generated with WinZip Self-Extractor in the Windows world. 10 | Keywords: Installation archive tar winzip 11 | Author: Stephane Peter (megastep@megastep.org) 12 | Maintained-by: Stephane Peter (megastep@megastep.org) 13 | Original-site: https://makeself.io/ 14 | Platform: Unix 15 | Copying-policy: GPL 16 | End 17 | -------------------------------------------------------------------------------- /makeself-2.4.5/makeself.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Makeself version 2.4.x 4 | # by Stephane Peter 5 | # 6 | # Utility to create self-extracting tar.gz archives. 7 | # The resulting archive is a file holding the tar.gz archive with 8 | # a small Shell script stub that uncompresses the archive to a temporary 9 | # directory and then executes a given script from withing that directory. 10 | # 11 | # Makeself home page: https://makeself.io/ 12 | # 13 | # Version 2.0 is a rewrite of version 1.0 to make the code easier to read and maintain. 14 | # 15 | # Version history : 16 | # - 1.0 : Initial public release 17 | # - 1.1 : The archive can be passed parameters that will be passed on to 18 | # the embedded script, thanks to John C. Quillan 19 | # - 1.2 : Package distribution, bzip2 compression, more command line options, 20 | # support for non-temporary archives. Ideas thanks to Francois Petitjean 21 | # - 1.3 : More patches from Bjarni R. Einarsson and Francois Petitjean: 22 | # Support for no compression (--nocomp), script is no longer mandatory, 23 | # automatic launch in an xterm, optional verbose output, and -target 24 | # archive option to indicate where to extract the files. 25 | # - 1.4 : Improved UNIX compatibility (Francois Petitjean) 26 | # Automatic integrity checking, support of LSM files (Francois Petitjean) 27 | # - 1.5 : Many bugfixes. Optionally disable xterm spawning. 28 | # - 1.5.1 : More bugfixes, added archive options -list and -check. 29 | # - 1.5.2 : Cosmetic changes to inform the user of what's going on with big 30 | # archives (Quake III demo) 31 | # - 1.5.3 : Check for validity of the DISPLAY variable before launching an xterm. 32 | # More verbosity in xterms and check for embedded command's return value. 33 | # Bugfix for Debian 2.0 systems that have a different "print" command. 34 | # - 1.5.4 : Many bugfixes. Print out a message if the extraction failed. 35 | # - 1.5.5 : More bugfixes. Added support for SETUP_NOCHECK environment variable to 36 | # bypass checksum verification of archives. 37 | # - 1.6.0 : Compute MD5 checksums with the md5sum command (patch from Ryan Gordon) 38 | # - 2.0 : Brand new rewrite, cleaner architecture, separated header and UNIX ports. 39 | # - 2.0.1 : Added --copy 40 | # - 2.1.0 : Allow multiple tarballs to be stored in one archive, and incremental updates. 41 | # Added --nochown for archives 42 | # Stopped doing redundant checksums when not necesary 43 | # - 2.1.1 : Work around insane behavior from certain Linux distros with no 'uncompress' command 44 | # Cleaned up the code to handle error codes from compress. Simplified the extraction code. 45 | # - 2.1.2 : Some bug fixes. Use head -n to avoid problems. 46 | # - 2.1.3 : Bug fixes with command line when spawning terminals. 47 | # Added --tar for archives, allowing to give arbitrary arguments to tar on the contents of the archive. 48 | # Added --noexec to prevent execution of embedded scripts. 49 | # Added --nomd5 and --nocrc to avoid creating checksums in archives. 50 | # Added command used to create the archive in --info output. 51 | # Run the embedded script through eval. 52 | # - 2.1.4 : Fixed --info output. 53 | # Generate random directory name when extracting files to . to avoid problems. (Jason Trent) 54 | # Better handling of errors with wrong permissions for the directory containing the files. (Jason Trent) 55 | # Avoid some race conditions (Ludwig Nussel) 56 | # Unset the $CDPATH variable to avoid problems if it is set. (Debian) 57 | # Better handling of dot files in the archive directory. 58 | # - 2.1.5 : Made the md5sum detection consistent with the header code. 59 | # Check for the presence of the archive directory 60 | # Added --encrypt for symmetric encryption through gpg (Eric Windisch) 61 | # Added support for the digest command on Solaris 10 for MD5 checksums 62 | # Check for available disk space before extracting to the target directory (Andreas Schweitzer) 63 | # Allow extraction to run asynchronously (patch by Peter Hatch) 64 | # Use file descriptors internally to avoid error messages (patch by Kay Tiong Khoo) 65 | # - 2.1.6 : Replaced one dot per file progress with a realtime progress percentage and a spining cursor (Guy Baconniere) 66 | # Added --noprogress to prevent showing the progress during the decompression (Guy Baconniere) 67 | # Added --target dir to allow extracting directly to a target directory (Guy Baconniere) 68 | # - 2.2.0 : Many bugfixes, updates and contributions from users. Check out the project page on Github for the details. 69 | # - 2.3.0 : Option to specify packaging date to enable byte-for-byte reproducibility. (Marc Pawlowsky) 70 | # - 2.4.0 : Optional support for SHA256 checksums in archives. 71 | # - 2.4.2 : Add support for threads for several compressors. (M. Limber) 72 | # Added zstd support. 73 | # - 2.4.3 : Make explicit POSIX tar archives for increased compatibility. 74 | # - 2.4.5 : Added --tar-format to override ustar tar archive format 75 | # 76 | # (C) 1998-2021 by Stephane Peter 77 | # 78 | # This software is released under the terms of the GNU GPL version 2 and above 79 | # Please read the license at http://www.gnu.org/copyleft/gpl.html 80 | # Self-extracting archives created with this script are explictly NOT released under the term of the GPL 81 | # 82 | 83 | MS_VERSION=2.4.5 84 | MS_COMMAND="$0" 85 | unset CDPATH 86 | 87 | for f in ${1+"$@"}; do 88 | MS_COMMAND="$MS_COMMAND \\\\ 89 | \\\"$f\\\"" 90 | done 91 | 92 | # For Solaris systems 93 | if test -d /usr/xpg4/bin; then 94 | PATH=/usr/xpg4/bin:$PATH 95 | export PATH 96 | fi 97 | 98 | # Procedures 99 | 100 | MS_Usage() 101 | { 102 | echo "Usage: $0 [args] archive_dir file_name label startup_script [script_args]" 103 | echo "args can be one or more of the following :" 104 | echo " --version | -v : Print out Makeself version number and exit" 105 | echo " --help | -h : Print out this help message" 106 | echo " --tar-quietly : Suppress verbose output from the tar command" 107 | echo " --quiet | -q : Do not print any messages other than errors." 108 | echo " --gzip : Compress using gzip (default if detected)" 109 | echo " --pigz : Compress with pigz" 110 | echo " --zstd : Compress with zstd" 111 | echo " --bzip2 : Compress using bzip2 instead of gzip" 112 | echo " --pbzip2 : Compress using pbzip2 instead of gzip" 113 | echo " --xz : Compress using xz instead of gzip" 114 | echo " --lzo : Compress using lzop instead of gzip" 115 | echo " --lz4 : Compress using lz4 instead of gzip" 116 | echo " --compress : Compress using the UNIX 'compress' command" 117 | echo " --complevel lvl : Compression level for gzip pigz zstd xz lzo lz4 bzip2 and pbzip2 (default 9)" 118 | echo " --threads thds : Number of threads to be used by compressors that support parallelization." 119 | echo " Omit to use compressor's default. Most useful (and required) for opting" 120 | echo " into xz's threading, usually with '--threads=0' for all available cores." 121 | echo " pbzip2 and pigz are parallel by default, and setting this value allows" 122 | echo " limiting the number of threads they use." 123 | echo " --base64 : Instead of compressing, encode the data using base64" 124 | echo " --gpg-encrypt : Instead of compressing, encrypt the data using GPG" 125 | echo " --gpg-asymmetric-encrypt-sign" 126 | echo " : Instead of compressing, asymmetrically encrypt and sign the data using GPG" 127 | echo " --gpg-extra opt : Append more options to the gpg command line" 128 | echo " --ssl-encrypt : Instead of compressing, encrypt the data using OpenSSL" 129 | echo " --ssl-passwd pass : Use the given password to encrypt the data using OpenSSL" 130 | echo " --ssl-pass-src src : Use the given src as the source of password to encrypt the data" 131 | echo " using OpenSSL. See \"PASS PHRASE ARGUMENTS\" in man openssl." 132 | echo " If this option is not supplied, the user will be asked to enter" 133 | echo " encryption password on the current terminal." 134 | echo " --ssl-no-md : Do not use \"-md\" option not supported by older OpenSSL." 135 | echo " --nochown : Do not give the target folder to the current user (default)" 136 | echo " --chown : Give the target folder to the current user recursively" 137 | echo " --nocomp : Do not compress the data" 138 | echo " --notemp : The archive will create archive_dir in the" 139 | echo " current directory and uncompress in ./archive_dir" 140 | echo " --needroot : Check that the root user is extracting the archive before proceeding" 141 | echo " --copy : Upon extraction, the archive will first copy itself to" 142 | echo " a temporary directory" 143 | echo " --append : Append more files to an existing Makeself archive" 144 | echo " The label and startup scripts will then be ignored" 145 | echo " --target dir : Extract directly to a target directory" 146 | echo " directory path can be either absolute or relative" 147 | echo " --nooverwrite : Do not extract the archive if the specified target directory exists" 148 | echo " --current : Files will be extracted to the current directory" 149 | echo " Both --current and --target imply --notemp" 150 | echo " --tar-format opt : Specify a tar archive format (default is ustar)" 151 | echo " --tar-extra opt : Append more options to the tar command line" 152 | echo " --untar-extra opt : Append more options to the during the extraction of the tar archive" 153 | echo " --nomd5 : Don't calculate an MD5 for archive" 154 | echo " --nocrc : Don't calculate a CRC for archive" 155 | echo " --sha256 : Compute a SHA256 checksum for the archive" 156 | echo " --header file : Specify location of the header script" 157 | echo " --cleanup file : Specify a cleanup script that executes on interrupt and when finished successfully." 158 | echo " --follow : Follow the symlinks in the archive" 159 | echo " --noprogress : Do not show the progress during the decompression" 160 | echo " --nox11 : Disable automatic spawn of a xterm" 161 | echo " --nowait : Do not wait for user input after executing embedded" 162 | echo " program from an xterm" 163 | echo " --sign passphrase : Signature private key to sign the package with" 164 | echo " --lsm file : LSM file describing the package" 165 | echo " --license file : Append a license file" 166 | echo " --help-header file : Add a header to the archive's --help output" 167 | echo " --packaging-date date" 168 | echo " : Use provided string as the packaging date" 169 | echo " instead of the current date." 170 | echo 171 | echo " --keep-umask : Keep the umask set to shell default, rather than overriding when executing self-extracting archive." 172 | echo " --export-conf : Export configuration variables to startup_script" 173 | echo 174 | echo "Do not forget to give a fully qualified startup script name" 175 | echo "(i.e. with a ./ prefix if inside the archive)." 176 | exit 1 177 | } 178 | 179 | # Default settings 180 | if type gzip >/dev/null 2>&1; then 181 | COMPRESS=gzip 182 | elif type compress >/dev/null 2>&1; then 183 | COMPRESS=compress 184 | else 185 | echo "ERROR: missing commands: gzip, compress" >&2 186 | MS_Usage 187 | fi 188 | ENCRYPT=n 189 | PASSWD="" 190 | PASSWD_SRC="" 191 | OPENSSL_NO_MD=n 192 | COMPRESS_LEVEL=9 193 | DEFAULT_THREADS=123456 # Sentinel value 194 | THREADS=$DEFAULT_THREADS 195 | KEEP=n 196 | CURRENT=n 197 | NOX11=n 198 | NOWAIT=n 199 | APPEND=n 200 | TAR_QUIETLY=n 201 | KEEP_UMASK=n 202 | QUIET=n 203 | NOPROGRESS=n 204 | COPY=none 205 | NEED_ROOT=n 206 | TAR_ARGS=rvf 207 | TAR_FORMAT=ustar 208 | TAR_EXTRA="" 209 | GPG_EXTRA="" 210 | DU_ARGS=-ks 211 | HEADER=`dirname "$0"`/makeself-header.sh 212 | SIGNATURE="" 213 | TARGETDIR="" 214 | NOOVERWRITE=n 215 | DATE=`LC_ALL=C date` 216 | EXPORT_CONF=n 217 | SHA256=n 218 | OWNERSHIP=n 219 | SIGN=n 220 | GPG_PASSPHRASE="" 221 | 222 | # LSM file stuff 223 | LSM_CMD="echo No LSM. >> \"\$archname\"" 224 | 225 | while true 226 | do 227 | case "$1" in 228 | --version | -v) 229 | echo Makeself version $MS_VERSION 230 | exit 0 231 | ;; 232 | --pbzip2) 233 | COMPRESS=pbzip2 234 | shift 235 | ;; 236 | --bzip2) 237 | COMPRESS=bzip2 238 | shift 239 | ;; 240 | --gzip) 241 | COMPRESS=gzip 242 | shift 243 | ;; 244 | --pigz) 245 | COMPRESS=pigz 246 | shift 247 | ;; 248 | --zstd) 249 | COMPRESS=zstd 250 | shift 251 | ;; 252 | --xz) 253 | COMPRESS=xz 254 | shift 255 | ;; 256 | --lzo) 257 | COMPRESS=lzo 258 | shift 259 | ;; 260 | --lz4) 261 | COMPRESS=lz4 262 | shift 263 | ;; 264 | --compress) 265 | COMPRESS=compress 266 | shift 267 | ;; 268 | --base64) 269 | COMPRESS=base64 270 | shift 271 | ;; 272 | --gpg-encrypt) 273 | COMPRESS=gpg 274 | shift 275 | ;; 276 | --gpg-asymmetric-encrypt-sign) 277 | COMPRESS=gpg-asymmetric 278 | shift 279 | ;; 280 | --gpg-extra) 281 | GPG_EXTRA="$2" 282 | shift 2 || { MS_Usage; exit 1; } 283 | ;; 284 | --ssl-encrypt) 285 | ENCRYPT=openssl 286 | shift 287 | ;; 288 | --ssl-passwd) 289 | PASSWD=$2 290 | shift 2 || { MS_Usage; exit 1; } 291 | ;; 292 | --ssl-pass-src) 293 | PASSWD_SRC=$2 294 | shift 2 || { MS_Usage; exit 1; } 295 | ;; 296 | --ssl-no-md) 297 | OPENSSL_NO_MD=y 298 | shift 299 | ;; 300 | --nocomp) 301 | COMPRESS=none 302 | shift 303 | ;; 304 | --complevel) 305 | COMPRESS_LEVEL="$2" 306 | shift 2 || { MS_Usage; exit 1; } 307 | ;; 308 | --threads) 309 | THREADS="$2" 310 | shift 2 || { MS_Usage; exit 1; } 311 | ;; 312 | --nochown) 313 | OWNERSHIP=n 314 | shift 315 | ;; 316 | --chown) 317 | OWNERSHIP=y 318 | shift 319 | ;; 320 | --notemp) 321 | KEEP=y 322 | shift 323 | ;; 324 | --copy) 325 | COPY=copy 326 | shift 327 | ;; 328 | --current) 329 | CURRENT=y 330 | KEEP=y 331 | shift 332 | ;; 333 | --tar-format) 334 | TAR_FORMAT="$2" 335 | shift 2 || { MS_Usage; exit 1; } 336 | ;; 337 | --tar-extra) 338 | TAR_EXTRA="$2" 339 | shift 2 || { MS_Usage; exit 1; } 340 | ;; 341 | --untar-extra) 342 | UNTAR_EXTRA="$2" 343 | shift 2 || { MS_Usage; exit 1; } 344 | ;; 345 | --target) 346 | TARGETDIR="$2" 347 | KEEP=y 348 | shift 2 || { MS_Usage; exit 1; } 349 | ;; 350 | --sign) 351 | SIGN=y 352 | GPG_PASSPHRASE="$2" 353 | shift 2 || { MS_Usage; exit 1; } 354 | ;; 355 | --nooverwrite) 356 | NOOVERWRITE=y 357 | shift 358 | ;; 359 | --needroot) 360 | NEED_ROOT=y 361 | shift 362 | ;; 363 | --header) 364 | HEADER="$2" 365 | shift 2 || { MS_Usage; exit 1; } 366 | ;; 367 | --cleanup) 368 | CLEANUP_SCRIPT="$2" 369 | shift 2 || { MS_Usage; exit 1; } 370 | ;; 371 | --license) 372 | # We need to escape all characters having a special meaning in double quotes 373 | LICENSE=$(sed 's/\\/\\\\/g; s/"/\\\"/g; s/`/\\\`/g; s/\$/\\\$/g' "$2") 374 | shift 2 || { MS_Usage; exit 1; } 375 | ;; 376 | --follow) 377 | TAR_ARGS=rvhf 378 | DU_ARGS=-ksL 379 | shift 380 | ;; 381 | --noprogress) 382 | NOPROGRESS=y 383 | shift 384 | ;; 385 | --nox11) 386 | NOX11=y 387 | shift 388 | ;; 389 | --nowait) 390 | NOWAIT=y 391 | shift 392 | ;; 393 | --nomd5) 394 | NOMD5=y 395 | shift 396 | ;; 397 | --sha256) 398 | SHA256=y 399 | shift 400 | ;; 401 | --nocrc) 402 | NOCRC=y 403 | shift 404 | ;; 405 | --append) 406 | APPEND=y 407 | shift 408 | ;; 409 | --lsm) 410 | LSM_CMD="cat \"$2\" >> \"\$archname\"" 411 | shift 2 || { MS_Usage; exit 1; } 412 | ;; 413 | --packaging-date) 414 | DATE="$2" 415 | shift 2 || { MS_Usage; exit 1; } 416 | ;; 417 | --help-header) 418 | HELPHEADER=`sed -e "s/'/'\\\\\''/g" $2` 419 | shift 2 || { MS_Usage; exit 1; } 420 | [ -n "$HELPHEADER" ] && HELPHEADER="$HELPHEADER 421 | " 422 | ;; 423 | --tar-quietly) 424 | TAR_QUIETLY=y 425 | shift 426 | ;; 427 | --keep-umask) 428 | KEEP_UMASK=y 429 | shift 430 | ;; 431 | --export-conf) 432 | EXPORT_CONF=y 433 | shift 434 | ;; 435 | -q | --quiet) 436 | QUIET=y 437 | shift 438 | ;; 439 | -h | --help) 440 | MS_Usage 441 | ;; 442 | -*) 443 | echo Unrecognized flag : "$1" 444 | MS_Usage 445 | ;; 446 | *) 447 | break 448 | ;; 449 | esac 450 | done 451 | 452 | if test $# -lt 1; then 453 | MS_Usage 454 | else 455 | if test -d "$1"; then 456 | archdir="$1" 457 | else 458 | echo "Directory $1 does not exist." >&2 459 | exit 1 460 | fi 461 | fi 462 | archname="$2" 463 | 464 | if test "$QUIET" = "y" || test "$TAR_QUIETLY" = "y"; then 465 | if test "$TAR_ARGS" = "rvf"; then 466 | TAR_ARGS="rf" 467 | elif test "$TAR_ARGS" = "rvhf"; then 468 | TAR_ARGS="rhf" 469 | fi 470 | fi 471 | 472 | if test "$APPEND" = y; then 473 | if test $# -lt 2; then 474 | MS_Usage 475 | fi 476 | 477 | # Gather the info from the original archive 478 | OLDENV=`sh "$archname" --dumpconf` 479 | if test $? -ne 0; then 480 | echo "Unable to update archive: $archname" >&2 481 | exit 1 482 | else 483 | eval "$OLDENV" 484 | OLDSKIP=`expr $SKIP + 1` 485 | fi 486 | else 487 | if test "$KEEP" = n -a $# = 3; then 488 | echo "ERROR: Making a temporary archive with no embedded command does not make sense!" >&2 489 | echo >&2 490 | MS_Usage 491 | fi 492 | # We don't want to create an absolute directory unless a target directory is defined 493 | if test "$CURRENT" = y; then 494 | archdirname="." 495 | elif test x"$TARGETDIR" != x; then 496 | archdirname="$TARGETDIR" 497 | else 498 | archdirname=`basename "$1"` 499 | fi 500 | 501 | if test $# -lt 3; then 502 | MS_Usage 503 | fi 504 | 505 | LABEL="$3" 506 | SCRIPT="$4" 507 | test "x$SCRIPT" = x || shift 1 508 | shift 3 509 | SCRIPTARGS="$*" 510 | fi 511 | 512 | if test "$KEEP" = n -a "$CURRENT" = y; then 513 | echo "ERROR: It is A VERY DANGEROUS IDEA to try to combine --notemp and --current." >&2 514 | exit 1 515 | fi 516 | 517 | case $COMPRESS in 518 | gzip) 519 | GZIP_CMD="gzip -c$COMPRESS_LEVEL" 520 | GUNZIP_CMD="gzip -cd" 521 | ;; 522 | pigz) 523 | GZIP_CMD="pigz -$COMPRESS_LEVEL" 524 | if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated 525 | GZIP_CMD="$GZIP_CMD --processes $THREADS" 526 | fi 527 | GUNZIP_CMD="gzip -cd" 528 | ;; 529 | zstd) 530 | GZIP_CMD="zstd -$COMPRESS_LEVEL" 531 | if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated 532 | GZIP_CMD="$GZIP_CMD --threads=$THREADS" 533 | fi 534 | GUNZIP_CMD="zstd -cd" 535 | ;; 536 | pbzip2) 537 | GZIP_CMD="pbzip2 -c$COMPRESS_LEVEL" 538 | if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated 539 | GZIP_CMD="$GZIP_CMD -p$THREADS" 540 | fi 541 | GUNZIP_CMD="bzip2 -d" 542 | ;; 543 | bzip2) 544 | GZIP_CMD="bzip2 -$COMPRESS_LEVEL" 545 | GUNZIP_CMD="bzip2 -d" 546 | ;; 547 | xz) 548 | GZIP_CMD="xz -c$COMPRESS_LEVEL" 549 | # Must opt-in by specifying a value since not all versions of xz support threads 550 | if test $THREADS -ne $DEFAULT_THREADS; then 551 | GZIP_CMD="$GZIP_CMD --threads=$THREADS" 552 | fi 553 | GUNZIP_CMD="xz -d" 554 | ;; 555 | lzo) 556 | GZIP_CMD="lzop -c$COMPRESS_LEVEL" 557 | GUNZIP_CMD="lzop -d" 558 | ;; 559 | lz4) 560 | GZIP_CMD="lz4 -c$COMPRESS_LEVEL" 561 | GUNZIP_CMD="lz4 -d" 562 | ;; 563 | base64) 564 | GZIP_CMD="base64" 565 | GUNZIP_CMD="base64 --decode -i -" 566 | ;; 567 | gpg) 568 | GZIP_CMD="gpg $GPG_EXTRA -ac -z$COMPRESS_LEVEL" 569 | GUNZIP_CMD="gpg -d" 570 | ENCRYPT="gpg" 571 | ;; 572 | gpg-asymmetric) 573 | GZIP_CMD="gpg $GPG_EXTRA -z$COMPRESS_LEVEL -es" 574 | GUNZIP_CMD="gpg --yes -d" 575 | ENCRYPT="gpg" 576 | ;; 577 | compress) 578 | GZIP_CMD="compress -fc" 579 | GUNZIP_CMD="(type compress >/dev/null 2>&1 && compress -fcd || gzip -cd)" 580 | ;; 581 | none) 582 | GZIP_CMD="cat" 583 | GUNZIP_CMD="cat" 584 | ;; 585 | esac 586 | 587 | if test x"$ENCRYPT" = x"openssl"; then 588 | if test x"$APPEND" = x"y"; then 589 | echo "Appending to existing archive is not compatible with OpenSSL encryption." >&2 590 | fi 591 | 592 | ENCRYPT_CMD="openssl enc -aes-256-cbc -salt" 593 | DECRYPT_CMD="openssl enc -aes-256-cbc -d" 594 | 595 | if test x"$OPENSSL_NO_MD" != x"y"; then 596 | ENCRYPT_CMD="$ENCRYPT_CMD -md sha256" 597 | DECRYPT_CMD="$DECRYPT_CMD -md sha256" 598 | fi 599 | 600 | if test -n "$PASSWD_SRC"; then 601 | ENCRYPT_CMD="$ENCRYPT_CMD -pass $PASSWD_SRC" 602 | elif test -n "$PASSWD"; then 603 | ENCRYPT_CMD="$ENCRYPT_CMD -pass pass:$PASSWD" 604 | fi 605 | fi 606 | 607 | tmpfile="${TMPDIR:-/tmp}/mkself$$" 608 | 609 | if test -f "$HEADER"; then 610 | oldarchname="$archname" 611 | archname="$tmpfile" 612 | # Generate a fake header to count its lines 613 | SKIP=0 614 | . "$HEADER" 615 | SKIP=`cat "$tmpfile" |wc -l` 616 | # Get rid of any spaces 617 | SKIP=`expr $SKIP` 618 | rm -f "$tmpfile" 619 | if test "$QUIET" = "n"; then 620 | echo "Header is $SKIP lines long" >&2 621 | fi 622 | archname="$oldarchname" 623 | else 624 | echo "Unable to open header file: $HEADER" >&2 625 | exit 1 626 | fi 627 | 628 | if test "$QUIET" = "n"; then 629 | echo 630 | fi 631 | 632 | if test "$APPEND" = n; then 633 | if test -f "$archname"; then 634 | echo "WARNING: Overwriting existing file: $archname" >&2 635 | fi 636 | fi 637 | 638 | USIZE=`du $DU_ARGS "$archdir" | awk '{print $1}'` 639 | 640 | if test "." = "$archdirname"; then 641 | if test "$KEEP" = n; then 642 | archdirname="makeself-$$-`date +%Y%m%d%H%M%S`" 643 | fi 644 | fi 645 | 646 | test -d "$archdir" || { echo "Error: $archdir does not exist."; rm -f "$tmpfile"; exit 1; } 647 | if test "$QUIET" = "n"; then 648 | echo "About to compress $USIZE KB of data..." 649 | echo "Adding files to archive named \"$archname\"..." 650 | fi 651 | 652 | # See if we have GNU tar 653 | TAR=`exec <&- 2>&-; which gtar || command -v gtar || type gtar` 654 | test -x "$TAR" || TAR=tar 655 | 656 | tmparch="${TMPDIR:-/tmp}/mkself$$.tar" 657 | ( 658 | if test "$APPEND" = "y"; then 659 | tail -n "+$OLDSKIP" "$archname" | eval "$GUNZIP_CMD" > "$tmparch" 660 | fi 661 | cd "$archdir" 662 | # "Determining if a directory is empty" 663 | # https://www.etalabs.net/sh_tricks.html 664 | find . \ 665 | \( \ 666 | ! -type d \ 667 | -o \ 668 | \( -links 2 -exec sh -c ' 669 | is_empty () ( 670 | cd "$1" 671 | set -- .[!.]* ; test -f "$1" && return 1 672 | set -- ..?* ; test -f "$1" && return 1 673 | set -- * ; test -f "$1" && return 1 674 | return 0 675 | ) 676 | is_empty "$0"' {} \; \ 677 | \) \ 678 | \) -print \ 679 | | LC_ALL=C sort \ 680 | | sed 's/./\\&/g' \ 681 | | xargs $TAR $TAR_EXTRA --format $TAR_FORMAT -$TAR_ARGS "$tmparch" 682 | ) || { 683 | echo "ERROR: failed to create temporary archive: $tmparch" 684 | rm -f "$tmparch" "$tmpfile" 685 | exit 1 686 | } 687 | 688 | USIZE=`du $DU_ARGS "$tmparch" | awk '{print $1}'` 689 | 690 | eval "$GZIP_CMD" <"$tmparch" >"$tmpfile" || { 691 | echo "ERROR: failed to create temporary file: $tmpfile" 692 | rm -f "$tmparch" "$tmpfile" 693 | exit 1 694 | } 695 | rm -f "$tmparch" 696 | 697 | if test x"$ENCRYPT" = x"openssl"; then 698 | echo "About to encrypt archive \"$archname\"..." 699 | { eval "$ENCRYPT_CMD -in $tmpfile -out ${tmpfile}.enc" && mv -f ${tmpfile}.enc $tmpfile; } || \ 700 | { echo Aborting: could not encrypt temporary file: "$tmpfile".; rm -f "$tmpfile"; exit 1; } 701 | fi 702 | 703 | fsize=`cat "$tmpfile" | wc -c | tr -d " "` 704 | 705 | # Compute the checksums 706 | 707 | shasum=0000000000000000000000000000000000000000000000000000000000000000 708 | md5sum=00000000000000000000000000000000 709 | crcsum=0000000000 710 | 711 | if test "$NOCRC" = y; then 712 | if test "$QUIET" = "n"; then 713 | echo "skipping crc at user request" 714 | fi 715 | else 716 | crcsum=`CMD_ENV=xpg4 cksum < "$tmpfile" | sed -e 's/ /Z/' -e 's/ /Z/' | cut -dZ -f1` 717 | if test "$QUIET" = "n"; then 718 | echo "CRC: $crcsum" 719 | fi 720 | fi 721 | 722 | if test "$SHA256" = y; then 723 | SHA_PATH=`exec <&- 2>&-; which shasum || command -v shasum || type shasum` 724 | if test -x "$SHA_PATH"; then 725 | shasum=`eval "$SHA_PATH -a 256" < "$tmpfile" | cut -b-64` 726 | else 727 | SHA_PATH=`exec <&- 2>&-; which sha256sum || command -v sha256sum || type sha256sum` 728 | shasum=`eval "$SHA_PATH" < "$tmpfile" | cut -b-64` 729 | fi 730 | if test "$QUIET" = "n"; then 731 | if test -x "$SHA_PATH"; then 732 | echo "SHA256: $shasum" 733 | else 734 | echo "SHA256: none, SHA command not found" 735 | fi 736 | fi 737 | fi 738 | if test "$NOMD5" = y; then 739 | if test "$QUIET" = "n"; then 740 | echo "Skipping md5sum at user request" 741 | fi 742 | else 743 | # Try to locate a MD5 binary 744 | OLD_PATH=$PATH 745 | PATH=${GUESS_MD5_PATH:-"$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"} 746 | MD5_ARG="" 747 | MD5_PATH=`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum` 748 | test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which md5 || command -v md5 || type md5` 749 | test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which digest || command -v digest || type digest` 750 | PATH=$OLD_PATH 751 | if test -x "$MD5_PATH"; then 752 | if test `basename ${MD5_PATH}`x = digestx; then 753 | MD5_ARG="-a md5" 754 | fi 755 | md5sum=`eval "$MD5_PATH $MD5_ARG" < "$tmpfile" | cut -b-32` 756 | if test "$QUIET" = "n"; then 757 | echo "MD5: $md5sum" 758 | fi 759 | else 760 | if test "$QUIET" = "n"; then 761 | echo "MD5: none, MD5 command not found" 762 | fi 763 | fi 764 | fi 765 | if test "$SIGN" = y; then 766 | GPG_PATH=`exec <&- 2>&-; which gpg || command -v gpg || type gpg` 767 | if test -x "$GPG_PATH"; then 768 | SIGNATURE=`$GPG_PATH --pinentry-mode=loopback --batch --yes --passphrase "$GPG_PASSPHRASE" --output - --detach-sig $tmpfile | base64 | tr -d \\\\n` 769 | if test "$QUIET" = "n"; then 770 | echo "Signature: $SIGNATURE" 771 | fi 772 | else 773 | echo "Missing gpg command" >&2 774 | fi 775 | fi 776 | 777 | totalsize=0 778 | for size in $fsize; 779 | do 780 | totalsize=`expr $totalsize + $size` 781 | done 782 | 783 | if test "$APPEND" = y; then 784 | mv "$archname" "$archname".bak || exit 785 | 786 | # Prepare entry for new archive 787 | filesizes="$fsize" 788 | CRCsum="$crcsum" 789 | MD5sum="$md5sum" 790 | SHAsum="$shasum" 791 | Signature="$SIGNATURE" 792 | # Generate the header 793 | . "$HEADER" 794 | # Append the new data 795 | cat "$tmpfile" >> "$archname" 796 | 797 | chmod +x "$archname" 798 | rm -f "$archname".bak 799 | if test "$QUIET" = "n"; then 800 | echo "Self-extractable archive \"$archname\" successfully updated." 801 | fi 802 | else 803 | filesizes="$fsize" 804 | CRCsum="$crcsum" 805 | MD5sum="$md5sum" 806 | SHAsum="$shasum" 807 | Signature="$SIGNATURE" 808 | 809 | # Generate the header 810 | . "$HEADER" 811 | 812 | # Append the compressed tar data after the stub 813 | if test "$QUIET" = "n"; then 814 | echo 815 | fi 816 | cat "$tmpfile" >> "$archname" 817 | chmod +x "$archname" 818 | if test "$QUIET" = "n"; then 819 | echo Self-extractable archive \"$archname\" successfully created. 820 | fi 821 | fi 822 | rm -f "$tmpfile" 823 | -------------------------------------------------------------------------------- /makeself-2.4.5/test-orc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xophidia/DFIR_Linux_Collector/a544d6fef15940a880862ebad2120f84b3390b25/makeself-2.4.5/test-orc -------------------------------------------------------------------------------- /makeself-2.4.5/test/appendtest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # FIXME: These tests need to check that the concatenation of archives works 3 | 4 | set -eu 5 | 6 | THIS="$(realpath "$0")" 7 | WHAT="$(basename "${THIS}")" 8 | HERE="$(dirname "${THIS}")" 9 | SRCDIR="$(dirname "${HERE}")" 10 | SUT="${SRCDIR}/makeself.sh" 11 | 12 | readonly archive_dir_create="$(mktemp -dt archive_dir_create.XXXXXX)" 13 | readonly archive_dir_append="$(mktemp -dt archive_dir_append.XXXXXX)" 14 | touch "${archive_dir_create}/fee" 15 | touch "${archive_dir_create}/fie" 16 | touch "${archive_dir_append}/foe" 17 | touch "${archive_dir_append}/fum" 18 | 19 | evalAssert() { 20 | eval "$@" 21 | assertEqual "$?" "0" 22 | } 23 | 24 | # $1 : file_name 25 | doInfoListCheckExec() { 26 | evalAssert "$1" --info 27 | evalAssert "$1" --list 28 | evalAssert "$1" --check 29 | evalAssert "$1" 30 | } 31 | 32 | # $1 : file_name 33 | # rest : content basenames 34 | assertContains() { 35 | local file_name="" 36 | file_name="$(realpath "$1")" 37 | shift 38 | local target="${file_name}.d" 39 | rm -rf "${target}" 40 | mkdir -p "${target}" 41 | evalAssert "${file_name}" --target "${target}" 42 | assertEqual \ 43 | "$(find "${target}" -type f -exec basename -a {} + | sort)" \ 44 | "$(echo "$@" | sort)" 45 | rm -rf "${target}" 46 | } 47 | 48 | # $@ : makeself options 49 | doTestOpts() { 50 | local stem="" 51 | stem="$(printf '%s' "${WHAT}" "$@" | tr -sc '[:alnum:]_.-' '_')" 52 | local file_name="" 53 | file_name="${stem}.run" 54 | 55 | evalAssert "${SUT}" "$@" --sha256 \ 56 | "${archive_dir_create}" \ 57 | "${file_name}" \ 58 | "${stem}" \ 59 | "echo ${stem}" 60 | file_name="$(realpath ${file_name})" 61 | doInfoListCheckExec "${file_name}" 62 | assertContains "${file_name}" "fee" "fie" 63 | 64 | evalAssert "${SUT}" "$@" --sha256 \ 65 | --append "${archive_dir_append}" \ 66 | "${file_name}" 67 | doInfoListCheckExec "${file_name}" 68 | assertContains "${file_name}" "fee" "fie" "foe" "fum" 69 | 70 | rm -f "${file_name}" 71 | } 72 | 73 | # $1 : compression option 74 | doTestComp() { 75 | if ! command -v "${1#--*}" >/dev/null 2>&1; then 76 | echo "WARNING: missing command: ${1#--*}" >&2 77 | return 0 78 | fi 79 | doTestOpts "$1" 80 | } 81 | 82 | ################################################################################ 83 | 84 | testDefault() { doTestOpts; } 85 | 86 | testNocomp() { doTestOpts --nocomp; } 87 | 88 | testBase64() { doTestComp --base64; } 89 | testBzip2() { doTestComp --bzip2; } 90 | testCompress() { doTestComp --compress; } 91 | testGzip() { doTestComp --gzip; } 92 | testLz4() { doTestComp --lz4; } 93 | testLzo() { doTestComp --lzo; } 94 | testPbzip2() { doTestComp --pbzip2; } 95 | testPigz() { doTestComp --pigz; } 96 | testXz() { doTestComp --xz; } 97 | testZstd() { doTestComp --zstd; } 98 | 99 | source bashunit/bashunit.bash 100 | 101 | rm -rf "${archive_dir_create}" "${archive_dir_append}" 102 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/bashunit/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Uwe Dauernheim 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | The views and conclusions contained in the software and documentation are those 25 | of the authors and should not be interpreted as representing official policies, 26 | either expressed or implied, of the FreeBSD Project. 27 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/bashunit/README.md: -------------------------------------------------------------------------------- 1 | # bashunit 2 | 3 | `bashunit` is a unit testing framework for Bash scripts based on xUnit principles. 4 | 5 | This is similar to the [ShUnit](http://shunit.sourceforge.net/) and its 6 | successor [shUnit2](https://code.google.com/p/shunit2/). 7 | 8 | ## Usage 9 | 10 | Functions starting with 'test' will be automatically evaluated. 11 | 12 | **1. Write test cases** 13 | 14 | ```bash 15 | testEcho() { 16 | assertEqual "$(echo foo)" "foo" 17 | assertReturn "$(echo foo)" 0 18 | } 19 | ``` 20 | 21 | **2. Include this script at the end of your test script** 22 | 23 | ```bash 24 | source $(dirname $0)/bashunit.bash 25 | 26 | # eof 27 | ``` 28 | 29 | **3. Run test suite** 30 | 31 | ```bash 32 | $ ./test_example 33 | testEcho:4:Passed 34 | testEcho:5:Passed 35 | Done. 2 passed. 0 failed. 0 skipped. 36 | ``` 37 | 38 | The return code is equal to the amount of failed testcases. 39 | 40 | Options can be given to the test script: 41 | 42 | ```bash 43 | $ bash ./bashunit.bash 44 | Usage: [options...] 45 | 46 | Options: 47 | -v, --verbose Print exptected and provided values 48 | -s, --summary Only print summary omitting individual test results 49 | -q, --quiet Do not print anything to standard output 50 | -h, --help Show usage screen 51 | ``` 52 | 53 | ## Dependencies 54 | 55 | * Bash (`BASH_LINENO`) 56 | * Shell colours 57 | 58 | ## API 59 | 60 | * `assert($1)` 61 | 62 | `$1`: Expression 63 | 64 | Assert that a given expression evaluates to true. 65 | 66 | * `assertEqual($1, $2)` 67 | 68 | `$1`: Output 69 | 70 | `$2`: Expected 71 | 72 | Assert that a given output string is equal to an expected string. 73 | 74 | * `assertNotEqual($1, $2)` 75 | 76 | `$1`: Output 77 | 78 | `$2`: Expected 79 | 80 | Assert that a given output string is not equal to an expected string. 81 | 82 | * `assertStartsWith($1, $2)` 83 | 84 | `$1`: Output 85 | 86 | `$2`: Expected 87 | 88 | Assert that a given output string starts with an expected string. 89 | 90 | * `assertReturn($1, $2)` 91 | 92 | `$1`: Output 93 | 94 | `$2`: Expected 95 | 96 | `$?`: Provided 97 | 98 | Assert that the last command's return code is equal to an expected integer. 99 | 100 | * `assertNotReturn($1, $2)` 101 | 102 | `$1`: Output 103 | 104 | `$2`: Expected 105 | 106 | `$?`: Provided 107 | 108 | Assert that the last command's return code is not equal to an expected 109 | integer. 110 | 111 | * `assertGreaterThan($1, $2)` 112 | 113 | `$1` Output 114 | 115 | `$2` Expected 116 | 117 | Assert that a given integer is greater than an expected integer. 118 | 119 | * `assertAtLeast($1, $2)` 120 | 121 | `$1` Output 122 | 123 | `$2` Expected 124 | 125 | Assert that a given integer is greater than or equal to an expected integer. 126 | 127 | * `assertLessThan($1, $2)` 128 | 129 | `$1` Output 130 | 131 | `$2` Expected 132 | 133 | Assert that a given integer is less than an expected integer. 134 | 135 | * `assertAtMost($1, $2)` 136 | 137 | `$1` Output 138 | 139 | `$2` Expected 140 | 141 | Assert that a given integer is less than or equal to an expected integer. 142 | 143 | * `skip()` 144 | 145 | Skip the current test case. 146 | 147 | ## License 148 | 149 | `bashunit` is licenced under a 150 | [BSD License](https://github.com/djui/bashunit/blob/master/LICENSE). 151 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/bashunit/bashunit.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ######################################################################## 4 | # GLOBALS 5 | ######################################################################## 6 | 7 | verbose=2 8 | 9 | bashunit_passed=0 10 | bashunit_failed=0 11 | bashunit_skipped=0 12 | 13 | ######################################################################## 14 | # ASSERT FUNCTIONS 15 | ######################################################################## 16 | 17 | # Assert that a given expression evaluates to true. 18 | # 19 | # $1: Expression 20 | assert() { 21 | if test $* ; then _passed ; else _failed "$*" true ; fi 22 | } 23 | 24 | # Assert that a given output string is equal to an expected string. 25 | # 26 | # $1: Output 27 | # $2: Expected 28 | assertEqual() { 29 | echo $1 | grep -E "^$2$" > /dev/null 30 | if [ $? -eq 0 ] ; then _passed ; else _failed "$1" "$2" ; fi 31 | } 32 | 33 | # Assert that a given output string is not equal to an expected string. 34 | # 35 | # $1: Output 36 | # $2: Expected 37 | assertNotEqual() { 38 | echo $1 | grep -E "^$2$" > /dev/null 39 | if [ $? -ne 0 ] ; then _passed ; else _failed "$1" "$2" ; fi 40 | } 41 | 42 | # Assert that a given output string starts with an expected string. 43 | # 44 | # $1: Output 45 | # $2: Expected 46 | assertStartsWith() { 47 | echo $1 | grep -E "^$2" > /dev/null 48 | if [ $? -eq 0 ] ; then _passed ; else _failed "$1" "$2" ; fi 49 | } 50 | 51 | # Assert that the last command's return code is equal to an expected integer. 52 | # 53 | # $1: Output 54 | # $2: Expected 55 | # $?: Provided 56 | assertReturn() { 57 | local code=$? 58 | if [ $code -eq $2 ] ; then _passed ; else _failed "$code" "$2" ; fi 59 | } 60 | 61 | # Assert that the last command's return code is not equal to an expected integer. 62 | # 63 | # $1: Output 64 | # $2: Expected 65 | # $?: Provided 66 | assertNotReturn() { 67 | local code=$? 68 | if [ $code -ne $2 ] ; then _passed ; else _failed "$code" "$2" ; fi 69 | } 70 | 71 | # Assert that a given integer is greater than an expected integer. 72 | # 73 | # $1: Output 74 | # $2: Expected 75 | assertGreaterThan() { 76 | if [ $1 -gt $2 ] ; then _passed ; else _failed "$1" "$2" ; fi 77 | } 78 | 79 | # Assert that a given integer is greater than or equal to an expected integer. 80 | # 81 | # $1: Output 82 | # $2: Expected 83 | assertAtLeast() { 84 | if [ $1 -ge $2 ] ; then _passed ; else _failed "$1" "$2" ; fi 85 | } 86 | 87 | # Assert that a given integer is less than an expected integer. 88 | # 89 | # $1: Output 90 | # $2: Expected 91 | assertLessThan() { 92 | if [ $1 -lt $2 ] ; then _passed ; else _failed "$1" "$2" ; fi 93 | } 94 | 95 | # Assert that a given integer is less than or equal to an expected integer. 96 | # 97 | # $1: Output 98 | # $2: Expected 99 | assertAtMost() { 100 | if [ $1 -le $2 ] ; then _passed ; else _failed "$1" "$2" ; fi 101 | } 102 | 103 | # Skip the current test case. 104 | # 105 | skip() { 106 | _skipped 107 | } 108 | 109 | _failed() { 110 | bashunit_failed=$((bashunit_failed+1)) 111 | 112 | local tc=${FUNCNAME[2]} 113 | local line=${BASH_LINENO[1]} 114 | if [ $verbose -ge 2 ] ; then 115 | echo -e "\033[37;1m$tc\033[0m:$line:\033[31mFailed\033[0m" 116 | fi 117 | if [ $verbose -eq 3 ] ; then 118 | echo -e "\033[31mExpected\033[0m: $2" 119 | echo -e "\033[31mProvided\033[0m: $1" 120 | fi 121 | } 122 | 123 | _passed() { 124 | bashunit_passed=$((bashunit_passed+1)) 125 | 126 | local tc=${FUNCNAME[2]} 127 | local line=${BASH_LINENO[1]} 128 | if [ $verbose -ge 2 ] ; then 129 | echo -e "\033[37;1m$tc\033[0m:$line:\033[32mPassed\033[0m" 130 | fi 131 | } 132 | 133 | _skipped() { 134 | bashunit_skipped=$((bashunit_skipped+1)) 135 | 136 | local tc=${FUNCNAME[2]} 137 | local line=${BASH_LINENO[1]} 138 | if [ $verbose -ge 2 ] ; then 139 | echo -e "\033[37;1m$tc\033[0m:$line:\033[33mSkipped\033[0m" 140 | fi 141 | } 142 | 143 | ######################################################################## 144 | # RUN 145 | ######################################################################## 146 | 147 | usage() { 148 | echo "Usage: [options...]" 149 | echo 150 | echo "Options:" 151 | echo " -v, --verbose Print exptected and provided values" 152 | echo " -s, --summary Only print summary omitting individual test results" 153 | echo " -q, --quiet Do not print anything to standard output" 154 | echo " -h, --help Show usage screen" 155 | } 156 | 157 | runTests() { 158 | local test_pattern="test[a-zA-Z0-9_]\+" 159 | local testcases=$(grep "^ *\(function \)*$test_pattern *\\(\\)" $0 | \ 160 | grep -o $test_pattern) 161 | 162 | if [ ! "${testcases[*]}" ] ; then 163 | usage 164 | exit 0 165 | fi 166 | 167 | for tc in $testcases ; do $tc ; done 168 | 169 | if [ $verbose -ge 1 ] ; then 170 | echo "Done. $bashunit_passed passed." \ 171 | "$bashunit_failed failed." \ 172 | "$bashunit_skipped skipped." 173 | fi 174 | exit $bashunit_failed 175 | } 176 | 177 | # Arguments 178 | while [ $# -gt 0 ]; do 179 | arg=$1; shift 180 | case $arg in 181 | "-v"|"--verbose") verbose=3;; 182 | "-s"|"--summary") verbose=1;; 183 | "-q"|"--quiet") verbose=0;; 184 | "-h"|"--help") usage; exit 0;; 185 | *) shift;; 186 | esac 187 | done 188 | 189 | runTests 190 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/bashunit/test_example: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | testEcho() { 4 | assertEqual "$(echo foo)" "foo" 5 | assertReturn "$(echo foo)" 0 6 | } 7 | 8 | testTest() { 9 | assert "-e $0" 10 | } 11 | 12 | testArithmetic() { 13 | assertGreaterThan "$(( 1 + 1 ))" "1" 14 | assertAtLeast "$(( 1 + 1 ))" "2" 15 | assertLessThan "$(( 1 + 1 ))" "5" 16 | assertAtMost "$(( 1 + 1 ))" "2" 17 | } 18 | 19 | source $(dirname $0)/bashunit.bash 20 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/corrupttest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Test that corrupted archives actually fail validation 3 | 4 | SUT=$(realpath $(dirname $0)/../makeself.sh) 5 | SOURCE=$(realpath ..) 6 | 7 | setupTests() { 8 | temp=`mktemp -d -t appendtest.XXXXX` 9 | cd "$temp" 10 | mkdir archive 11 | cp -a $SOURCE archive/ 12 | $SUT $* archive makeself-test.run "Test $*" echo Testing --tar-extra="--exclude .git" 13 | } 14 | 15 | testExtraBytes() { 16 | setupTests --sha256 17 | 18 | ./makeself-test.run --check 19 | assertEqual $? 0 20 | 21 | echo "Adding a bunch of random characters at the end!!" >> makeself-test.run 22 | 23 | ./makeself-test.run --check 24 | assertNotEqual $? 0 25 | } 26 | 27 | testTruncated() { 28 | setupTests --sha256 29 | 30 | ./makeself-test.run --check 31 | assertEqual $? 0 32 | 33 | dd if=makeself-test.run of=truncated.run bs=1 count=34303 34 | bash truncated.run --check 35 | assertNotEqual $? 0 36 | } 37 | 38 | source bashunit/bashunit.bash 39 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/datetest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SUT=$(realpath $(dirname $0)/../makeself.sh) 4 | 5 | setupTests() { 6 | temp=`mktemp -d -t XXXXX` 7 | cd ${temp} 8 | mkdir src 9 | echo "echo This is a test" > src/startup.sh 10 | } 11 | 12 | # Default behaviour is to insert the current date in the 13 | # generated file. 14 | testCurrentDate() { 15 | setupTests 16 | 17 | ${SUT} src src.sh alabel startup.sh 18 | 19 | # Validate 20 | actual=`strings src.sh | grep packaging` 21 | 22 | expected=`LC_ALL=C date +"%b"` 23 | 24 | if [[ ${actual} == *${expected}* ]] 25 | then 26 | found=0 27 | else 28 | echo "Substring not found: ${expected} in ${actual}" 29 | found=1 30 | fi 31 | assertEqual 0 ${found} 32 | 33 | # Cleanup 34 | cd - 35 | rm -rf ${temp} 36 | } 37 | 38 | 39 | # A fixed packaging date can be inserted 40 | # into the generated package. This way 41 | # the package may be recreated from 42 | # source and remain byte-for-bye 43 | # identical. 44 | testDateSet() { 45 | setupTests 46 | 47 | expected='Sat Mar 5 19:35:21 EST 2016' 48 | 49 | # Exercise 50 | ${SUT} --packaging-date "${expected}" \ 51 | src src.sh alabel startup.sh 52 | 53 | # Validate 54 | actual=`strings src.sh | grep "Date of packaging"` 55 | echo "actual="${actual} 56 | if [[ ${actual} == *${expected}* ]] 57 | then 58 | echo date set found 59 | found=0 60 | else 61 | echo "Substring not found: ${expected} in ${actual}" 62 | found=1 63 | fi 64 | assertEqual 0 ${found} 65 | 66 | # Cleanup 67 | cd - 68 | rm -rf ${temp} 69 | } 70 | 71 | 72 | # Error if --packaging-date is passed as 73 | # an argument but the date is missing 74 | testPackagingDateNeedsParameter() { 75 | setupTests 76 | 77 | # Exercise 78 | ${SUT} --packaging-date \ 79 | src src.sh alabel startup.sh || true 80 | actual=`test -f src.sh` 81 | 82 | # Validate 83 | echo "actual="${actual} 84 | assertNotEqual 0 ${actual} 85 | 86 | # Cleanup 87 | cd - 88 | rm -rf ${temp} 89 | } 90 | 91 | # With the dates set we can get a byte for 92 | # byte identical package. 93 | testByteforbyte() 94 | { 95 | setupTests 96 | 97 | date='Sat Mar 3 19:35:21 EST 2016' 98 | 99 | # Exercise 100 | ${SUT} --packaging-date "${date}" --tar-extra "--mtime 20160303" \ 101 | src src.sh alabel startup.sh 102 | mv src.sh first 103 | ${SUT} --packaging-date "${date}" --tar-extra "--mtime 20160303" \ 104 | src src.sh alabel startup.sh 105 | mv src.sh second 106 | 107 | # Validate 108 | cmp first second 109 | rc=$? 110 | assert $rc 111 | 112 | # Cleanup 113 | cd - 114 | rm -rf ${temp} 115 | } 116 | 117 | source bashunit/bashunit.bash 118 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/extracttest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SUT=$(realpath $(dirname $0)/../makeself.sh) 4 | SOURCE=$(realpath ..) 5 | 6 | setupTests() { 7 | temp=`mktemp -d -t XXXXX` 8 | cd "$temp" 9 | mkdir archive 10 | cp -a $SOURCE archive/ 11 | $SUT $* archive makeself-test.run "Test $*" echo Testing 12 | } 13 | 14 | 15 | testQuiet() 16 | { 17 | setupTests 18 | 19 | ./makeself-test.run --quiet 20 | assertEqual $? 0 21 | } 22 | 23 | testGzip() 24 | { 25 | setupTests --gzip 26 | 27 | ./makeself-test.run --check 28 | assertEqual $? 0 29 | } 30 | 31 | testBzip2() 32 | { 33 | setupTests --bzip2 34 | 35 | ./makeself-test.run --check 36 | assertEqual $? 0 37 | } 38 | 39 | testPBzip2() 40 | { 41 | # Skip if pbzip2 is not available 42 | which pbzip2 || return 43 | setupTests --pbzip2 44 | 45 | ./makeself-test.run --check 46 | assertEqual $? 0 47 | } 48 | 49 | testZstd() 50 | { 51 | # Skip if zstd is not available 52 | which zstd || return 53 | setupTests --zstd 54 | 55 | ./makeself-test.run --check 56 | assertEqual $? 0 57 | } 58 | 59 | source bashunit/bashunit.bash 60 | 61 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/infotest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # makeself/test/infotest 4 | 5 | THIS="$(realpath "$0")" 6 | HERE="$(dirname "${THIS}")" 7 | SRCDIR="$(dirname "${HERE}")" 8 | VERSION="$(xargs printf '%s' <"${SRCDIR}/VERSION")" 9 | 10 | ################################################################################ 11 | 12 | # Take makeself options, generate a predefined archive, print --info to stdout. 13 | # 14 | # $@ : makeself options 15 | haveInfo() ( 16 | cd "${SRCDIR}" || return 1 17 | mkdir -p infotest 18 | ./makeself.sh "$@" ./infotest ./infotest.run infotest ls -lah >/dev/null 2>&1 19 | assertEqual "$?" 0 >&2 20 | ./infotest.run --info 21 | assertEqual "$?" 0 >&2 22 | rm -rf infotest infotest.run 23 | ) 24 | 25 | # Read want.info from stdin. Generate have.info using given options. Invoke 26 | # diff want.info have.info and return its exit status 27 | # 28 | # $@ : makeself options 29 | diffInfo() { 30 | local rc="" 31 | cd "$(mktemp -d)" || return 1 32 | cat >want.info 33 | haveInfo "$@" >have.info 34 | if diff want.info have.info >&2; then 35 | rc="$?" 36 | else 37 | rc="$?" 38 | fi 39 | rm -f have.info want.info 40 | return "${rc}" 41 | } 42 | 43 | testDefault() ( 44 | cd "$(mktemp -d)" || return 1 45 | diffInfo --packaging-date "@0" < src/startup.sh 10 | } 11 | 12 | tearDown() { 13 | popd 14 | rm -rf "${temp}" 15 | } 16 | 17 | testTarExtraOpts() { 18 | setupTests 19 | 20 | tar_extra="--verbose --exclude .git" 21 | ${SUT} --tar-extra "$tar_extra" src src.sh alabel startup.sh 22 | 23 | assertEqual $? 0 24 | 25 | tearDown 26 | } 27 | 28 | source bashunit/bashunit.bash 29 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/variabletest: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | SUT=$(realpath $(dirname $0)/../makeself.sh) 4 | SOURCE=$(realpath ..) 5 | 6 | setupTests() { 7 | temp=`mktemp -d -t XXXXX` 8 | cd "$temp" 9 | mkdir archive 10 | touch archive/file 11 | 12 | # $SUT archive makeself-test.run "Test $1" declare -p "${1}" 13 | $SUT archive makeself-test.run "Test $1" echo \\\"\${${1}}\\\" 14 | } 15 | 16 | testArchiveDir() 17 | { 18 | setupTests ARCHIVE_DIR 19 | local ans=$'./complicated\n dir\twith spaces' 20 | mkdir "${ans}" 21 | mv ./makeself-test.run "${ans}/" 22 | actual_archive_dir="$("${ans}/makeself-test.run" --quiet)" 23 | 24 | assertEqual "${actual_archive_dir}" "${ans}" 25 | } 26 | 27 | testTmpRoot() 28 | { 29 | setupTests TMPROOT 30 | local ans="${temp}"$'/complicated\n dir\twith spaces' 31 | mkdir -p "${ans}" 32 | 33 | actual_tmp_root="$(TMPDIR="${ans}" "./makeself-test.run" --quiet)" 34 | 35 | assertEqual "${actual_tmp_root}" "${ans}" 36 | } 37 | 38 | testUserPWD() 39 | { 40 | setupTests USER_PWD 41 | local ans="${temp}"$'/complicated\n dir\twith spaces' 42 | mkdir -p "${ans}" 43 | cd "${ans}" 44 | 45 | actual_user_pwd="$("${temp}/makeself-test.run" --quiet)" 46 | 47 | assertEqual "${actual_user_pwd}" "${ans}" 48 | } 49 | 50 | 51 | source bashunit/bashunit.bash 52 | -------------------------------------------------------------------------------- /makeself-2.4.5/test/whitespacelicensetest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | THIS="$(realpath "$0")" 4 | HERE="$(dirname "${THIS}")" 5 | SUT="$(dirname "${HERE}")/makeself.sh" 6 | 7 | testWhiteSpaceLicense() { 8 | # for each license file: its canonical path is identical to its content 9 | local license_dir="$(mktemp -dt license_dir.XXXXXX)" 10 | ( 11 | cd "${license_dir}" 12 | cat >"$(printf "_\x09_character_tabulation.txt")" <"$(printf "_\x0b_line_tabulation.txt")" <"$(printf "_\x0c_form_feed.txt")"<"$(printf "_\x0d_carriage_return.txt")"<"$(printf "_\x20_space.txt")"< $outfile 9 | 10 | COUNTER=0 11 | 12 | for X in $(cut -f6 -d ':' /etc/passwd |sort |uniq); 13 | do 14 | if [ -s "${X}/.gitconfig" ]; then 15 | mkdir -p $outputpath${X} 16 | cp ${X}/.gitconfig $outputpath${X}/gitconfig 17 | tmp=$(jq '.gitconfig += [{"File": "'${X}'/.gitconfig","data" : []}]' $outfile) && echo $tmp > $outfile 18 | 19 | while read line 20 | do 21 | if [ ! -z "$line" ]; then 22 | tmp=$(jq --arg counter $COUNTER --arg line "$line" '.gitconfig['$counter'].data += [$line]' $outfile) && echo -E $tmp > $outfile 23 | fi 24 | done < $outputpath$X/gitconfig 25 | 26 | ((COUNTER++)) 27 | fi 28 | done 29 | 30 | -------------------------------------------------------------------------------- /scripts/c_ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | outputpath="$OUTPUT/Ssh" 4 | outfile="$outputpath/ssh_config.json" 5 | 6 | mkdir $outputpath 7 | 8 | echo '{ "ssh": [],"metadata": { "CaseNumber": "'$caseNumber'", "Description" : "'$desc'", "Username": "'$user'", "Hostname": "'$host'"}}' > $outfile 9 | 10 | COUNTER=0 11 | 12 | for X in $(cut -f6 -d ':' /etc/passwd |sort |uniq); 13 | do 14 | if [ -s "${X}/.ssh/authorized_keys" ]; then 15 | mkdir -p $outputpath${X} 16 | cp ${X}/.ssh/authorized_keys $outputpath${X}/authorized_keys 17 | tmp=$(jq '.ssh += [{"File": "'${X}'/.ssh/authorized_keys","authorized_keys" : []}]' $outfile) && echo $tmp > $outfile 18 | while read line 19 | do 20 | if [ ! -z "$line" ]; then 21 | tmp=$(jq --arg line "$line" '.ssh['${COUNTER}'].authorized_keys += [$line]' $outfile) && echo -E $tmp > $outfile 22 | fi 23 | done < $outputpath$X/authorized_keys 24 | ((COUNTER++)) 25 | fi 26 | if [ -s "${X}/.ssh/known_hosts" ]; then 27 | mkdir -p $outputpath${X} 28 | cp ${X}/.ssh/known_hosts $outputpath${X}/known_hosts 29 | tmp=$(jq '.ssh += [{"File": "'${X}'/.ssh/known_hosts","known_hosts" : []}]' $outfile) && echo $tmp > $outfile 30 | while read line 31 | do 32 | if [ ! -z "$line" ]; then 33 | tmp=$(jq --arg line "$line" '.ssh['${COUNTER}'].known_hosts += [$line]' $outfile) && echo -E $tmp > $outfile 34 | fi 35 | done < $outputpath$X/known_hosts 36 | ((COUNTER++)) 37 | 38 | fi 39 | done 40 | -------------------------------------------------------------------------------- /scripts/chromium.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | ############################## 5 | # CHROME/CHROMIUM ARTEFACTS 6 | ############################## 7 | 8 | #search Account with Chromium Profile 9 | browser="chromium" 10 | homepaths=$(find /home \( -name "chromium" \)| awk -F"/" '{print "/"$2"/"$3"/"}'| uniq) 11 | chromiumfiles=( "addons.json" "containers.json" ) 12 | if [[ -n $homepaths ]]; then 13 | for homepath in $homepaths; do 14 | username=$(echo $homepath | cut -d"/" -f3) 15 | #output_path="OUTPUT/Browser/${username}/Chromium" 16 | output_path="${OUTPUT}/Browser/${username}/Chromium" 17 | for file in "${chromiumfiles[@]}"; do 18 | mkdir -p $output_path && find $homepath -type f -name "$file" -exec cp {} "$output_path" \; 19 | done 20 | 21 | 22 | #HISTORY 23 | filepath=$(find $homepath -name History | grep $browser) 24 | #If Sqlite files exists 25 | if [[ -n $filepath ]]; then 26 | gethistory=$(./tools/sqlite3 --json ${filepath} "SELECT urls.url, urls.title, urls.visit_count, urls.typed_count, datetime(urls.last_visit_time/1e6-11644473600,'unixepoch','utc') AS lastvisit, urls.hidden, datetime(visits.visit_time/1e6-11644473600,'unixepoch','utc') AS visit_time , visits.from_visit, visits.transition FROM urls, visits WHERE urls.id = visits.url") 27 | if [[ -n $gethistory ]]; then 28 | echo "{\"Chromium History\": " >> $output_path/history.json 29 | echo "{\"File\": \"$filepath\", \"Data\": $gethistory}," >> $output_path/history.json 30 | tmp_history=$(sed '$ s/.$//' $output_path/history.json) 31 | echo "$tmp_history,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/history.json 32 | fi 33 | 34 | getdownloads=$(./tools/sqlite3 --json ${filepath} "Select current_path, target_path, datetime(start_time/1e6-11644473600,'unixepoch','utc') AS start_time, received_bytes, total_bytes, state, danger_type, interrupt_reason, hash, datetime(end_time/1e6-11644473600,'unixepoch','utc') AS end_time, opened, datetime(last_access_time/1e6-11644473600,'unixepoch','utc') AS last_access_time, transient, referrer, site_url, tab_url, tab_referrer_url, http_method,by_ext_id, by_ext_name, etag, last_modified, mime_type, original_mime_type FROM downloads") 35 | if [[ -n $getdownloads ]]; then 36 | echo "{\"Chromium Downloads\": " >> $output_path/downloads.json 37 | echo "{\"File\": \"$filepath\", \"Data\": $getdownloads}," >> $output_path/downloads.json 38 | tmp_downloads=$(sed '$ s/.$//' $output_path/downloads.json) 39 | echo "$tmp_downloads,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/downloads.json 40 | fi 41 | fi 42 | 43 | 44 | #Cookies 45 | filepath=$(find $homepath -name Cookies | grep $browser) 46 | #If Sqlite files exists 47 | if [[ -n $filepath ]]; then 48 | 49 | getcookies=$(./tools/sqlite3 --json ${filepath} "SELECT datetime(creation_utc/1e6-11644473600,'unixepoch','utc') AS creation_utc, host_key, top_frame_site_key, name, value, encrypted_value, path, datetime(expires_utc/1e6-11644473600,'unixepoch','utc') AS expires_utc, is_secure, is_httponly, datetime(last_access_utc/1e6-11644473600,'unixepoch','utc') AS last_access_utc, has_expires, is_persistent, priority, samesite, source_scheme, source_port, is_same_party FROM cookies") 50 | if [[ -n $getcookies ]]; then 51 | echo "{\"Chromium Cookies\": " >> $output_path/cookies.json 52 | echo "{\"File\": \"$filepath\", \"Data\": $getcookies}," >> $output_path/cookies.json 53 | tmp_history=$(sed '$ s/.$//' $output_path/cookies.json) 54 | echo "$tmp_history,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/cookies.json 55 | fi 56 | fi 57 | 58 | done 59 | fi 60 | 61 | -------------------------------------------------------------------------------- /scripts/command_history.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | outputpath="$OUTPUT/History" 4 | outfile="$outputpath/commands_history.json" 5 | historyfiles=( ".bash_history" ".zsh_history") 6 | mkdir $outputpath 7 | 8 | echo '{ "command_history": [],"metadata": { "CaseNumber": "'$caseNumber'", "Description" : "'$desc'", "Username": "'$user'", "Hostname": "'$host'"}}' > $outfile 9 | 10 | COUNTER=0 11 | for X in $(cut -f6 -d ':' /etc/passwd |sort |uniq); 12 | do 13 | #bash_history 14 | if [ -s "${X}/.bash_history" ] ; then 15 | mkdir -p $outputpath${X} 16 | cp ${X}/.bash_history $outputpath${X}/bash_history 17 | tmp=$(jq '.command_history += [{"File": "'${X}'/.bash_history","Commands" : []}]' $outfile) && echo $tmp > $outfile 18 | 19 | while read line 20 | do 21 | if [ ! -z "$line" ]; then 22 | tmp=$(jq --arg counter $COUNTER --arg line "$line" '.command_history['$counter'].Commands += [$line]' $outfile) && echo -E $tmp > $outfile 23 | fi 24 | done < $outputpath$X/bash_history 25 | 26 | ((COUNTER++)) 27 | fi 28 | done 29 | 30 | 31 | 32 | #Delete non printable caracters, escape special caracters 33 | #sed 's/[^[:print:]]//g' $outputpath$X/bash_history > $outputpath$X/tmp_bash_history 34 | 35 | #while read line 36 | #do 37 | # if [ ! -z "$line" ]; then 38 | # #echo $line 39 | # cmd=$($line | sed 's/[^[:print:]]//g;s/\\/\\\\/g;s/\"/\\"/g') 40 | # #echo $cmd 41 | # echo \"${line//\"/\\\"}\", 42 | # echo "====" 43 | # fi 44 | # done < $outputpath$X/tmp_bash_history 45 | 46 | 47 | 48 | #tmp_history=$(sed '$ s/.$//' $outfile) 49 | #echo $tmp_history > $outfile 50 | #echo "]}," >> $outfile 51 | #rm -f $outputpath$X/tmp_bash_history 52 | #fi 53 | #done 54 | -------------------------------------------------------------------------------- /scripts/firefox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################### 4 | # Firefox artefacts # 5 | ######################### 6 | 7 | #search Account with Firefox Profile 8 | homepaths=$(find /home -name firefox | cut -d"." -f1 | uniq) 9 | firefoxfiles=( "addons.json" "containers.json" "times.json" "handlers.json" "extensions.json" ) 10 | if [[ -n $homepaths ]]; then 11 | for homepath in $homepaths; do 12 | 13 | username=$(echo $homepath | cut -d"/" -f3) 14 | #output_path="OUTPUT/Browser/${username}/Firefox" 15 | output_path="${OUTPUT}/Browser/${username}/Firefox" 16 | for file in "${firefoxfiles[@]}"; do 17 | mkdir -p $output_path && find $homepath -type f -name "$file" -exec cp {} "$output_path" \; 18 | 19 | done 20 | 21 | #Search for places.sqlite file 22 | filepath=$(find $homepath -name places.sqlite) 23 | 24 | #If Sqlite files exists 25 | if [[ -n $filepath ]]; then 26 | 27 | # History 28 | 29 | gethistory=$(./tools/sqlite3 --json ${filepath} "SELECT datetime(moz_historyvisits.visit_date/1000000,'unixepoch') AS Date, moz_places.url AS URL, moz_places.title AS Title FROM moz_places, moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id") 30 | if [[ -n $gethistory ]]; then 31 | echo "{\"Firefox History\": " >> $output_path/history.json 32 | echo "{\"File\": \"$filepath\", \"Data\": $gethistory}," >> $output_path/history.json 33 | tmp_history=$(sed '$ s/.$//' $output_path/history.json) 34 | echo "$tmp_history,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/history.json 35 | fi 36 | # Downloads 37 | 38 | getdownloads=$(./tools/sqlite3 --json ${filepath} "SELECT datetime(lastModified/1000000,'unixepoch') AS Date, content as File, url as URL FROM moz_places, moz_annos WHERE moz_places.id = moz_annos.place_id;") 39 | if [[ -n $getdownloads ]]; then 40 | echo "{\"Firefox Downloads\": " >> $output_path/downloads.json 41 | echo "{\"File\": \"$filepath\", \"Data\": $getdownloads}," >> $output_path/downloads.json 42 | tmp_downloads=$(sed '$ s/.$//' $output_path/downloads.json) 43 | echo "$tmp_downloads,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/downloads.json 44 | fi 45 | fi 46 | #Cookies 47 | filepath=$(find $homepath -name cookies.sqlite) 48 | if [[ -n $filepath ]]; then 49 | getcookies=$(./tools/sqlite3 --json ${filepath} "SELECT datetime(lastAccessed/1000000,'unixepoch') AS lastAccessed, datetime(creationTime/1000000,'unixepoch') AS creationTime, name,value,host,path,expiry,isSecure,isHttpOnly,inBrowserElement,sameSite,rawSameSite schemeMap from moz_cookies;") 50 | if [[ -n $getcookies ]]; then 51 | echo "{\"Firefox Cookies\": " >> $output_path/cookies.json 52 | echo "{\"File\": \"$filepath\", \"Data\": $getcookies}," >> $output_path/cookies.json 53 | tmp_cookies=$(sed '$ s/.$//' $output_path/cookies.json) 54 | echo "$tmp_cookies,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/cookies.json 55 | fi 56 | fi 57 | 58 | #Form History 59 | filepath=$(find $homepath -name formhistory.sqlite) 60 | if [[ -n $filepath ]]; then 61 | gettables=$(./tools/sqlite3 --json ${filepath} .tables) 62 | #if [[ echo "$gettables" |grep "moz_sources" ]]; then 63 | if grep -sq 'moz_sources' <<< "$gettables"; then 64 | getformhistory=$(./tools/sqlite3 --json ${filepath} "Select fieldname,value,history_id,source,datetime(firstUsed/1000000,'unixepoch','localtime' ) as 'firstUsed',datetime(lastUsed/1000000,'unixepoch','localtime' ) as 'lastUsed',timesUsed,guid from moz_sources LEFT JOIN moz_history_to_sources ON moz_history_to_sources.source_id = moz_sources.id LEFT JOIN moz_formhistory ON moz_history_to_sources.history_id = moz_formhistory.id;") 65 | else 66 | getformhistory=$(./tools/sqlite3 --json ${filepath} "Select fieldname,value,datetime(firstUsed/1000000,'unixepoch','localtime' ) as 'firstUsed',datetime(lastUsed/1000000,'unixepoch','localtime' ) as 'lastUsed',timesUsed,guid from moz_formhistory;") 67 | fi 68 | if [[ -n $getformhistory ]]; then 69 | echo "{\"Firefox FormHistory\": " >> $output_path/formhistory.json 70 | echo "{\"File\": \"$filepath\", \"Data\": $getformhistory}," >> $output_path/formhistory.json 71 | tmp_formhistory=$(sed '$ s/.$//' $output_path/formhistory.json) 72 | echo "$tmp_formhistory,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/formhistory.json 73 | fi 74 | fi 75 | 76 | #Permissions 77 | filepath=$(find $homepath -name permissions.sqlite) 78 | if [[ -n $filepath ]]; then 79 | getpermissions=$(./tools/sqlite3 --json ${filepath} "Select origin,type,permission,expireType,dateTime(expireTime/1000000,'unixepoch','localtime') as 'Last' from moz_perms") 80 | if [[ -n $getpermissions ]]; then 81 | echo "{\"Firefox Permissions\": " >> $output_path/permissions.json 82 | echo "{\"File\": \"$filepath\", \"Data\": $getpermissions}," >> $output_path/permissions.json 83 | tmp_permissions=$(sed '$ s/.$//' $output_path/permissions.json) 84 | echo "$tmp_permissions,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/permissions.json 85 | fi 86 | fi 87 | 88 | 89 | #WebAppStore 90 | filepath=$(find $homepath -name webappsstore.sqlite) 91 | if [[ -n $filepath ]]; then 92 | getwebappsstore=$(./tools/sqlite3 --json ${filepath} "Select * from webappsstore2") 93 | if [[ -n $getpermissions ]]; then 94 | echo "{\"Firefox Webappsstore\": " >> $output_path/webappsstore.json 95 | echo "{\"File\": \"$filepath\", \"Data\": $getwebappsstore}," >> $output_path/webappsstore.json 96 | tmp_webappsstore=$(sed '$ s/.$//' $output_path/webappsstore.json) 97 | echo "$tmp_webappsstore,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/webappsstore.json 98 | fi 99 | fi 100 | done 101 | fi 102 | 103 | -------------------------------------------------------------------------------- /scripts/frequent_apps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Frequent App Data 4 | 5 | outfile="$OUTPUT/frequent_app.json" 6 | echo "{\"frequent apps\": [" >> $outfile 7 | for X in $(cut -f6 -d ':' /etc/passwd |sort |uniq); do 8 | # GNOME Desktop 9 | 10 | if [ -f "${X}/.local/share/gnome-shell/application_state" ]; then 11 | echo "{\"User\": \"${X}\", \"apps\": [" >> $outfile 12 | while read line 13 | do 14 | if [[ "$line" == *"application id"* ]]; then 15 | app=$(echo $line | awk -F' ' '{print $2}'| cut -d"=" -f2) 16 | score=$(echo $line | awk -F' ' '{print $3}' | cut -d"=" -f2) 17 | last_seen=$(echo $line | awk -F' ' '{print $4}'| cut -d"=" -f2 | cut -d"\"" -f2) 18 | last_executed_date=$(date -d @$last_seen) 19 | echo "{\"app\": $app, \"score\" : $score, \"last executed\": \"$last_executed_date\"}," >> $outfile 20 | fi 21 | 22 | done < "${X}/.local/share/gnome-shell/application_state" 23 | # Delete last comma 24 | tmp=$(sed '$ s/.$//' $outfile) 25 | echo $tmp > $outfile 26 | echo "]}," >> $outfile 27 | fi 28 | done 29 | tmp=$(sed '$ s/.$//' $outfile) 30 | echo "$tmp],\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $outfile 31 | -------------------------------------------------------------------------------- /scripts/google-chrome.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | ############################## 5 | # CHROME/CHROMIUM ARTEFACTS 6 | ############################## 7 | 8 | #search Account with Chrome Profile 9 | browser="google-chrome" 10 | homepaths=$(find /home \( -name "google-chrome" \)| awk -F"/" '{print "/"$2"/"$3"/"}'| uniq) 11 | 12 | chromefiles=( "addons.json" "containers.json" ) 13 | if [[ -n $homepaths ]]; then 14 | for homepath in $homepaths; do 15 | username=$(echo $homepath | cut -d"/" -f3) 16 | #output_path="OUTPUT/Browser/${username}/Google-Chrome" 17 | output_path="${OUTPUT}/Browser/${username}/Google-Chrome" 18 | for file in "${chromefiles[@]}"; do 19 | mkdir -p $output_path && find $homepath -type f -name "$file" -exec cp {} "$output_path" \; 20 | 21 | done 22 | 23 | 24 | #HISTORY 25 | filepath=$(find $homepath -name History | grep $browser) 26 | #If Sqlite files exists 27 | if [[ -n $filepath ]]; then 28 | gethistory=$(./tools/sqlite3 --json ${filepath} "SELECT urls.url, urls.title, urls.visit_count, urls.typed_count, datetime(urls.last_visit_time/1e6-11644473600,'unixepoch','utc') AS lastvisit, urls.hidden, datetime(visits.visit_time/1e6-11644473600,'unixepoch','utc') AS visit_time , visits.from_visit, visits.transition FROM urls, visits WHERE urls.id = visits.url") 29 | if [[ -n $gethistory ]]; then 30 | echo "{\"Chrome History\": " >> $output_path/history.json 31 | echo "{\"File\": \"$filepath\", \"Data\": $gethistory}," >> $output_path/history.json 32 | tmp_history=$(sed '$ s/.$//' $output_path/history.json) 33 | echo "$tmp_history,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/history.json 34 | fi 35 | 36 | getdownloads=$(./tools/sqlite3 --json ${filepath} "Select current_path, target_path, datetime(start_time/1e6-11644473600,'unixepoch','utc') AS start_time, received_bytes, total_bytes, state, danger_type, interrupt_reason, hash, datetime(end_time/1e6-11644473600,'unixepoch','utc') AS end_time, opened, datetime(last_access_time/1e6-11644473600,'unixepoch','utc') AS last_access_time, transient, referrer, site_url, tab_url, tab_referrer_url, http_method,by_ext_id, by_ext_name, etag, last_modified, mime_type, original_mime_type FROM downloads") 37 | if [[ -n $getdownloads ]]; then 38 | echo "{\"Chrome Downloads\": " >> $output_path/downloads.json 39 | echo "{\"File\": \"$filepath\", \"Data\": $getdownloads}," >> $output_path/downloads.json 40 | tmp_downloads=$(sed '$ s/.$//' $output_path/downloads.json) 41 | echo "$tmp_downloads,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/downloads.json 42 | fi 43 | fi 44 | 45 | 46 | #Cookies 47 | filepath=$(find $homepath -name Cookies | grep $browser) 48 | #If Sqlite files exists 49 | if [[ -n $filepath ]]; then 50 | 51 | getcookies=$(./tools/sqlite3 --json ${filepath} "SELECT datetime(creation_utc/1e6-11644473600,'unixepoch','utc') AS creation_utc, host_key, top_frame_site_key, name, value, encrypted_value, path, datetime(expires_utc/1e6-11644473600,'unixepoch','utc') AS expires_utc, is_secure, is_httponly, datetime(last_access_utc/1e6-11644473600,'unixepoch','utc') AS last_access_utc, has_expires, is_persistent, priority, samesite, source_scheme, source_port, is_same_party FROM cookies") 52 | if [[ -n $getcookies ]]; then 53 | echo "{\"Chrome Cookies\": " >> $output_path/cookies.json 54 | echo "{\"File\": \"$filepath\", \"Data\": $getcookies}," >> $output_path/cookies.json 55 | tmp_history=$(sed '$ s/.$//' $output_path/cookies.json) 56 | echo "$tmp_history,\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $output_path/cookies.json 57 | fi 58 | fi 59 | 60 | done 61 | fi 62 | -------------------------------------------------------------------------------- /scripts/trash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # Trash 5 | 6 | outputpath="$OUTPUT/Trash" 7 | outfile=$outputpath/trash_files.json 8 | mkdir -p $outputpath 9 | echo "{\"Trash files\": [" >> $outfile 10 | 11 | for X in $(cut -f6 -d ':' /etc/passwd |sort |uniq); do 12 | if [ -d "${X}/.local/share/Trash" ]; then 13 | trash_files=$(find ${X}/.local/share/Trash/info/*.trashinfo) 14 | if [[ -n $trash_files ]]; then 15 | mkdir -p $outputpath${X} 16 | for file in $trash_files; do 17 | # Get trash file 18 | cp $file $outputpath${X} 19 | 20 | # Export file to json 21 | file_path=$(more $file | grep "Path" | cut -f2 -d "=") 22 | deletion_date=$(more $file | grep "DeletionDate" | cut -f2 -d "=") 23 | echo "{\"Path\": \"$file_path\"," >> $outfile 24 | echo "\"Deletion Date\": \"$deletion_date\" },">> $outfile 25 | done 26 | fi 27 | fi 28 | done 29 | tmp_trash=$(sed '$ s/.$//' $outfile) 30 | echo "$tmp_trash],\"metadata\": { \"Case Number\": \"$caseNumber\", \"Description\" : \"$desc\", \"Username\": \"$user\", \"Hostname\": \"$host\" }}" > $outfile 31 | -------------------------------------------------------------------------------- /scripts/vim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | for X in $(cut -f6 -d ':' /etc/passwd |sort |uniq); do 5 | if [ -s "${X}/.viminfo" ]; then 6 | mkdir -p $OUTPUT/Vim${X} 7 | cp ${X}/.viminfo $OUTPUT/Vim${X}/viminfo 8 | fi 9 | done 10 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | unzip busybox-1_34_1.zip 2>/dev/null 4 | if [ "$?" -eq 127 ]; then 5 | echo "unzip is not found, exiting!" 6 | exit 0 7 | fi 8 | chmod -Rf +x makeself-2.4.5/ 9 | sudo make 10 | -------------------------------------------------------------------------------- /tools/avml-minimal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xophidia/DFIR_Linux_Collector/a544d6fef15940a880862ebad2120f84b3390b25/tools/avml-minimal -------------------------------------------------------------------------------- /tools/sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xophidia/DFIR_Linux_Collector/a544d6fef15940a880862ebad2120f84b3390b25/tools/sqlite3 --------------------------------------------------------------------------------