aboutsummaryrefslogtreecommitdiff
path: root/broccoli
diff options
context:
space:
mode:
authorAndreas Lindhé <andreas@lindhe.io>2017-10-14 16:08:01 +0200
committerAndreas Lindhé <andreas@lindhe.io>2017-10-14 16:08:04 +0200
commit796ae574439a9532bb2988b53a999db265b8a4a6 (patch)
tree60b15aa1ea5aa447e55abe5de92a694993e91844 /broccoli
parentbb5054d1fb1693036281d91c7139e963f86fc4f4 (diff)
downloadmidbro-796ae574439a9532bb2988b53a999db265b8a4a6.tar.gz
midbro-796ae574439a9532bb2988b53a999db265b8a4a6.tar.bz2
Modify script to run remotely on pi
* Add separate interface argument in case the laptop ethernet interface has different name than than on the pi * Add command to run as sudo on pi over SSH. This assumes root has pasadpi_rsa in /root/.ssh/ *
Diffstat (limited to 'broccoli')
-rw-r--r--broccoli/script/measure-packets.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/broccoli/script/measure-packets.sh b/broccoli/script/measure-packets.sh
index a141885..d79902e 100644
--- a/broccoli/script/measure-packets.sh
+++ b/broccoli/script/measure-packets.sh
@@ -8,7 +8,8 @@
# Make sure that the command is executed by root.
function execute_command {
- bash -c "$@"
+ # bash -c "$@"
+ ssh -i ~/.ssh/pasadpi_rsa pi@pasadpi2 "sudo bash -c '$@'"
}
function measure_packets {
@@ -17,7 +18,8 @@ function measure_packets {
BRO_PID=$(execute_command "bro -i \"${BRO_INTERFACE}\" -C -b Log::default_writer=Log::WRITER_NONE \"${BRO_SCRIPT}\" > ${BRO_DIR}/bro-out.txt 2> ${BRO_DIR}/bro-err.txt & echo \$!")
- tcpreplay -i "${BRO_INTERFACE}" -M "${TCPREPLAY_SPEED}" -L "${TCPREPLAY_COUNT}" "${TCPREPLAY_DUMP}" > /dev/null 2> /dev/null
+
+ tcpreplay -i ${TCPREPLAY_INTERFACE} -M ${TCPREPLAY_SPEED} -L ${TCPREPLAY_COUNT} ${TCPREPLAY_DUMP} > /dev/null 2> /dev/null
PCPU="100.0"
while [[ $(echo "${PCPU}>50" | bc) -eq 1 ]]
@@ -32,7 +34,7 @@ function measure_packets {
execute_command "tail -1 ${BRO_DIR}/bro-err.txt" | sed 's/.* \([0-9]\+\) packets received.*/\1/'
}
-if [[ $# -ne 3 ]]
+if [[ $# -ne 4 ]]
then
echo "Executes Bro and tcpreplay and measures the number of packages"
echo "received and handled by Bro."
@@ -41,14 +43,16 @@ then
echo " $0 SCRIPT IFACE DUMP"
echo "Arguments:"
echo " SCRIPT the Bro script to execute"
- echo " IFACE the interface for Bro to listen on"
+ echo " BIFACE the interface for Bro to listen on"
echo " DUMP the network dump to replay"
+ echo " TIFACE the interface for tcpreplay to replay to"
exit 1
fi
BRO_SCRIPT=$1
BRO_INTERFACE=$2
TCPREPLAY_DUMP=$3
+TCPREPLAY_INTERFACE=$4
SPEEDS=(100 50 25)
COUNTS=(1000000 2000000 4000000)