forked from elhmn/ac-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sniff.sh
executable file
·37 lines (31 loc) · 1.4 KB
/
sniff.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
# ************************************************************************** #
# #
# sniff.sh #
# #
# By: elhmn <www.elhmn.com> #
# <[email protected]> #
# #
# Created: Wed Aug 29 15:00:56 2018 by elhmn #
# Updated: Wed Sep 05 11:29:41 2018 by bmbarga #
# #
# ************************************************************************** #
#!/bin
source docker_utils.sh
LOGDIRNAME=tcp_logs
if [ ! -d $LOGDIRNAME ]; then
echo "$LOGDIRNAME : file creation..."
mkdir $LOGDIRNAME
echo "$LOGDIRNAME : file created !"
fi
for e in $(get_container_hash); do
container_name="$(get_container_name $e)"
name=$e
container_name=$(get_container_name $e)
if [ ! -z "$container_name" ]; then
name=$container_name
fi
if [ ! -z "$container_name" ]; then
echo "start sniffing from $container_name"
docker exec $e sh -c "tcpdump -A -i any" >> ./$LOGDIRNAME/container-"$container_name".log &
fi
done