2016-07-11 03:40:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Blackmate v0.1
|
|
|
|
#
|
2016-07-14 14:39:13 +00:00
|
|
|
# Description : BlackMate is a menu generator for the BlackArch Linux os tools, made for the wm Mate and xfce4.
|
|
|
|
# It will fetch the latest database of BlackArch and create an entry for each of them in the menu
|
|
|
|
# You may run the script as often a new added tools is available
|
|
|
|
# The script can handle only 1 wm at the same time
|
2016-07-11 03:40:40 +00:00
|
|
|
#
|
|
|
|
# Author : Dimitri Mader -> dimitri@linux.com
|
|
|
|
# Url : https://github.com/Anyon3/blackmate
|
|
|
|
# Gnu / GPL v3
|
|
|
|
|
|
|
|
#Check if the script is launch with root
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
2016-07-14 14:39:13 +00:00
|
|
|
echo "Blackmate must be run as root"
|
2016-07-11 03:40:40 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-07-14 14:39:13 +00:00
|
|
|
#Check if blackmate is running for the first time
|
2016-07-11 03:40:40 +00:00
|
|
|
if [[ ! -f /usr/share/applications/BlackArch-Misc.directory ]]; then
|
|
|
|
|
2016-07-11 06:52:57 +00:00
|
|
|
echo "[*] Create the entry Misc";
|
2016-07-11 03:40:40 +00:00
|
|
|
|
2016-07-11 06:52:57 +00:00
|
|
|
#Clean any previous ba-*.desktop
|
|
|
|
rm /usr/share/applications/ba-*.desktop 2> /dev/null || true
|
2016-07-11 03:40:40 +00:00
|
|
|
|
2016-07-11 06:52:57 +00:00
|
|
|
#Delete the entry Website and add the entry Misc
|
|
|
|
rm /usr/share/desktop-directories/BlackArch-Websites.directory 2> /dev/null || true
|
|
|
|
cp /usr/share/blackmate/BlackArch-Misc.directory /usr/share/applications
|
2016-07-11 03:40:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
#Download and generate the latest tools list
|
|
|
|
mkdir /usr/share/blackmate/tmp
|
|
|
|
wget -P /usr/share/blackmate/ https://mirror.yandex.ru/mirrors/blackarch/blackarch/os/x86_64/blackarch.db.tar.gz
|
|
|
|
tar -zxf /usr/share/blackmate/blackarch.db.tar.gz -C /usr/share/blackmate/tmp
|
|
|
|
|
2016-07-14 14:39:13 +00:00
|
|
|
#Choice between xfce4 and Mate
|
|
|
|
printf "For which wm Blackmate shall generate the menu ?\n\n [1] Mate\n [2] Xfce4\n\n Answer : ";
|
|
|
|
|
|
|
|
read n
|
|
|
|
|
|
|
|
if [[ $n == '2' ]]; then
|
|
|
|
|
|
|
|
terminal=`echo xfce4-terminal`;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
terminal=`echo mate-terminal`;
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2016-07-11 03:40:40 +00:00
|
|
|
echo "[*] Generating the menu, please wait...";
|
|
|
|
|
|
|
|
#Start to loop each tools, set $subc as subcategorie and $tname as name of the tool
|
|
|
|
for u in $( ls --color=auto /usr/share/blackmate/tmp/ | sort ); do
|
|
|
|
|
|
|
|
#Subcategorie
|
|
|
|
subc=`cat /usr/share/blackmate/tmp/$u/desc | sed 's/blackarch//' | sed '/^\s*$/d' | sed -n '/%GROUPS%/{n;p}' | cut -d "-" -f 2`;
|
|
|
|
#Name of the tool
|
|
|
|
tname=`cat /usr/share/blackmate/tmp/$u/desc | sed 's/blackarch//' | sed '/^\s*$/d' | sed -n '/%NAME%/{n;p}' | cut -d "-" -f 2`;
|
|
|
|
|
|
|
|
#Set categorie of the subcategorie tool branche
|
|
|
|
if [[ $subc == 'reversing ' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'disassembler' ]] ||
|
|
|
|
[[ $subc == 'binary' ]] ||
|
|
|
|
[[ $subc == 'code-audit' ]] ||
|
2016-07-11 03:40:40 +00:00
|
|
|
[[ $subc == 'analysis' ]] ||
|
|
|
|
[[ $subc == 'debugger' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'decompiler' ]]; then
|
2016-07-11 03:40:40 +00:00
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
namecat=`echo X-BlackArch-CodeAnalysis;`;
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
elif [[ $subc == 'cracker' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'crypto' ]]; then
|
2016-07-11 03:40:40 +00:00
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
namecat=`echo X-BlackArch-Cracking;`;
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
elif [[ $subc == 'defensive' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'honeypot' ]]; then
|
2016-07-11 03:40:40 +00:00
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
namecat=`echo X-BlackArch-Defensive;`;
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
elif [[ $subc == 'exploitation' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'automation' ]] ||
|
|
|
|
[[ $subc == 'dos' ]]; then
|
2016-07-11 03:40:40 +00:00
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
namecat=`echo X-BlackArch-Exploitation;`;
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
elif [[ $subc == 'anti-forensic' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'unpacker' ]] ||
|
2016-07-11 03:40:40 +00:00
|
|
|
[[ $subc == 'forensic' ]] ||
|
|
|
|
[[ $subc == 'packer' ]]; then
|
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
namecat=`echo X-BlackArch-Forensic;`;
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
elif [[ $subc == 'malware' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'keylogger' ]] ||
|
|
|
|
[[ $subc == 'backdoor' ]]; then
|
2016-07-11 03:40:40 +00:00
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
namecat=`echo X-BlackArch-Malware;`;
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
elif [[ $subc == 'networking' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'proxy' ]] ||
|
|
|
|
[[ $subc == 'spoofer' ]] ||
|
2016-07-11 03:40:40 +00:00
|
|
|
[[ $subc == 'tunnel' ]] ||
|
|
|
|
[[ $subc == 'spoof' ]]; then
|
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
namecat=`echo X-BlackArch-Networking;`;
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
elif [[ $subc == 'bluetooth' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'nfc' ]] ||
|
|
|
|
[[ $subc == 'wireless' ]]; then
|
2016-07-11 03:40:40 +00:00
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
namecat=`echo X-BlackArch-Wireless;`;
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
elif [[ $subc == 'voip' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'mobile' ]]; then
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
namecat=`echo X-BlackArch-Telephony;`;
|
|
|
|
|
|
|
|
elif [[ $subc == 'scanner' ]] ||
|
2016-07-11 06:50:56 +00:00
|
|
|
[[ $subc == 'fuzzer' ]] ||
|
|
|
|
[[ $subc == 'fingerprint' ]] ||
|
|
|
|
[[ $subc == 'recon' ]]; then
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
namecat=`echo X-BlackArch-Scanning;`;
|
|
|
|
|
|
|
|
elif [[ $subc == 'sniffer' ]]; then
|
|
|
|
|
|
|
|
namecat=`echo X-BlackArch-Sniffing;`;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
namecat=`echo X-BlackArch-Misc;`;
|
|
|
|
fi
|
|
|
|
|
|
|
|
#For each tools of the target categorie
|
|
|
|
for i in $tname; do
|
|
|
|
|
2016-07-11 06:50:56 +00:00
|
|
|
#Parse the default launcher and set his name
|
|
|
|
cat /usr/share/blackmate/dfdesk | sed 's/^Name=.*/Name='$i'/' |
|
|
|
|
#Set the bash command to execute
|
2016-07-14 14:39:13 +00:00
|
|
|
sed 's/^Exec=.*/Exec='$terminal' -e "bash -ic \\"\/usr\/bin\/'$i'; exec bash"\\"/' |
|
2016-07-11 06:50:56 +00:00
|
|
|
#Set the categorie to the launcher && Set the name file to ba-`toolsname`.desktop
|
|
|
|
sed 's/Categories=.*/Categories='$namecat';/' > /usr/share/blackmate/ba-$i.desktop
|
2016-07-11 03:40:40 +00:00
|
|
|
|
|
|
|
#End of the current tool
|
|
|
|
done
|
|
|
|
|
|
|
|
#End of the current categorie
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "[*] Cleanup...";
|
|
|
|
|
|
|
|
#Move the .desktop to the right directory
|
|
|
|
mv /usr/share/blackmate/ba-*.desktop /usr/share/applications
|
|
|
|
|
|
|
|
#Delete tmp directory
|
|
|
|
rm -rf /usr/share/blackmate/tmp/
|
|
|
|
rm /usr/share/blackmate/blackarch.db.tar.gz
|
|
|
|
|
|
|
|
echo "[*] Done";
|