mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-02 04:52:11 +00:00
update hptest.sh
This commit is contained in:
parent
8b98a78b29
commit
775bc2c1dd
1 changed files with 45 additions and 21 deletions
66
docker/tpotinit/dist/bin/hptest.sh
vendored
66
docker/tpotinit/dist/bin/hptest.sh
vendored
|
@ -1,23 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
myHOST="$1"
|
myHOST="$1"
|
||||||
myPACKAGES="nmap"
|
myPACKAGES="dcmtk ncat nmap yq"
|
||||||
myDOCKERCOMPOSEYML="/opt/tpot/etc/tpot.yml"
|
myDOCKERCOMPOSEYML="$HOME/tpotce/docker-compose.yml"
|
||||||
|
myTIMEOUT=180
|
||||||
function fuGOTROOT {
|
myMEDPOTPACKET="
|
||||||
myWHOAMI=$(whoami)
|
MSH|^~\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A01|MSG00001-|P|2.6
|
||||||
if [ "$myWHOAMI" != "root" ]
|
EVN|A01|198808181123
|
||||||
then
|
PID|||PATID1234^5^M11^^AN||JONES^WILLIAM^A^III||19610615|M||2106-3|677 DELAWARE AVENUE^^EVERETT^MA^02149|GL|(919)379-1212|(919)271-3434~(919)277-3114||S||PATID12345001^2^M10^^ACSN|123456789|9-87654^NC
|
||||||
echo "Need to run as root ..."
|
NK1|1|JONES^BARBARA^K|SPO|||||20011105
|
||||||
exit
|
NK1|1|JONES^MICHAEL^A|FTH
|
||||||
fi
|
PV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J.|||SUR||-||ADM|A0
|
||||||
}
|
AL1|1||^PENICILLIN||CODE16~CODE17~CODE18
|
||||||
|
AL1|2||^CAT DANDER||CODE257
|
||||||
|
DG1|001|I9|1550|MAL NEO LIVER, PRIMARY|19880501103005|F
|
||||||
|
PR1|2234|M11|111^CODE151|COMMON PROCEDURES|198809081123
|
||||||
|
ROL|45^RECORDER^ROLE MASTER LIST|AD|RO|KATE^SMITH^ELLEN|199505011201
|
||||||
|
GT1|1122|1519|BILL^GATES^A
|
||||||
|
IN1|001|A357|1234|BCMD|||||132987
|
||||||
|
IN2|ID1551001|SSN12345678
|
||||||
|
ROL|45^RECORDER^ROLE MASTER LIST|AD|RO|KATE^ELLEN|199505011201"
|
||||||
|
|
||||||
function fuCHECKDEPS {
|
function fuCHECKDEPS {
|
||||||
myINST=""
|
myINST=""
|
||||||
for myDEPS in $myPACKAGES;
|
for myDEPS in $myPACKAGES;
|
||||||
do
|
do
|
||||||
myOK=$(dpkg -s $myDEPS | grep ok | awk '{ print $3 }');
|
myOK=$(sudo dpkg -s $myDEPS | grep ok | awk '{ print $3 }');
|
||||||
if [ "$myOK" != "ok" ]
|
if [ "$myOK" != "ok" ]
|
||||||
then
|
then
|
||||||
myINST=$(echo $myINST $myDEPS)
|
myINST=$(echo $myINST $myDEPS)
|
||||||
|
@ -25,10 +33,10 @@ do
|
||||||
done
|
done
|
||||||
if [ "$myINST" != "" ]
|
if [ "$myINST" != "" ]
|
||||||
then
|
then
|
||||||
apt-get update -y
|
sudo apt-get update -y
|
||||||
for myDEPS in $myINST;
|
for myDEPS in $myINST;
|
||||||
do
|
do
|
||||||
apt-get install $myDEPS -y
|
sudo apt-get install $myDEPS -y
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -50,19 +58,35 @@ myDOCKERCOMPOSEUDPPORTS=$(cat $myDOCKERCOMPOSEYML | grep "udp" | tr -d '"\|#\-'
|
||||||
myDOCKERCOMPOSEPORTS=$(cat $myDOCKERCOMPOSEYML | yq -r '.services[].ports' | grep ':' | sed -e s/127.0.0.1// | tr -d '", ' | sed -e s/^:// | cut -f1 -d ':' | grep -v "6429\|6430" | sort -gu)
|
myDOCKERCOMPOSEPORTS=$(cat $myDOCKERCOMPOSEYML | yq -r '.services[].ports' | grep ':' | sed -e s/127.0.0.1// | tr -d '", ' | sed -e s/^:// | cut -f1 -d ':' | grep -v "6429\|6430" | sort -gu)
|
||||||
myUDPPORTS=$(for i in $myDOCKERCOMPOSEUDPPORTS; do echo -n "U:$i,"; done)
|
myUDPPORTS=$(for i in $myDOCKERCOMPOSEUDPPORTS; do echo -n "U:$i,"; done)
|
||||||
myPORTS=$(for i in $myDOCKERCOMPOSEPORTS; do echo -n "T:$i,"; done)
|
myPORTS=$(for i in $myDOCKERCOMPOSEPORTS; do echo -n "T:$i,"; done)
|
||||||
|
#echo ${myUDPPORTS}
|
||||||
|
#echo ${myPORTS}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main
|
# Main
|
||||||
fuGETPORTS
|
|
||||||
fuGOTROOT
|
|
||||||
fuCHECKDEPS
|
|
||||||
fuCHECKFORARGS
|
fuCHECKFORARGS
|
||||||
|
fuCHECKDEPS
|
||||||
|
fuGETPORTS
|
||||||
echo
|
echo
|
||||||
echo "Starting scan on all UDP / TCP ports defined in /opt/tpot/etc/tpot.yml ..."
|
echo "Probing some services ..."
|
||||||
nmap -sV -sC -v -p $myPORTS $1 &
|
echo "$myMEDPOTPACKET" | nc "$myHOST" 2575 &
|
||||||
nmap -sU -sV -sC -v -p $myUDPPORTS $1 &
|
curl -XGET "http://$myHOST:9200/logstash-*/_search" &
|
||||||
|
curl -XPOST -H "Content-Type: application/json" -d '{"name":"test","email":"test@test.com"}' "http://$myHOST:9200/test" &
|
||||||
|
echo "I20100" | timeout --foreground 3 nc "$myHOST" 10001 &
|
||||||
|
findscu -P -k PatientName="*" $myHOST 11112 &
|
||||||
|
getscu -P -k PatientName="*" $myHOST 11112 &
|
||||||
|
telnet $myHOST 3299 &
|
||||||
|
echo
|
||||||
|
echo "Starting scan on all UDP / TCP ports defined in ${myDOCKERCOMPOSEYML} ..."
|
||||||
|
timeout --foreground ${myTIMEOUT} nmap -sV -sC -v -p $myPORTS $1 &
|
||||||
|
timeout --foreground ${myTIMEOUT} nmap -sU -sV -sC -v -p $myUDPPORTS $1 &
|
||||||
echo
|
echo
|
||||||
wait
|
wait
|
||||||
|
echo "Restarting some containers ..."
|
||||||
|
docker stop adbhoney conpot_guardian_ast conpot_kamstrup_382 dionaea
|
||||||
|
docker start adbhoney conpot_guardian_ast conpot_kamstrup_382 dionaea
|
||||||
|
echo
|
||||||
|
echo "Resetting terminal ..."
|
||||||
|
reset
|
||||||
|
echo
|
||||||
echo "Done."
|
echo "Done."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue