1
0
mirror of https://github.com/byReqz/blackmate.git synced 2024-11-23 11:44:56 +00:00
blackmate/generator.sh

102 lines
3.3 KiB
Bash
Raw Normal View History

2016-06-25 13:51:43 +00:00
#!/bin/bash
#
# First shot, considering this as an alpha version
#
2016-07-02 17:04:12 +00:00
# Description : BlackMate is a generator menu of the BlackArch tools for the window manager Mate
# This will create a new entry for the menu and generate for each categories, the .desktop launcher of the tools list.
# Make sure mate-terminal is available on your system
# This script need to be start as root
2016-06-25 13:51:43 +00:00
#
# Author : Dimitri Mader -> dimitri@linux.com
# Gnu / GPL v3
2016-07-02 17:04:12 +00:00
#Check if the script is launch with root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
2016-06-25 13:51:43 +00:00
2016-07-02 17:04:12 +00:00
#Clean any previous ba-*.desktop
rm /usr/share/applications/ba-*.desktop 2> /dev/null || true
2016-06-25 13:51:43 +00:00
2016-07-02 17:04:12 +00:00
#Delete the entry Website and add the entry Misc
rm /usr/share/desktop-directories/BlackArch-Websites.directory 2> /dev/null || true
cp BlackArch-Misc.directory /usr/share/applications/
#Start to loop each categories
for u in $( ls categories/ | sort ); do
#Set namecat var to his right categorie name
2016-06-25 13:51:43 +00:00
if [[ "$u" == 'reversing ' ]] || [[ "$u" == 'disassembler' ]] || [[ "$u" == 'binary' ]] || [[ "$u" == 'code-audit' ]] || [[ "$u" == 'analysis' ]] ||
[[ "$u" == 'debugger' ]] || [[ "$u" == 'decompiler' ]]; then
namecat=`echo X-BlackArch-CodeAnalysis;`;
elif [[ "$u" == 'cracker' ]] || [[ "$u" == 'crypto' ]]; then
namecat=`echo X-BlackArch-Cracking;`;
elif [[ "$u" == 'defensive' ]] || [[ "$u" == 'honeypot' ]]; then
namecat=`echo X-BlackArch-Defensive;`;
elif [[ "$u" == 'exploitation' ]] || [[ "$u" == 'automation' ]] || [[ "$u" == 'dos' ]]; then
namecat=`echo X-BlackArch-Exploitation;`;
elif [[ "$u" == 'anti-forensic' ]] || [[ "$u" == 'unpacker' ]] || [[ "$u" == 'forensic' ]] || [[ "$u" == 'packer' ]]; then
namecat=`echo X-BlackArch-Forensic;`;
elif [[ "$u" == 'malware' ]] || [[ "$u" == 'keylogger' ]] || [[ "$u" == 'backdoor' ]]; then
2016-06-25 14:02:35 +00:00
namecat=`echo X-BlackArch-Malware;`;
2016-06-25 13:51:43 +00:00
elif [[ "$u" == 'networking' ]] || [[ "$u" == 'proxy' ]] || [[ "$u" == 'spoofer' ]] || [[ "$u" == 'tunnel' ]] || [[ "$u" == 'spoof' ]]; then
namecat=`echo X-BlackArch-Networking;`;
elif [[ "$u" == 'bluetooth' ]] || [[ "$u" == 'nfc' ]] || [[ "$u" == 'wireless' ]]; then
namecat=`echo X-BlackArch-Wireless;`;
elif [[ "$u" == 'voip' ]] || [[ "$u" == 'mobile' ]]; then
namecat=`echo X-BlackArch-Telephony;`;
elif [[ "$u" == 'scanner' ]] || [[ "$u" == 'fuzzer' ]] || [[ "$u" == 'fingerprint' ]] || [[ "$u" == 'recon' ]]; then
namecat=`echo X-BlackArch-Scanning;`;
elif [[ "$u" == 'sniffer' ]]; then
namecat=`echo X-BlackArch-Sniffing;`;
else
namecat=`echo X-BlackArch-Misc;`;
2016-07-02 17:04:12 +00:00
fi
#Extract name of the tools
a=`cat categories/$u | awk -F '|' '{ print $1 }'`;
#For each tools of the target categorie
for i in $a; do
#Parse the default launcher and set his name
cat dfdesk | sed 's/^Name=.*/Name='$i'/' |
2016-07-02 17:28:50 +00:00
#Set the bash command to execute
2016-07-02 17:04:12 +00:00
sed 's/^Exec=.*/Exec=mate-terminal -e "bash -ic \\"\/usr\/bin\/'$i'; exec bash"\\"/' |
2016-07-02 17:28:50 +00:00
#Set the categorie to the launcher && Set the name file to ba-`toolsname`.desktop
sed 's/Categories=.*/Categories='$namecat';/' > ba-$i.desktop
2016-07-02 17:04:12 +00:00
#End of the current tool
2016-06-25 13:51:43 +00:00
done
2016-07-02 17:04:12 +00:00
#End of the current categorie
2016-06-25 13:51:43 +00:00
done
2016-07-02 17:04:12 +00:00
#Move the .desktop to the right directory
mv ba-*.desktop /usr/share/applications