Merge branch 'master' of vcs.neumannsland.de:casualscripter/shell-scripting

This commit is contained in:
Patrick Neumann 2019-04-22 23:25:56 +02:00
commit 5fbe032cdb
5 changed files with 199 additions and 7 deletions

View File

@ -0,0 +1,101 @@
#!/usr/bin/env bash
# Usage: ./generate_compressed_files
# or
# bash generate_compressed_files
# Description: (see scriptname!)
# Author: Patrick Neumann (patrick@neumannsland.de)
# Version: 1.0
# Date: 13.02.2019
# License: GPL3
# Warranty: This program is distributed WITHOUT ANY WARRANTY
# Todo: -
# Notwendige Pakete
DEBS="gzip"
DEBS="${DEBS} bzip2"
DEBS="${DEBS} xz-utils"
DEBS="${DEBS} lzop"
DEBS="${DEBS} zip"
DEBS="${DEBS} unzip"
DEBS="${DEBS} rar"
DEBS="${DEBS} unrar"
DEBS="${DEBS} p7zip-full"
echo "Checking dependencies..."
for deb in ${DEBS} ; do
if ! dpkg -s "${deb}" 2>&1 >/dev/null ; then
sudo apt install "${deb}" --assume-yes
fi
done
# Zielverzeichnis
DIRECTORY="compressed_files"
FILE="file.txt"
echo "Creating target directory..."
mkdir "${DIRECTORY}"
cd "${DIRECTORY}"
# Testdatei
echo "Generating text file..."
cat <<EOF > "${FILE}"
Eins
eins zwei
zWei
zwei drei
drEi
drei vier
vieR
vier eins
EOF
# .txt -> .txt.gz
echo "Generating .gz file..."
gzip --keep "${FILE}"
# Datei mit falscher Dateinamenserweiterung
echo "Generating file with wrong extension..."
cp "${FILE}".gz wrong_extension.txt.bz2
# .txt -> .txt.bz2
echo "Generating .bz2 file..."
bzip2 --keep "${FILE}"
# .txt -> .txt.xz
echo "Generating .xz file..."
xz --keep "${FILE}"
# .txt -> .txt.lzma
echo "Generating .lzma file..."
xz --keep --format=lzma "${FILE}"
# .txt -> .txt.lzop
echo "Generating .lzop file..."
lzop --keep "${FILE}"
# .txt -> .txt.zip
echo "Generating .zip file..."
zip --quiet "${FILE}".zip "${FILE}"
# .txt -> .txt.rar
echo "Generating .rar file..."
rar a -inul "${FILE}".rar "${FILE}"
# .txt -> .txt.7z
echo "Generating .7z file..."
7z a "${FILE}".7z "${FILE}" >/dev/null
# .txt -> .txt.lzma2
echo "Generating .lzma2 file..."
7z a -m0=lzma2 "${FILE}".lzma2 "${FILE}" >/dev/null
# symbolic link
echo "Generating symbolic link..."
ln -s "${FILE}" "./symlink"
echo "Generating directory..."
# directory
mkdir "./directory"
echo "Done."
exit 0

View File

@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Usage: ./generate_files_with_problematic_names
# or
# bash generate_files_with_problematic_names
# Description: (see scriptname!)
# Author: Patrick Neumann (patrick@neumannsland.de)
# Version: 1.0
# Date: 27.02.2018
# License: GPL3
# Warranty: This program is distributed WITHOUT ANY WARRANTY
# Todo: Find and add more problems in filenames!?
# Possible candidates: < > , ; = [ ] " / | \
# Zielverzeichnis
FWPN="files_with_problematic_names"
echo "Creating target directory..."
mkdir "${FWPN}"
cd "${FWPN}"
# fwpn = f(iles)w(ith)p(roblematic)n(ames)
# meier, meyer, mayer are mayr similar lastnames
# regular file
echo "Creating regular file..."
echo "fwpn:word:meier" > word.txt
# regular file
echo "Creating file with underscore..."
echo "fwpn:underscore:meyer" > underscore_instead_of_space.txt
# hidden file
echo "Creating hidden file..."
echo "fwpn:hidden:mayer" > .hidden.txt
# leading ..
echo "Creating file with two leading dots..."
echo "fwpn:two dots:mayr" > ..two_dots.txt
# leading ...
echo "Creating file with three leading dots..."
echo "fwpn:three dots:meier" > ...three_dots.txt
# leading hyphen (-)
echo "Creating file with leading hyphen..."
echo "fwpn:leading hyphen:meyer" > ./-leading_hyphen.txt
# star (*)
echo "Creating file with star..."
echo "fwpn:with star:mayer" > with_*.txt
# backslash (\)
echo "Creating file with backslash..."
echo "fwpn:with backslash:mayr" > "with_\.txt"
# (leading) blank
echo "Creating file with leading blank..."
echo "fwpn:blank at the beginning:meier" > " blank.txt"
# blank (separator)
echo "Creating file with blank..."
echo "fwpn:blank as separator:meyer" > "blank as separator.txt"
# newline
echo "Creating file with newline..."
echo "fwpn:newline as separator:mayer" > "newline_as
separator.txt"
# tabulator
echo "Creating file with tablulator..."
echo "fwpn:tabulator as separator:mayr" > tab_as$'\t'separator.txt
# questionmark (?)
echo "Creating file with questionmark..."
echo "fwpn:with questionmark:meier" > "with_?.txt"
# colon (:)
echo "Creating file with colon..."
echo "fwpn:colon:meyer" > with_:.txt
exit 0

View File

@ -9,6 +9,8 @@
# Platform: Kali Linux (tested: 2018.2) # Platform: Kali Linux (tested: 2018.2)
# Version: 1.0 # Version: 1.0
# Date: 24.08.2018 # Date: 24.08.2018
# Link:
# https://vcs.neumannsland.de/casualscripter/shell-scripting/src/branch/master/kali/airodump-script
# License: GPL3 # License: GPL3
# Warranty: This program is distributed WITHOUT ANY WARRANTY # Warranty: This program is distributed WITHOUT ANY WARRANTY

View File

@ -6,10 +6,12 @@
# Description: Writes a kali.iso to an usb stick (optional) and # Description: Writes a kali.iso to an usb stick (optional) and
# adds persistence to it step by step. # adds persistence to it step by step.
# Author: Patrick Neumann (patrick@neumannsland.de) # Author: Patrick Neumann (patrick@neumannsland.de)
# Platform: Kali Linux (tested: 2018.2) or # Platform: Kali Linux (tested: 2018.4) or
# Debian GNU/Linux (tested: 9.5) # Debian GNU/Linux (tested: 9.5)
# Version: 1.0 # Version: 1.01
# Date: 24.08.2018 # Date: 30.01.2019
# Link:
# https://vcs.neumannsland.de/casualscripter/shell-scripting/src/branch/master/kali/make_kali-usb-stick_persistent
# License: GPL3 # License: GPL3
# Warranty: This program is distributed WITHOUT ANY WARRANTY # Warranty: This program is distributed WITHOUT ANY WARRANTY
@ -64,7 +66,7 @@ if blkid "${USBSTICK}"3 | grep -F persistence &> /dev/null ; then
fi fi
# add 3rd partition to the end of the usb stick # add 3rd partition to the end of the usb stick
FREE="$( parted -m /dev/sdd print free | grep -F free | tail -n 1 )" FREE="$( parted -m "${USBSTICK}" print free | grep -F free | tail -n 1 )"
START="$( printf "${FREE}" | awk -F ":" '{ print $2; }' )" START="$( printf "${FREE}" | awk -F ":" '{ print $2; }' )"
END="$( printf "${FREE}" | awk -F ":" '{ print $3; }' )" END="$( printf "${FREE}" | awk -F ":" '{ print $3; }' )"
parted "${USBSTICK}" mkpart primary "${START}" "${END}" parted "${USBSTICK}" mkpart primary "${START}" "${END}"

View File

@ -6,9 +6,11 @@
# Description: Brings a nic up without an ip address and without arp and # Description: Brings a nic up without an ip address and without arp and
# starts wireshark really passive. # starts wireshark really passive.
# Author: Patrick Neumann (patrick@neumannsland.de) # Author: Patrick Neumann (patrick@neumannsland.de)
# Platform: Kali Linux (tested: 2018.2) # Platform: Kali Linux (tested: 2018.4)
# Version: 1.0 # Version: 1.01
# Date: 24.08.2018 # Date: 30.01.2019
# Link:
# https://vcs.neumannsland.de/casualscripter/shell-scripting/src/branch/master/kali/wireshark_with_no_ip
# License: GPL3 # License: GPL3
# Warranty: This program is distributed WITHOUT ANY WARRANTY # Warranty: This program is distributed WITHOUT ANY WARRANTY
@ -31,6 +33,9 @@ ip addr flush dev "${NIC}"
ip route flush dev "${NIC}" ip route flush dev "${NIC}"
echo > /etc/resolv.conf echo > /etc/resolv.conf
# deactivate ipv6
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
# configure nic without ip address and without arp # configure nic without ip address and without arp
ip addr add 0.0.0.0/32 dev "${NIC}" ip addr add 0.0.0.0/32 dev "${NIC}"
ip link set "${NIC}" arp off up ip link set "${NIC}" arp off up