Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # "In 'The Art of Not Existing,' players embark on a captivating journey mastering command-line basics, scripting, and building a secure remote HTTPS server. From navigating folders to scripting personalized greetings, unlocking hidden keys, and controlling file permissions, players hone their skills. They navigate mazes, manipulate symbolic links, explore SSH connections, and delve into tunneling techniques. The game's final challenge involves crafting SSL certificates and configuring an HTTPS server for secure communication. With each quest, players gain expertise in the intricacies of the digital realm, culminating in the activation of a secure SSH tunnel and accessing the remote server. 'The Art of Not Existing' is a dynamic adventure blending practical command-line skills with secure server mastery."
- # The Art of Not Existing
- # Embark on an immersive journey into command-line mastery, scripting sorcery, and the creation of a secure remote HTTPS server. Crafted by Michael Errington of GhostSec.
- # Chapter 1: Initiation - The Whispering Shell
- # Side Quest 1: Commands of the Apprentice
- # Master the basics of CLI navigation. Traverse folders using `cd`, reveal hidden realms with `ls -a`, and unravel the secrets of ancient scrolls with `cat`.
- bash
- cd folder # Enter a mysterious folder
- ls -a # Reveal hidden treasures
- cat ancient.txt # Unveil the wisdom in the scrolls
- # Side Quest 2: Echoes of Greeting
- # Begin your scripting journey with a bash script (`first_script.sh`) that echoes a personalized greeting.
- bash
- #!/bin/bash
- echo "Welcome, adventurer!"
- # Side Quest 3: Key Unveiling
- # Encounter a locked chest and reveal its secrets with a script (`retrieve_key.sh`) to unlock it and expose the hidden key.
- bash
- #!/bin/bash
- key_location = "hidden_chest/.hidden_key"
- unlocked_key = $(cat "$key_location")
- echo "Unlocked key: $unlocked_key"
- # Side Quest 4: Permissions Prowess
- # Delve into the art of file permissions with `chmod`. Use a Python script (`change_permissions.py`) to grant access to a secured key.
- python
- #!/usr/bin/env python3
- import os
- key_location = "hidden_chest/.hidden_key"
- os.chmod(key_location, 0o600)
- print(f"Permissions of {key_location} changed successfully.")
- # Side Quest 5: Navigational Challenges
- # Embark on a journey through a maze of folders. Use `cd` and `ls` to navigate and locate the hidden key.
- bash
- cd maze_folder # Enter the labyrinth of folders
- ls -a # Explore and discover the elusive key
- cat secret_folder/key.txt # Reveal the hidden treasure
- # Side Quest 6: Symbolic Links Unveiled
- # Navigate the mystic world of symbolic links. Create a symbolic link to access a hidden directory.
- bash
- ln -s secret_folder link_to_secret # Create a symbolic link
- cd link_to_secret # Enter the hidden realm through the link
- ls -a # Reveal the secrets within
- # Side Quest 7: Forge Your Path
- Exercise your command over creation. Use `mkdir` to forge a new path and `touch` to create a blank map.
- bash
- mkdir new_path # Forge a new path in the wilderness
- touch blank_map.txt # Create a blank map for your journey
- # Side Quest 8: Elemental Deletion
- # Master the art of destruction. Wield `rm` to remove obstacles from your path and clear the way forward.
- bash
- rm obstacle.txt # Remove obstacles blocking your path
- rmdir old_path # Clear the way by removing an unnecessary path
- # Side Quest 9: Textual Exploration
- # Dive into the world of text manipulation. Use `grep` to find hidden messages and `sed` to transform the ancient scrolls.
- bash
- grep "hidden" ancient.txt # Find hidden messages
- sed 's/secrets/mysteries/g' ancient.txt # Transform the ancient scrolls
- # Side Quest 10: Archive Alchemy
- # Embrace the power of archives. Use `tar` to create a compressed archive and `zip` to unlock its contents.
- bash
- tar -czvf secrets.tar.gz secret_folder # Create a compressed archive
- mkdir extracted_contents # Forge a path to extract the contents
- tar -xzvf secrets.tar.gz -C extracted_contents # Unlock the secrets
- # Chapter 2: Gateway to the Remote Realm
- # Side Quest 11: Whispers of Ports
- # Eavesdrop on port secrets using `netstat`. Discover the whispered tales of open ports.
- bash
- netstat -tuln # Eavesdrop on the ports' secrets
- # Side Quest 12: Password Pilgrimage
- # Embark on a password pilgrimage with `sshpass`. Journey into the remote realm with your password shield.
- bash
- sshpass -p 'your_password' ssh user@remote_server_ip
- # Side Quest 13: Scripted Connection
- # Automate your journey with a bash script (`connect_to_server.sh`). Let it be your guide to the remote server.
- bash
- #!/bin/bash
- user = "your_username"
- server_ip = "remote_server_ip"
- ssh "$user@$server_ip"
- # Side Quest 14: Scrolls of Access
- # Gain access to the ancient SSH configuration scrolls with `sudo` and modify them using the powerful `nano`.
- bash
- sudo nano /etc/ssh/sshd_config # Unravel the secrets within the access scrolls
- # Side Quest 15: Key Mastery
- # Unlock the power of key-based authentication. Create a key pair with `ssh-keygen` and share it using `ssh-copy-id`.
- bash
- ssh-keygen -t rsa # Generate a new SSH key pair
- ssh-copy-id user@remote_server_ip # Copy your public key to the remote server
- # Side Quest 16: Access Control Art
- # Craft a bash script (`access_control.sh`) to control access to the remote realm based on IP addresses.
- bash
- #!/bin/bash
- allowed_ip = "192.168.1.1"
- sshd_config = "/etc/ssh/sshd_config"
- echo "AllowUsers $allowed_ip" | sudo tee -a "$sshd_config"
- sudo service ssh restart
- # Chapter 3: The Art of Tunnels
- # Side Quest 17: Local Port Sorcery
- # Discover the magic of Local Port Forwarding. Redirect a local port to a remote service.
- bash
- ssh -L 8080:localhost:80 user@remote_server_ip
- # Side Quest 18: Remote Port Alchemy
- Embark on Remote Port Forwarding. Forward a remote port to a local service.
- bash
- ssh -R 8080:localhost:80 user@remote_server_ip
- # Side Quest 19: Dynamic Tunnel Enchantment
- Dive into Dynamic Port Forwarding. Create a dynamic SOCKS proxy to traverse the mystical realms.
- bash
- ssh -D 8080 user@remote_server_ip
- # Side Quest 20: Dynamic Tunnel Configuration
- Develop a Python script (`dynamic_tunnel.py`) to dynamically configure the SSH tunnel based on user input.
- python
- #!/usr/bin/env python3
- import subprocess
- local_port = input("Enter local port: ")
- remote_port = input("Enter remote port: ")
- subprocess.run(["ssh", "-L", f"{local_port}:localhost:{remote_port}", "user@remote_server"])
- # Chapter 4: Secure HTTPS Server Mastery
- # Side Quest 21: SSL Crafting
- # Commence the quest by crafting a self-signed SSL certificate using `openssl` for secure communication.
- bash
- openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem
- # Side Quest 22: HTTPS Server Configuration
- # Configure the HTTPS server with `nginx`. Design a majestic server block within an `nginx` configuration file.
- nginx
- server {
- listen 127.0.0.1:443 ssl;
- ssl_certificate /path/to/cert.pem;
- ssl_certificate_key /path/to/key.pem;
- location / {
- root /path/to/your/website;
- index index.html;
- }
- }
- # Side Quest 23: HTTPS Tunneling Enigma
- # Modify the SSH tunnel to incorporate port forwarding for HTTPS. Ensure secure communication.
- bash
- ssh -L 443:localhost:443 user@remote_server_ip
- # Final Side Quest: Secure Tunnel Activation Script
- # Craft a bash script (`secure_activate_tunnel.sh`) to guide you in activating the secure SSH tunnel and accessing the remote HTTPS server.
- bash
- #!/bin/bash
- read -p "Enter local port for SSH tunnel: " local_ssh_port
- read -p "Enter remote port for SSH tunnel: " remote_ssh_port
- read -p "Enter local port for HTTPS server: " local_https_port
- # Start the SSH tunnel with port forwarding for HTTPS
- ssh -L "$local_ssh_port:localhost:$remote_ssh_port" user@remote_server_ip -N &
- # Activate the HTTPS server on localhost
- sudo nginx -c /etc/nginx/sites-available/https_server
- echo "Secure SSH tunnel and HTTPS server activated successfully!"
- # Success - The Art of Not Existing
- # Congratulations, Master of the Shell! Your journey has successfully navigated the intricacies of command-line mastery, scripting sorcery, and the secrets of SSH tunneling. The creation and removal of files and directories, along with your adept manipulation of symbolic links, symbolize your profound control over the digital realm.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement