Skip to content

Commit 84e39f8

Browse files
committed
init
1 parent e62b155 commit 84e39f8

File tree

4 files changed

+99
-0
lines changed

4 files changed

+99
-0
lines changed

assets/icons/logo.png

5.88 KB
Loading

assets/sounds/hint.mp3

2.02 KB
Binary file not shown.

exploit-db-notify.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
MAIN_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)
4+
DATA_PATH="$HOME/.exploit-db-notify"
5+
6+
function _Logger() {
7+
LOG_FILE="$DATA_PATH/notifications.log"
8+
[[ ! -f $LOG_FILE ]] && touch $LOG_FILE
9+
10+
if [[ -z $2 ]]; then
11+
grep -q "$1" $LOG_FILE && echo "0" || echo "1"
12+
else
13+
echo "$1" >> $LOG_FILE
14+
fi
15+
}
16+
17+
function _notify() {
18+
notify-send \
19+
"$2" "$3 [$4] on $6 by $5" \
20+
-i "$MAIN_PATH/assets/icons/logo.png" \
21+
-o "View details:xdg-open https://www.exploit-db.com/exploits/$1" \
22+
-o "Download:xdg-open https://www.exploit-db.com/download/$1" \
23+
-o "Close:false"
24+
25+
aplay "$MAIN_PATH/assets/sounds/hint.mp3"
26+
}
27+
28+
function _getExploits() {
29+
[[ ! -d $DATA_PATH ]] && mkdir -p $DATA_PATH/data/
30+
curl -s "https://www.exploit-db.com/?type=webapps&draw=3&columns%5B0%5D%5Bdata%5D=date_published&columns%5B0%5D%5Bname%5D=date_published&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=download&columns%5B1%5D%5Bname%5D=download&columns%5B1%5D%5Bsearchable%5D=false&columns%5B1%5D%5Borderable%5D=false&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B2%5D%5Bdata%5D=application_md5&columns%5B2%5D%5Bname%5D=application_md5&columns%5B2%5D%5Bsearchable%5D=true&columns%5B2%5D%5Borderable%5D=false&columns%5B2%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B2%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B3%5D%5Bdata%5D=verified&columns%5B3%5D%5Bname%5D=verified&columns%5B3%5D%5Bsearchable%5D=true&columns%5B3%5D%5Borderable%5D=false&columns%5B3%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B3%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B4%5D%5Bdata%5D=description&columns%5B4%5D%5Bname%5D=description&columns%5B4%5D%5Bsearchable%5D=true&columns%5B4%5D%5Borderable%5D=false&columns%5B4%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B4%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B5%5D%5Bdata%5D=type_id&columns%5B5%5D%5Bname%5D=type_id&columns%5B5%5D%5Bsearchable%5D=true&columns%5B5%5D%5Borderable%5D=false&columns%5B5%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B5%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B6%5D%5Bdata%5D=platform_id&columns%5B6%5D%5Bname%5D=platform_id&columns%5B6%5D%5Bsearchable%5D=true&columns%5B6%5D%5Borderable%5D=false&columns%5B6%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B6%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B7%5D%5Bdata%5D=author_id&columns%5B7%5D%5Bname%5D=author_id&columns%5B7%5D%5Bsearchable%5D=false&columns%5B7%5D%5Borderable%5D=false&columns%5B7%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B7%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B8%5D%5Bdata%5D=code&columns%5B8%5D%5Bname%5D=code.code&columns%5B8%5D%5Bsearchable%5D=true&columns%5B8%5D%5Borderable%5D=true&columns%5B8%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B8%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B9%5D%5Bdata%5D=id&columns%5B9%5D%5Bname%5D=id&columns%5B9%5D%5Bsearchable%5D=false&columns%5B9%5D%5Borderable%5D=true&columns%5B9%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B9%5D%5Bsearch%5D%5Bregex%5D=false&order%5B0%5D%5Bcolumn%5D=9&order%5B0%5D%5Bdir%5D=desc&start=0&length=15&search%5Bvalue%5D=&search%5Bregex%5D=false&author=&port=&type=webapps&tag=&platform=" -H "X-Requested-With: XMLHttpRequest" -H "User-Agent: Mozilla/5.0 (X11; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0" -H "Referer: https://www.exploit-db.com/?type=webapps" -o $DATA_PATH/data/exploit-db.json
31+
cat $DATA_PATH/data/exploit-db.json | jq -r '.data[] | [.id, .description[1], .type_id, .platform_id, .author_id[1], .date_published] | @tsv' |
32+
while IFS=$'\t' read -r id description type platform author date; do
33+
LOGGER="_Logger"
34+
if [[ $($LOGGER $id) -eq "1" ]]; then
35+
_notify "$id" "$description" "$type" "$platform" "$author" "$date"
36+
echo "$id $description $type $platform $author $date"
37+
$LOGGER $id 1
38+
fi
39+
done
40+
}
41+
42+
_getExploits

install.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
if [[ $EUID -ne 0 ]]; then
4+
echo "This script must be run as root(!)"
5+
exit 1
6+
fi
7+
8+
MAIN_PATH="/opt/exploit-db-notify"
9+
LOCAL_BIN="/usr/local/bin"
10+
11+
function _dlResources() {
12+
echo "Create main directory..."
13+
mkdir -p $MAIN_PATH
14+
echo "Downloading notify-send.sh..."
15+
wget -q "https://github.com/vlevit/notify-send.sh/raw/master/notify-send.sh" -O $LOCAL_BIN/notify-send
16+
wget -q "https://github.com/vlevit/notify-send.sh/raw/master/notify-action.sh" -O $LOCAL_BIN/notify-action.sh
17+
chmod 777 $LOCAL_BIN/notify-*
18+
cp -a assets/ $MAIN_PATH
19+
cp exploit-db-notify.sh $MAIN_PATH/exploit-db-notify
20+
chmod -R +x $MAIN_PATH/
21+
}
22+
23+
function _dependencies() {
24+
if ! [ -x "$(which jq)" ]; then
25+
JQ_OUT="/usr/local/bin/jq"
26+
echo "Downloading jq..."
27+
wget -q "https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux$(getconf LONG_BIT)" -O $JQ_OUT
28+
chmod 777 $JQ_OUT
29+
else
30+
echo "jq OK!"
31+
fi
32+
33+
if ! [ -x "$(which curl)" ]; then
34+
echo "Downloading cURL..."
35+
wget -q "https://curl.haxx.se/download/curl-7.68.0.tar.gz" -O /tmp/
36+
tar -xf /tmp/curl-7* && cd /tmp/curl-7*
37+
echo "Installing cURL..."
38+
/./$PWD/configure && make && make install
39+
else
40+
echo "curl OK!"
41+
fi
42+
}
43+
44+
function _setCrontab() {
45+
CRON_CURRENT="/tmp/cron.current"
46+
crontab -l > $CRON_CURRENT
47+
echo "0 */3 * * * $MAIN_PATH/exploit-db-notify" >> $CRON_CURRENT
48+
echo "Installing new crontab"
49+
crontab $CRON_CURRENT
50+
}
51+
52+
echo "##### Installing resources #####"
53+
_dlResources
54+
echo "##### Installing dependencies #####"
55+
_dependencies
56+
# echo "##### Setting up crontab #####"
57+
# #_setCrontab # run this as user

0 commit comments

Comments
 (0)