-
Notifications
You must be signed in to change notification settings - Fork 22
/
re2pcap.sh
executable file
·58 lines (50 loc) · 1.97 KB
/
re2pcap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Re2Pcap - Create Pcap from Raw HTTP Request or Response in seconds
# Copyright (C) 2019 Cisco Talos
#
# Author: Amit N. Raut
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Print banner
echo
echo " ╦═╗╔═╗┌─┐╔═╗╔═╗╔═╗╔═╗"
echo " ╠╦╝║╣ ┌─┘╠═╝║ ╠═╣╠═╝"
echo " ╩╚═╚═╝└─┘╩ ╚═╝╩ ╩╩ "
# Start animation for the text
animate()
{
animation_text=( "| Please wait... | " " " )
while :
do
for i in "${animation_text[@]}"
do
echo -en "\r$i"
sleep 0.9
done
done
}
# Check to see if Docker is present on the system
type docker >/dev/null 2>&1 || { echo -e >&2 "\nDocker is required for Re2Pcap. Please install docker first. Exiting..."; exit 1; }
# Check to see if `re2pcap` docker image is already present
if [[ "$(docker images -q re2pcap:latest 2> /dev/null)" == "" ]]; then
echo
echo "Building Re2Pcap docker Image"
animate &
ANIMATE_ID=$!
docker build -t re2pcap . > /dev/null
kill -13 $ANIMATE_ID
fi
echo
# Print instructions
echo -e "\n==> Now navigate to http:localhost:5000 or use 'Re2Pcap-cmd' to create PCAP. Thank you! :)\n"
docker run --rm --cap-add NET_ADMIN -p 5000:5000 re2pcap