My try to add Cyberbro KASM Workspace image

Signed-off-by: Teja Swaroop Pothala <tejaswaroop.pothala@kasmweb.com>
This commit is contained in:
stanfrbd 2025-01-24 11:34:00 +01:00 committed by Teja Swaroop Pothala
parent 062a0bff63
commit 81cf171eeb
No known key found for this signature in database
GPG key ID: DEBCE0B52FABDAAC
6 changed files with 184 additions and 0 deletions

48
dockerfile-kasm-cyberbro Normal file
View file

@ -0,0 +1,48 @@
ARG BASE_TAG="develop"
ARG BASE_IMAGE="core-ubuntu-focal"
FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root
ENV HOME=/home/kasm-default-profile
ENV STARTUPDIR=/dockerstartup
ENV LAUNCH_URL=http://127.0.0.1:5000
WORKDIR $HOME
### Envrionment config
ENV DEBIAN_FRONTEND=noninteractive \
SKIP_CLEAN=true \
KASM_RX_HOME=$STARTUPDIR/kasmrx \
DONT_PROMPT_WSL_INSTALL="No_Prompt_please" \
INST_DIR=$STARTUPDIR/install \
INST_SCRIPTS="/ubuntu/install/tools/install_tools_deluxe.sh \
/ubuntu/install/firefox/install_firefox.sh \
/ubuntu/install/cyberbro/install_cyberbro.sh \
/ubuntu/install/cleanup/cleanup.sh"
# Copy install scripts
COPY ./src/ $INST_DIR
RUN cp /usr/share/backgrounds/bg_kasm.png /usr/share/backgrounds/bg_default.png
COPY ./src/ubuntu/install/cyberbro/custom_startup.sh $STARTUPDIR/custom_startup.sh
RUN chmod +x $STARTUPDIR/custom_startup.sh
RUN chmod 755 $STARTUPDIR/custom_startup.sh
# Run installations
RUN \
for SCRIPT in $INST_SCRIPTS; do \
bash ${INST_DIR}${SCRIPT} || exit 1; \
done && \
$STARTUPDIR/set_user_permission.sh $HOME && \
rm -f /etc/X11/xinit/Xclients && \
chown 1000:0 $HOME && \
mkdir -p /home/kasm-user && \
chown -R 1000:0 /home/kasm-user && \
rm -Rf ${INST_DIR}
# Userspace Runtime
ENV HOME /home/kasm-user
WORKDIR $HOME
USER 1000
CMD ["--tail-log"]

11
docs/cyberbro/README.md Normal file
View file

@ -0,0 +1,11 @@
# About This Image
This Image contains a browser-accessible version of [Cyberbro](https://github.com/stanfrbd/cyberbro).
![Screenshot][Image_Screenshot]
[Image_Screenshot]: https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/image-screenshots/<TO_BE_DEFINED> "Image Screenshot"
# Environment Variables
* `FIREFOX_APP_ARGS` - Additional arguments to pass to firefox when launched.

9
docs/cyberbro/demo.txt Normal file
View file

@ -0,0 +1,9 @@
# Live Demo
<a href="https://app.kasmweb.com/#/cast/<TO_BE_DEFINED>" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/GIFs/<TO_BE_DEFINED>" width="640" height="360"></a>
**Launch a real-time demo in a new browser window:** <a href="https://app.kasmweb.com/#/cast/<TO_BE_DEFINED>" target="_blank">Live Demo</a>.
<a href="https://app.kasmweb.com/#/cast/<TO_BE_DEFINED>" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/casting-buttons/<TO_BE_DEFINED>" width="300" height="104"></a>
&lowast;*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.*

View file

@ -0,0 +1 @@
Cyberbro for Kasm Workspaces

View file

@ -0,0 +1,78 @@
#!/usr/bin/env bash
set -ex
START_COMMAND="firefox"
PGREP="firefox"
export MAXIMIZE="false"
export MAXIMIZE_NAME="Mozilla Firefox"
MAXIMIZE_SCRIPT=$STARTUPDIR/maximize_window.sh
DEFAULT_FIREFOX_ARGS=""
FIREFOX_ARGS=${FIREFOX_APP_ARGS:-$DEFAULT_FIREFOX_ARGS}
CYBERBRO_SERVER="127.0.0.1:5000"
DEFAULT_SPIDERFOOT_ARGS="-l $CYBERBRO_SERVER"
SPIDERFOOT_ARGS=${SPIDERFOOT_APP_ARGS:-$DEFAULT_SPIDERFOOT_ARGS}
options=$(getopt -o gau: -l go,assign,url: -n "$0" -- "$@") || exit
eval set -- "$options"
while [[ $1 != -- ]]; do
case $1 in
-g|--go) GO='true'; shift 1;;
-a|--assign) ASSIGN='true'; shift 1;;
-u|--url) OPT_URL=$2; shift 2;;
*) echo "bad option: $1" >&2; exit 1;;
esac
done
shift
# Process non-option arguments.
for arg; do
echo "arg! $arg"
done
FORCE=$2
# run with vgl if GPU is available
if [ -f /opt/VirtualGL/bin/vglrun ] && [ ! -z "${KASM_EGL_CARD}" ] && [ ! -z "${KASM_RENDERD}" ] && [ -O "${KASM_RENDERD}" ] && [ -O "${KASM_EGL_CARD}" ] ; then
START_COMMAND="/opt/VirtualGL/bin/vglrun -d ${KASM_EGL_CARD} $START_COMMAND"
fi
check_web_server() {
curl -s -o /dev/null http://$CYBERBRO_SERVER && return 0 || return 1
}
kasm_startup() {
if [ -n "$KASM_URL" ] ; then
URL=$KASM_URL
elif [ -z "$URL" ] ; then
URL=$LAUNCH_URL
fi
if [ -z "$DISABLE_CUSTOM_STARTUP" ] || [ -n "$FORCE" ] ; then
echo "Entering process startup loop"
set +x
while true
do
if ! pgrep -x $PGREP > /dev/null
then
/usr/bin/filter_ready
/usr/bin/desktop_ready
cd $HOME/cyberbro/cyberbro-*
xfce4-terminal -x bash -c "supervisord -c /etc/supervisor/conf.d/supervisord.conf"
while ! check_web_server; do
sleep 1
done
set +e
bash ${MAXIMIZE_SCRIPT} &
$START_COMMAND $FIREFOX_ARGS $URL
set -e
fi
sleep 1
done
set -x
fi
}
kasm_startup

View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -xe
CYBERBRO_VERSION=$(curl -sX GET "https://api.github.com/repos/stanfrbd/cyberbro/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]')
# Install Spiderfoot
echo "Install Cyberbro"
apt-get update
apt-get install -y python3-pip git supervisor
CYBERBRO_HOME=$HOME/spiderfoot
mkdir -p $CYBERBRO_HOME
cd $CYBERBRO_HOME
wget https://github.com/stanfrbd/cyberbro/archive/${CYBERBRO_VERSION}.tar.gz
tar zxvf ${CYBERBRO_VERSION}.tar.gz
rm ${CYBERBRO_VERSION}.tar.gz
cd cyberbro-*
pip3 install -r requirements.txt
cp prod/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
cat <<EOF > secrets.json
{
"proxy_url": "",
"gui_enabled_engines": ["reverse_dns", "rdap", "ipquery", "spur", "phishtank", "threatfox", "urlscan", "google", "github", "abusix"]
}
EOF
# Cleanup for app layer
chown -R 1000:0 $HOME
find /usr/share/ -name "icon-theme.cache" -exec rm -f {} \;
if [ -z ${SKIP_CLEAN+x} ]; then
apt-get autoclean
rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/*
fi