Skip to content

Instantly share code, notes, and snippets.

@arsenstorm
Last active May 13, 2023 17:22
Show Gist options
  • Save arsenstorm/6b2e2eb85403f21e0f9a6baa8fdeb4ad to your computer and use it in GitHub Desktop.
Save arsenstorm/6b2e2eb85403f21e0f9a6baa8fdeb4ad to your computer and use it in GitHub Desktop.
Installation and setup for the CG50 Exam Bypass
#!/bin/bash
# Checking if script is run as sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Download and extract the repository zip
wget https://github.com/arsenstorm/cg50-exit/archive/refs/heads/main.zip
unzip main.zip
cd cg50-exit-main
# Install dependencies
sudo apt install -y python3 python3-pip -y
sudo pip3 install -r requirements.txt
# Define the username variable
USER=$(whoami)
# Define the path where the script is located
SCRIPT_PATH=$(pwd)
# Create the service definition
read -r -d '' SERVICE << EOM
[Unit]
Description=CG50 Exam Bypass
After=network.target
[Service]
ExecStart=/usr/bin/python3 $SCRIPT_PATH/main.py
WorkingDirectory=$SCRIPT_PATH
User=$USER
Restart=always
[Install]
WantedBy=multi-user.target
EOM
# Write the service file
echo "$SERVICE" > /etc/systemd/system/cg50-exit.service
# Set permissions for the service file
chmod 644 /etc/systemd/system/cg50-exit.service
# Reload systemd to apply changes
systemctl daemon-reload
# Enable the service to start on boot
systemctl enable cg50-exit
# Start the service
systemctl start cg50-exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment