Skip to content

Commit

Permalink
Add variables for tcpdump ports
Browse files Browse the repository at this point in the history
  • Loading branch information
0x6d69636b committed Dec 29, 2019
1 parent 85ea51e commit 7eb4e7a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions nac_bypass_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ OPTION_CONNECTION_SETUP_ONLY=0
OPTION_INITIAL_SETUP_ONLY=0
OPTION_RESET=0

## Ports for tcpdump
TCPDUMP_PORT_1=88
TCPDUMP_PORT_2=445

## Ports for Responder
PORT_UDP_NETBIOS_NS=137
PORT_UDP_NETBIOS_DS=138
Expand Down Expand Up @@ -215,14 +219,15 @@ ConnectionSetup() {
echo
fi

# We pcap any kerberos or smb traffic should be some in Windows land
tcpdump -i $COMPINT -s0 -w $TEMP_FILE -c1 tcp dst port 88 or port 445
## We pcap any kerberos or smb traffic should be some in Windows land
## Default: $TCPDUMP_PORT_1 = 88 and $TCPDUMP_PORT_2 = 445
tcpdump -i $COMPINT -s0 -w $TEMP_FILE -c1 tcp dst port $TCPDUMP_PORT_1 or port $TCPDUMP_PORT_2

COMPMAC=`tcpdump -r $TEMP_FILE -nne -c 1 tcp dst port 88 or port 445 | awk '{print $2","$4$10}' | cut -f 1-4 -d.| awk -F ',' '{print $1}'`
COMPMAC=`tcpdump -r $TEMP_FILE -nne -c 1 tcp dst port $TCPDUMP_PORT_1 or port $TCPDUMP_PORT_2 | awk '{print $2","$4$10}' | cut -f 1-4 -d.| awk -F ',' '{print $1}'`
if [ -z "$GWMAC" ]; then
GWMAC=`tcpdump -r $TEMP_FILE -nne -c 1 tcp dst port 88 or port 445 | awk '{print $2","$4$10}' |cut -f 1-4 -d.| awk -F ',' '{print $2}'`
GWMAC=`tcpdump -r $TEMP_FILE -nne -c 1 tcp dst port $TCPDUMP_PORT_1 or port $TCPDUMP_PORT_2 | awk '{print $2","$4$10}' |cut -f 1-4 -d.| awk -F ',' '{print $2}'`
fi
COMIP=`tcpdump -r $TEMP_FILE -nne -c 1 tcp dst port 88 or port 445 | awk '{print $3","$4$10}' |cut -f 1-4 -d.| awk -F ',' '{print $3}'`
COMIP=`tcpdump -r $TEMP_FILE -nne -c 1 tcp dst port $TCPDUMP_PORT_1 or port $TCPDUMP_PORT_2 | awk '{print $3","$4$10}' |cut -f 1-4 -d.| awk -F ',' '{print $3}'`

if [ "$OPTION_AUTONOMOUS" -eq 0 ]; then
echo
Expand All @@ -231,7 +236,7 @@ ConnectionSetup() {
echo
fi

# Going Silent
## Going Silent
$CMD_ARPTABLES -A OUTPUT -j DROP
$CMD_IPTABLES -A OUTPUT -j DROP

Expand Down

0 comments on commit 7eb4e7a

Please sign in to comment.