GitHub Codespaces allows developers and hackers to create and utilize their coding environments directly from GitHub in the cloud. As a CTF player or pentester, you can also leverage GitHub Codespaces similarly to a VPS (Virtual Private Server). This makes it easy to work on projects from anywhere with the flexibility of a portable development setup using Docker.
- 📜 Description
- 🔥 What's Nice
- 🐳 Installation
- 🙍🏻♂️ Configuration
- 🚫 Temporarily Disabled
- 👨🏾⚖️ License
- Offers more power with
2-vCPUs
,8GB-RAM
, and a temporary32GB-SSD
storage drive. - Higher performance with
4-vCPUs
,16GB-RAM
, and a temporary32GB-SSD
storage drive.
# pulling images
$ docker pull docker.io/kalilinux/kali-rolling
# Option 1: Priviliged mode (recommended for ctf players)
$ docker run --privileged -it kalilinux/kali-rolling /bin/bash
# Option 2: Interactive mode
$ docker run --tty --interactive kalilinux/kali-rolling
$ apt update && apt install -y kali-linux-default
$ apt update && apt install -y install kali-linux-headless
Tip
Refer to default installation Guide
# Display
$ docker ps -a
# Rename
$ docker rename <current_name> <new_name>
# Status details
$ docker inspect <container id>
# Start
$ docker start <container id> (e.q) d36922fa21e8
# Attach
$ docker attach <container id>
# Stop
$ docker stop <container id>
# Remove
$ docker rm <container id>
$ sudo apt update && sudo apt upgrade -y
# option 1:
$ adduser l0n3m4n
# option 2:
$ useradd -m -s /bin/bash l0n3m4n
# option 1: replace to your username
l0n3m4n ALL=(ALL:ALL) ALL
# option 2:
$ echo "l0n3m4n ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers/l0n3m4n
# switching to non-root user
$ su - l0n3m4n
# verify
$ whoami
# view ram details
$ free
# view disk space 'du'
$ du -h --max-depth=1 /
# view disk space GB
$ df -h
Important
The way to use openvpn or enable tun0
you need to add --privileged
option instead using --tty
by default, Docker containers do not have access to TUN/TAP devices on the host system due to security and isolation concerns.
# options 1:
$ docker run --privileged -it kalilinux/kali-rolling /bin/bash
# Option 2: Use --device Flag (More Secure)
# A more secure approach is to use the --device flag to explicitly map the TUN/TAP device from the host into the container. This approach is more controlled and limits access to only the necessary device.
$ docker run --device=/dev/net/tun:/dev/net/tun -it kalilinux/kali-rolling /bin/bash
# Verify TUN/TAP Functionality Inside the Container
$ ls -l /dev/net/tun
Note
Github codespace terminal
$ docker exec -it <container_id> /bin/bash
If you've used 100% of the included services for GitHub Codespaces storage, a few things might happen depending on your account settings and actions.
- Inability to Use Codespaces: You won't be able to create or use GitHub Codespaces until either your
free allotment resets next month
or you take action to manage your usage. - Options to Regain Access:
- Set Up a Spending Limit: You can set up a
spending limit
on your GitHub account to prevent unexpected charges and manage your usage effectively. - Delete Unused Resources: Consider
deleting Codespaces
orprebuilds
that are no longer needed to free up space and potentially reduce future charges.
- Set Up a Spending Limit: You can set up a
- Access to In-Progress Work: It's important to
export
any unpushed work to a branch if you want to retain access to your in-progress projects. This ensures you have a backup and can continue working on them when you regain access to Codespaces. - Review Usage and Charges: GitHub provides a
usage report
where you can see detailed information about your Codespaces and prebuild usage. This can help you understand your usage patterns and manage future usage effectively.
- Adjustment:
- Adding
privileged
user mode to enable TUN error when starting the OpenVPN file.
- Adding
- Adding remotehost for graphical user inferface (GUI), this includes xrdp, ssh, noVNC and etc.
- Adding Automated builds Dockerfile to ensure consistency and reliability.
- Adding ngrok to exposed your cloud servers behind NATs and firewalls to the public internet over secure tunnels.
- Adding Openvpn default configuration to ensure privacy and security
This project is under terms of the MIT License. bugs and error, create issue