### Manual Setup for Greyteam Project Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/README.md This section outlines the manual steps to set up the Greyteam project environment. It includes package installation, repository cloning, virtual environment creation, dependency installation, and Ansible role installation. ```shell apt update apt install -y nano git python-is-python3 python3 python3-venv python3-pip sshpass pwgen git clone https://github.com/Guac0/2255-CSEC473-Alpha/ cd ./2255-CSEC473-Alpha/greyteam python -m venv venv source venv/bin/activate pip3 install -r requirements.txt activate-global-python-argcomplete ansible-galaxy install -r requirements.yml ``` -------------------------------- ### Setup Greyteam Project using cURL Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/README.md This command downloads and executes the setup script for the Greyteam project directly from GitHub using cURL. It's a quick way to get the environment ready. ```shell curl https://raw.githubusercontent.com/Guac0/2255-CSEC473-Alpha/refs/heads/main/greyteam/setup.sh | bash ``` -------------------------------- ### Ansible Command Examples for Verification and Execution Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/README.md This snippet provides examples of using Ansible for various tasks. It includes checking playbook syntax, linting playbooks, and executing playbooks with specific tags and verbosity levels. ```shell ansible-lint verify-apache.yml ``` ```shell ansible-playbook -i inventory.yaml playbook.yaml -t ping ``` ```shell ansible-playbook -i inventory/inventory.yaml playbook.yaml -t flags -l unix -vvvv ``` ```shell ansible-playbook -i inventory.yaml playbook.yaml -t tag -vv -c ``` -------------------------------- ### Environment Setup using Ansible Source: https://context7.com/guac0/2255-csec473-alpha/llms.txt Installs dependencies and configures the Ansible control node for the project. It can be executed via a curl script or manually by installing packages, cloning the repository, setting up a virtual environment, and installing Python and Ansible requirements. ```bash curl https://raw.githubusercontent.com/Guac0/2255-CSEC473-Alpha/refs/heads/main/greyteam/setup.sh | bash ``` ```bash apt update apt install -y nano git python-is-python3 python3 python3-venv python3-pip sshpass pwgen git clone https://github.com/Guac0/2255-CSEC473-Alpha/ cd ./2255-CSEC473-Alpha/greyteam python -m venv venv source venv/bin/activate pip3 install -r requirements.txt activate-global-python-argcomplete ansible-galaxy install -r requirements.yml ``` -------------------------------- ### Create Local Users Playbook Example (YAML) Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/windows_users_local/README.md This example demonstrates how to use the 'windows_create_local_users' role within an Ansible playbook. It targets Windows hosts, excluding domain controllers, and applies the role with specific tags. This playbook is intended to be used for creating local user accounts on specified Windows machines. ```yaml - name: Create Local Users hosts: windows:&team_hosts:!win_dc roles: - windows_create_local_users tags: - never - team - windows - team_local_users ``` -------------------------------- ### Initialize and Load Data (JavaScript) Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/scoring_server/files/templates/editor.html This JavaScript function initializes the system by loading host and service data. It makes asynchronous calls to '/get_hosts' and '/get_services' endpoints to populate the respective lists. ```javascript let selectedServiceId = null; async function init() { await loadHosts(); await loadServices(); } init(); ``` -------------------------------- ### Initial Load and Auto-Refresh using JavaScript Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/scoring_server/files/templates/management.html Initializes the application by calling functions to refresh users, tokens, and logs. It then sets up interval timers to automatically refresh logs every 30 seconds and users/tokens every 90 seconds. ```javascript // Initial load refreshUsers(); refreshTokens(); refreshLogs(); // Auto-refresh every 60 seconds setInterval(() => { refreshLogs(); }, 30000); setInterval(() => { refreshUsers(); refreshTokens(); }, 90000); ``` -------------------------------- ### User Management with Ansible Source: https://context7.com/guac0/2255-csec473-alpha/llms.txt Manages the creation and deployment of local and domain users across the environment. It defines standard users, local administrators, and domain administrators, with an example configuration provided for `group_vars/all.yaml`. ```bash ansible-playbook -i inventory.yaml playbook.yaml -t local_users ``` ```bash ansible-playbook -i inventory.yaml playbook.yaml -t users_linux ``` ```yaml # Example inventory group_vars/all.yaml configuration: # local_users: # - twilight # - pinkiepie # - applejack # local_admins: # - bigmac # - mayormare # domain_admins: # - celestia # - discord # team_password: Friendship0! ``` -------------------------------- ### Video Ad Configuration Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/windows_iis/files/site/index.html Configuration object for video ad placements, detailing various ad bidders like AppNexus, GumGum, Ix, Kargo, Medianet, Nobid, OpenX, Ozone, Pubmatic, Rubicon, Seedtag, and Triplelift. Each bidder has specific parameters for targeting and inventory. ```javascript { "incontent_player": { "name": "incontent_player", "type": "video", "sizes": [ [ [0, 0], [ [640, 480] ] ] ], "targeting": { "loc": "middle", "pos": "outstream", "src": "gpt" }, "group": "VIDEO", "bidders": { "prebid": { "mediaTypes": { "video": { "api": [ 2 ], "context": "instream", "linearity": 1, "mimes": [ "video/mp4", "video/x-flv", "video/webm", "video/ogg" ], "placement": 3, "plcmt": 2, "playbackmethod": [ 2, 3 ], "protocols": [ 2, 3, 5, 6 ], "minduration": 1, "maxduration": 30, "startdelay": 0, "playerSize": [ 640, 480 ], "skip": 1, "w": 640, "h": 480 } }, "bids": { "appnexus": [ { "bidder": "appnexus", "params": { "3": {"placementId": "36031426"}, "4": {"placementId": "35554247"} } } ], "gumgum": [ { "bidder": "gumgum", "params": { "4": {"zone": "xncp8nfb"} } } ], "ix": [ { "bidder": "ix", "params": { "3": {"siteId": "1264494"}, "4": {"siteId": "1204726"} } } ], "kargo": [ { "bidder": "kargo", "params": { "4": {"placementId": "_s5qlqwD4Vv"} } } ], "medianet": [ { "bidder": "medianet", "params": { "3": {"cid": "8CU8RM982", "crid": "334418444"}, "4": {"cid": "8CU5JOKX4", "crid": "789719487"} } } ], "nobid": [ { "bidder": "nobid", "params": { "4": {"siteId": 21872987104, "placementId": 169477} } } ], "openx": [ { "bidder": "openx", "params": { "3": {"delDomain": "wikia-d.openx.net", "unit": "562882254"}, "4": {"delDomain": "wikia-d.openx.net", "unit": "562527223"} } } ], "ozone": [ { "bidder": "ozone", "params": { "4": {"publisherId": "OZONEFAN0001", "siteId": "1500000748", "placementId": "3500018045"} } } ], "pubmatic": [ { "bidder": "pubmatic", "params": { "3": {"publisherId": "156260", "adSlot": "7013933"}, "4": {"publisherId": "156260", "adSlot": "6883416"} } } ], "rubicon": [ { "bidder": "rubicon", "params": { "3": {"accountId": "7450", "keywords": ["rp.fastlane"], "siteId": "595364", "zoneId": "3810512", "video": {"size_id": 201, "language": "en"}}, "4": {"accountId": "7450", "keywords": ["rp.fastlane"], "siteId": "590516", "zoneId": "3770942", "video": {"size_id": 201, "language": "en"}} } } ], "seedtag": [ { "bidder": "seedtag", "params": { "4": {"publisherId": "6602-4575-01", "adUnitId": "35631525", "placement": "inArticle"} } } ], "triplelift": [ { "bidder": "triplelift", "params": { "3": {"inventoryCode": "Fandom_RON_Desktop_Video_Prebid"}, "4": {"inventoryCode": "Fandom_incontent_player_prebid_odyssey"} } } ] } }, "a9": { "mediaType": "video" } } } } ``` -------------------------------- ### Configure OpenStack Provider for Terraform Source: https://context7.com/guac0/2255-csec473-alpha/llms.txt Example HCL configuration for the Terraform OpenStack provider. It specifies the required Terraform version, provider source, version constraints, and authentication details for OpenStack. This file is typically named `config.tf` or similar. ```hcl # Example config.tf - OpenStack provider configuration terraform { required_version = ">= 0.14.0" required_providers { openstack = { source = "terraform-provider-openstack/openstack" version = "~> 1.53.0" } } } provider "openstack" { tenant_name = "cdtalpha" auth_url = "https://openstack.cyberrange.rit.edu:5000/v3/" } ``` -------------------------------- ### Define Inventory Structure in YAML Source: https://context7.com/guac0/2255-csec473-alpha/llms.txt Example YAML file defining the inventory structure for Ansible. It organizes hosts into groups based on their roles (e.g., `dc`, `mssql`, `apache2`, `mariadb`) and operating systems, facilitating targeted playbook execution. ```yaml # inventory.yaml - Example host definitions all: children: dc: hosts: canterlot: ansible_host: "10.0.10.1" mssql: hosts: manehatten: ansible_host: "10.0.10.2" apache2: hosts: ponyville: ansible_host: "10.0.10.3" mariadb: hosts: seaddle: ansible_host: "10.0.10.4" # OS-based groups windows: children: dc: mssql: linux: children: apache2: mariadb: # Scope groups inscope: children: dc: mssql: apache2: mariadb: ``` -------------------------------- ### CSS for Post Open Graph Preview Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/windows_iis/files/site/index.html This CSS styles the preview of a post's Open Graph (OG) data, typically shown for shared links. It includes styling for the main container, image, and details section, ensuring a responsive and well-organized layout. ```css .post__og{margin-bottom:12px}.post__og-link{text-decoration:none}.post__og-data-wrapper{border:1px solid var(--webeditor-border-color);border-radius:4px;display:flex}.post__og-image-container{flex:1;position:relative}.post__og-image-container,.post__og-image-wrapper{border-right:1px solid var(--webeditor-border-color)}.post__og-image{background-position:center;background-size:cover;border-bottom-left-radius:4px;border-top-left-radius:4px;display:block;height:100%;width:100%}.post__og-details{display:flex;flex:2;flex-direction:column;justify-content:space-between;overflow:hidden;overflow-wrap:break-word;padding:12px;position:relative}@media only screen and (min-width: 430px){.post__og-details{flex:3}}@media only screen and (min-width: 1024px){.post__og-details{padding:18px}} ``` -------------------------------- ### Get Query Variable Utility Function (JavaScript) Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/windows_iis/files/site/index_files/silver-surfer.htm The `getQueryVar` function retrieves and decodes a specific variable from the URL's query string. It uses regular expressions to find the variable and returns its value, or false if not found. This is useful for parsing URL parameters. ```javascript function getQueryVar(varName) { // Grab and unescape the query string - appending an '&' keeps the RegExp simple // for the sake of this example. var queryStr = unescape(window.location.search) + '&'; // Dynamic replacement RegExp var regex = new RegExp('.*?[&\\]?' + varName + '=(.*?)\\&.*'); // Apply RegExp to the query string var val = queryStr.replace(regex, '$1'); // If the string is the same, we didn't find a match - return false return val === queryStr ? false : val; } ``` -------------------------------- ### Pony Wings Game Initialization and Event Handling (JavaScript) Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/linux_nginx/files/index.html JavaScript code for initializing the Pony Wings game and handling user input. It includes variables for game state, canvas context setup, and preventing default actions for specific events to control game flow. ```javascript function BlockMove(event) { if(!gameIsLoaded || !menu.isGameOver){ event.preventDefault(); } } var gameIsLoaded = false; var gameIsMobile = false; var notHomeScreened = gameIsMobile && !window.navigator.standalone; var enterFrameRate = 1000/60; var drawFrameRate = 1000/60; canvas = document.getElementById('game'); ctx = canvas.getContext('2d'); hudCanvas = document.getElementById('hud'); hudCTX = hudCanvas.getContext('2d'); PWG.loadArtAssets(); PWG.init(); ``` -------------------------------- ### Create Application Launchers with Ansible Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/linux_client_programs/tasks/README.md Generates `.desktop` files for applications, which are used as shortcuts on Linux desktops. This task utilizes the `ansible.builtin.copy` module with the `content` parameter to define the structure and content of each launcher. It iterates over a list of applications, creating a separate launcher for each. ```ansible - name: Create app launchers in /etc/skel/Desktop ansible.builtin.copy: dest: "/etc/skel/Desktop/{{ item.filename }}" mode: "0755" content: | [Desktop Entry] Type=Application Name={{ item.name }} Exec={{ item.exec }} Terminal=false loop: - { name: "Thunderbird", filename: "Thunderbird.desktop", exec: "thunderbird" } - { name: "LibreOffice", filename: "LibreOffice.desktop", exec: "libreoffice" } - { name: "FileZilla", filename: "FileZilla.desktop", exec: "filezilla" } - { name: "HexChat", filename: "HexChat.desktop", exec: "hexchat" } become: true ``` -------------------------------- ### Get Bash Histories from Linux Hosts with Ansible Source: https://context7.com/guac0/2255-csec473-alpha/llms.txt Executes the 'history' tag on Ansible playbooks to retrieve bash histories from all Linux hosts. This is primarily used for auditing purposes to review command execution. It requires an inventory file (inventory.yaml) and a playbook file (playbook.yaml). ```bash # Get bash histories from Linux hosts (for auditing) ansible-playbook -i inventory.yaml playbook.yaml -t history ``` -------------------------------- ### Copy Launchers to User Desktops with Ansible Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/linux_client_programs/tasks/README.md Copies pre-created application launcher files from a central location (`/etc/skel/Desktop`) to the Desktop directory of each existing user. This task employs the `ansible.builtin.copy` module with `remote_src: true` and uses the `product()` filter to efficiently pair users with launcher files. It ensures that all specified users receive the application shortcuts. ```ansible - name: Copy launchers to each user Desktop ansible.builtin.copy: remote_src: true src: "/etc/skel/Desktop/{{ item.1 }}" dest: "/home/{{ item.0 }}/Desktop/{{ item.1 }}" owner: "{{ item.0 }}" group: "{{ item.0 }}" mode: "0755" loop: "{{ linux_desktop_users | product(['Thunderbird.desktop','LibreOffice.desktop','FileZilla.desktop','HexChat.desktop']) | list }}" when: item.0 in ansible_facts.getent_passwd become: true ``` -------------------------------- ### Validate Apache/DokuWiki Service using Python Source: https://context7.com/guac0/2255-csec473-alpha/llms.txt Python script to validate Apache/DokuWiki service availability by checking HTTP response. It sends a GET request to a specified URL and checks for a successful status code or expected text. Dependencies include the `urllib.request`, `socket`, and `sys` modules. ```python import urllib.request import socket import sys url = "http://10.0.10.3/doku.php?id=wiki:wikipage" def check_url(target_url, timeout=5.0, expected_text=None): req = urllib.request.Request(target_url, headers={"User-Agent": "apacheScoreCheck/1.0"}) try: with urllib.request.urlopen(req, timeout=timeout) as resp: status = getattr(resp, "status", None) body = resp.read() text = body.decode("utf-8", errors="replace") if expected_text and expected_text in text: return True, f"UP (status={status}) MATCHED_TEXT", 0 if 200 <= status < 400: return True, f"UP (status={status})", 0 return False, f"UNEXPECTED_STATUS (status={status})", 2 except Exception as e: return False, f"ERROR {e}", 1 # Run check up, message, code = check_url(url, timeout=5.0) print(f"{ 'OK' if up else 'FAIL'}: {message}") sys.exit(code) ``` -------------------------------- ### Plugin Configurations Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/windows_iis/files/site/index.html Configuration object for various plugins used on the website, including BrandMetricsPlugin, ConfiantPlugin, AverageHbPricePlugin, DoubleVerifyPlugin, and IasPublisherOptimizationPlugin. Each plugin has specific parameters and script URLs. ```javascript { "plugins": { "BrandMetricsPlugin": { "scriptUrl": "//cdn.brandmetrics.com/tag/9097a5369e204e6eac53b45c7dde13c5/fandom.com_au.js" }, "ConfiantPlugin": { "propertyId": "d-aIf3ibf0cYxCLB1HTWfBQOFEA" }, "AverageHbPricePlugin": { "slots": [ "top_leaderboard", "top_boxad" ] }, "DoubleVerifyPlugin": { "slotNamesToTrack": [ "top_leaderboard", "top_boxad", "incontent_boxad", "bottom_leaderboard", "incontent_leaderboard", "lightbox_leaderboard", "featured", "incontent_player" ] }, "IasPublisherOptimizationPlugin": { "watchedSlotList": [ "top_leaderboard", "top_boxad", "incontent_boxad", "incontent_leaderboard", "bottom_leaderboard", "lightbox_leaderboard", "featured", "incontent_player" ] } } } ``` -------------------------------- ### Load CSS and JS Modules for Fandom Desktop Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/windows_iis/files/site/index.html This snippet defines the CSS and JavaScript modules to be loaded for the Fandom Desktop skin. It includes various CSS files for different components and extensions, and a comprehensive list of JavaScript modules for features like user options, tokens, tracking, and global components. ```javascript RLPAGEMODULES=["ext.cite.ux-enhancements", "site", "mediawiki.page.ready", "jquery.makeCollapsible", "mediawiki.toc", "ext.fandom.DatacenterPreference.js", "ext.fandom.ServerSideExperiments.js", "ext.fandom.Track.js", "ext.visualEditor.desktopArticleTarget.init", "ext.visualEditor.targetLoader", "ext.checkUser.clientHints", "ext.fandom.FacebookTags.js", "ext.fandom.SilverSurferLoader.trackingWelcomeTool.js", "ext.fandom.ae.consentQueue.js", "ext.fandom.AgeGate.loader.js", "ext.fandom.AgeGate.messages", "ext.fandom.AnalyticsEngine.comscore.js", "ext.fandom.AnalyticsEngine.quantcast.js", "ext.categorySelect.js", "ext.categorySelectFandomDesktop.css", "ext.fandom.bannerNotifications.js", "ext.fandom.bannerNotifications.messages", "ext.fandom.bannerNotifications.techUpdateBanner.js", "ext.fandom.ContentReview.legacyLoaders.js", "ext.fandom.ContentReview.jsReload.js", "ext.fandom.site", "ext.fandom.ContentReviewTestModeMessages", "ext.fandom.ImportJs", "ext.fandom.UncrawlableUrl.anchors.js", "ext.fandom.TimeAgoMessaging.js", "ext.fandom.ImageGalleryIconModuleInit.js", "ext.fandom.Thumbnails.js", "ext.fandom.Thumbnails.messages", "ext.fandom.GTM.js", "ext.fandom.ArticleComments.messages", "ext.fandom.ArticleComments.desktop.js", "ext.tabView.editor.js", "ext.fandom.performanceMonitoring.js", "ext.fandom.ArticleInContentPlayer.desktop.js", "ext.fandom.HighlightToAction.js", "ext.fandom.HighlightToAction.messages", "ext.fandom.Sentry.loader.js", "ext.fandom.SuggestedPages.js", "ext.fandom.DiscordInterceptor.js", "skin.fandomdesktop.js", "skin.fandomdesktop.messages", "mediawiki.Uri", "ext.fandom.GlobalComponents.GlobalExploreNavigation.js", "ext.fandom.GlobalComponents.GlobalExploreNavigation.messages", "ext.fandom.GlobalComponents.GlobalTopNavigation.js", "ext.fandom.GlobalComponents.GlobalTopNavigation.messages", "ext.fandom.GlobalComponents.CommunityNavigation.js", "ext.fandom.GlobalComponents.GlobalFooter.js", "ext.fandom.GlobalComponents.CommunityHeader.js", "ext.fandom.GlobalComponents.StickyNavigation.js", "skin.fandomdesktop.rail.toggle.js", "skin.fandomdesktop.rail.lazyRail.js", "ext.fandom.nositenotice.js", "ext.fandom.Lightbox.js"] ``` -------------------------------- ### Retrieve RustDesk Connection Details for Jump Hosts Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/remoteaccess.txt This section displays the RustDesk connection information, including the ID and password, for various 'jumpblue' and 'jumpgrey' hosts. This data is crucial for establishing remote desktop connections. ```shell ok: [jumpblue1] => { "msg": "RustDesk ID: 507549506 -- Password: Friendship0!" } ok: [jumpblue2] => { "msg": "RustDesk ID: 514264008 -- Password: Friendship0!" } ok: [jumpblue3] => { "msg": "RustDesk ID: 515186532 -- Password: Friendship0!" } ok: [jumpblue4] => { "msg": "RustDesk ID: 513810519 -- Password: Friendship0!" } ok: [jumpblue5] => { "msg": "RustDesk ID: 515043480 -- Password: Friendship0!" } ok: [jumpblue6] => { "msg": "RustDesk ID: 1990674293 -- Password: Friendship0!" } ok: [jumpblue7] => { "msg": "RustDesk ID: 512381411 -- Password: Friendship0!" } ok: [jumpblue8] => { "msg": "RustDesk ID: 506287610 -- Password: Friendship0!" } ok: [jumpblue9] => { "msg": "RustDesk ID: 503963007 -- Password: Friendship0!" } ok: [jumpblue10] => { "msg": "RustDesk ID: 519436120 -- Password: Friendship0!" } ok: [jumpgrey1] => { "msg": "RustDesk ID: 515560629 -- Password: ponyuploc0!" } ok: [jumpgrey2] => { "msg": "RustDesk ID: 518635574 -- Password: ponyuploc0!" } ok: [jumpgrey3] => { "msg": "RustDesk ID: 505129719 -- Password: ponyuploc0!" } ok: [jumpgrey4] => { "msg": "RustDesk ID: 519002604 -- Password: ponyuploc0!" } ok: [jumpgrey5] => { "msg": "RustDesk ID: 513125055 -- Password: ponyuploc0!" } ok: [jumpgrey6] => { "msg": "RustDesk ID: 510578557 -- Password: ponyuploc0!" } ok: [jumpgrey7] => { "msg": "RustDesk ID: 1338717426 -- Password: ponyuploc0!" } ok: [jumpgrey8] => { "msg": "RustDesk ID: 514335282 -- Password: ponyuploc0!" } ok: [jumpgrey9] => { "msg": "RustDesk ID: 515088631 -- Password: ponyuploc0!" } ok: [jumpgrey10] => { "msg": "RustDesk ID: 516129048 -- Password: ponyuploc0!" } ``` -------------------------------- ### Host User Management Logic (JavaScript) Source: https://github.com/guac0/2255-csec473-alpha/blob/main/greyteam/roles/scoring_server/files/templates/editor.html Handles the loading and display of host users. It fetches user data based on a selected host ID and renders user information, including password update fields and buttons. It also includes logic to update user passwords via a POST request. ```javascript async function loadHosts() { const res = await fetch('/get_hosts'); const hosts = await res.json(); const list = document.getElementById('host-list'); list.innerHTML = hosts.map(h => `
` ).join(''); } async function loadScoringUsers(hostId, el) { document.querySelectorAll('#host-list .sidebar-item').forEach(i => i.classList.remove('active')); el.classList.add('active'); const res = await fetch(`/get_scoring_users?host_id=${hostId}`); const users = await res.json(); const workspace = document.getElementById('user-workspace'); workspace.innerHTML = users.map(u => `