Merge branch 'feature/KASM-5241_spiderfoot' into 'develop'

Resolve KASM-5241 "Feature/ spiderfoot"

Closes KASM-5241

See merge request kasm-technologies/internal/workspaces-images!155
This commit is contained in:
Justin Travis 2023-11-17 03:07:33 +00:00
commit 6d0483c992
7 changed files with 174 additions and 0 deletions

View File

@ -119,6 +119,15 @@ multiImages:
changeFiles:
- dockerfile-kasm-remmina
- src/ubuntu/install/remmina/**
- name: spiderfoot
base: core-ubuntu-focal
dockerfile: dockerfile-kasm-spiderfoot
changeFiles:
- dockerfile-kasm-spiderfoot
- src/ubuntu/install/spiderfoot/**
- src/ubuntu/install/firefox/**
- src/ubuntu/install/tools/**
- src/ubuntu/install/cleanup/**
- name: sublime-text
base: core-ubuntu-focal
dockerfile: dockerfile-kasm-sublime-text

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:5002
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.sh \
/ubuntu/install/firefox/install_firefox.sh \
/ubuntu/install/spiderfoot/install_spiderfoot.sh \
/ubuntu/install/cleanup/cleanup.sh"
# Copy install scripts
COPY ./src/ $INST_DIR
RUN cp /usr/share/extra/backgrounds/bg_kasm.png /usr/share/extra/backgrounds/bg_default.png
COPY ./src/ubuntu/install/spiderfoot/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}; \
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"]

12
docs/spiderfoot/README.md Normal file
View File

@ -0,0 +1,12 @@
# About This Image
This Image contains a browser-accessible version of [Spiderfoot](https://github.com/smicallef/spiderfoot).
![Screenshot][Image_Screenshot]
[Image_Screenshot]: https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/image-screenshots/spiderfoot.png "Image Screenshot"
# Environment Variables
* `SPIDERFOOT_APP_ARGS` - Additional arguments to pass to spiderfoot when launched.
* `FIREFOX_APP_ARGS` - Additional arguments to pass to firefox when launched.

9
docs/spiderfoot/demo.txt Normal file
View File

@ -0,0 +1,9 @@
# Live Demo
<a href="https://app.kasmweb.com/#/cast/8372461590" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/GIFs/spiderfoot.gif" width="640" height="360"></a>
**Launch a real-time demo in a new browser window:** <a href="https://app.kasmweb.com/#/cast/8372461590" target="_blank">Live Demo</a>.
<a href="https://app.kasmweb.com/#/cast/8372461590" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/casting-buttons/spiderfoot.png" 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 @@
Spiderfoot 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}
SPIDERFOOT_SERVER="127.0.0.1:5002"
DEFAULT_SPIDERFOOT_ARGS="-l $SPIDERFOOT_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://$SPIDERFOOT_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/spiderfoot/spiderfoot-4.0/
xfce4-terminal -x python3 sf.py $SPIDERFOOT_ARGS &
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,17 @@
#!/usr/bin/env bash
set -xe
echo "Install Spiderfoot"
apt-get update
apt-get install -y python3-pip
SPIDERFOOT_HOME=$HOME/spiderfoot
mkdir -p $SPIDERFOOT_HOME
cd $SPIDERFOOT_HOME
wget https://github.com/smicallef/spiderfoot/archive/v4.0.tar.gz
tar zxvf v4.0.tar.gz
cd spiderfoot-4.0
pip3 install -r requirements.txt
chown -R 1000:1000 $SPIDERFOOT_HOME