The application SweetCam is a honeypot for IP camera. It can simulate a real IP camera vividly, including the interaction with user for rotating and zooming.
The SweetCam honeypot application is composed by four parts:
- The MySQL service for data storage.
- The RTSP service, this is used to provide the RTSP service for the attackers.
- The Web service, this is used to provide the web service for the attackers, including viewing the camera page, logging etc.
- The Cowrie service, this is used as the SSH honeypot for providing the SSH service for the attackers.
To run launch the application, just enter the root directory of the application and launch the application with the following command (remember to add a .env file with required environment variables):
docker compose up -d
Thereafter, there should be four containers that are running as shown follows:
- web_service
- cowrie_service
- rtsp_service
- mysql_service
Once the four services are lunched, there are several configurations should be made within the rtsp_service:
-
Enter the rtsp_service container with the following command:
docker exec -it rtsp_service /bin/sh
-
Revise the mediamtx.yml file to configure the logging function of the Mediamtx application.
-
Then use the FFmpeg tool to push the video to mediamtx server (RTSP server)
Take Azure Cloud as example.
First we need to change the used SSH port since the default one 22 should be used by Cowrie honeypot.
- sudo vim /etc/ssh/sshd_config.
- Change the port to another one, 2404 for example.
- Restart ssh service: sudo service ssh restart
- Reconnect with new port: ssh -i ./sweetcam_key.pem azureuser@20.197.231.249 -p 2404
- Revise the virtual machine network policy to allow 2404 traffic.
- sudo apt-get -y update
- sudo apt-get -y install ca-certificates curl gnupg
- sudo install -m 0755 -d /etc/apt/keyrings
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- sudo chmod a+r /etc/apt/keyrings/docker.gpg
- echo
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - sudo apt-get update
- sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Or to use the script ./install-docker.sh
, before using it change its permission with sudo chmod 776 install-docker.sh
The procedures are as follows:
- Revise the virtual machine network policy to allow 80, 554, 2404 (customized port for SSH), 22 traffic.
- git clone https://github.com/Agachily/sweetcam.git
- Create and populate the .env file
- Run the application in the background:
docker compose up -d
(stop withdocker compose down -v
) - Enter the container of rtsp service: docker exec -it rtsp_service /bin/sh and configure the logging function
- Use FFmpeg to push to video to RTSP server. ffmpeg -nostdin -re -stream_loop -1 -i ./videos/fake-video.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream
- View it at rtsp://public_ip:554/mystream
- Check the volumes: docker volume ls
- Inspect volume: docker volume inspect sweetcam_rtsp-resource
- Get the logs from the volume
scp -r -i ./key.pem -P 2404 azureuser@public_ip:/home/azureuser/logs/sweetcam_cowrie-log ./attack-logs/machine-a/