Xbox One Telnet Into Console Linux / Windows

Clumsy

Member
Here is how I found this so I automated it

https://www.youtube.com/shorts/B5UdtRTW3aQ


The Following is for linux users


Script Name: console_network_setup.sh
Description:

The console_network_setup.sh script automates the process of configuring network settings and user authentication for a gaming console on your network. This script:

  1. Checks for Necessary Tools: It ensures that arp-scan and expect are installed on your system. If any of these tools are missing, it prompts you to install them.
  2. Prompts for Console MAC Address: It interactively asks for the MAC address of the console, ensuring that the user does not need to edit the script.
  3. Scans the Network: Utilizes arp-scan to identify devices on the local network and finds the IP address associated with the provided MAC address.
  4. Generates a Configuration File: Creates a configuration file (config.conf) with specified network settings and includes the IP address of the console.
  5. Telnet Authentication: Uses the expect tool to automate Telnet login to the console for two predefined users (xbox and flash), verifying the connection and authentication.
  6. Displays the Configuration File: Outputs the generated configuration file content for verification.
  7. Cleans Up: Removes temporary files created during the network scan process.
    Code:
    #!/bin/bash
    
    # Ensure necessary tools are installed
    REQUIRED_TOOLS=("arp-scan" "expect")
    for tool in "${REQUIRED_TOOLS[@]}"; do
        if ! command -v $tool &> /dev/null; then
            echo "$tool is required but not installed. Please install it first using:"
            echo "  sudo apt-get install $tool"
            exit 1
        fi
    done
    
    # Prompt the user to enter the MAC address of the console
    read -p "Please enter the MAC address of the console (format: xx:xx:xx:xx:xx:xx): " CONSOLE_MAC
    
    # Validate MAC address format
    if [[ ! $CONSOLE_MAC =~ ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$ ]]; then
        echo "Invalid MAC address format."
        exit 1
    fi
    
    # Scan the network to find the console's IP
    echo "Scanning the network to find the console IP..."
    arp-scan --localnet > arp_scan_results.txt
    
    # Extract the IP of the console
    CONSOLE_IP=$(grep -i $CONSOLE_MAC arp_scan_results.txt | awk '{print $1}')
    
    if [ -z "$CONSOLE_IP" ]; then
        echo "Console IP not found. Ensure the console is on and connected to the network."
        exit 1
    fi
    
    echo "Console IP found: $CONSOLE_IP"
    
    # Telnet authentication function
    telnet_auth() {
        local USER=$1
        local PASS=$2
    
        expect <<EOF
    spawn telnet $CONSOLE_IP
    expect "login: "
    send "$USER\r"
    expect "Password: "
    send "$PASS\r"
    expect ">"
    send "exit\r"
    expect eof
    EOF
    }
    
    # Define the configuration file path
    CONFIG_FILE="config.conf"
    
    # Write the configuration settings to the file
    echo "BindPort 21" > $CONFIG_FILE
    echo "CommandTimeout 300" >> $CONFIG_FILE
    echo "ConnectTimeout 15" >> $CONFIG_FILE
    echo "MaxConnections 20" >> $CONFIG_FILE
    echo "" >> $CONFIG_FILE
    
    # Add user configurations
    echo "<User \"xbox\">" >> $CONFIG_FILE
    echo "    Password \"xbox\"" >> $CONFIG_FILE
    echo "    IP \"$CONSOLE_IP\"" >> $CONFIG_FILE
    echo "</User>" >> $CONFIG_FILE
    echo "<User \"flash\">" >> $CONFIG_FILE
    echo "    Password \"flash\"" >> $CONFIG_FILE
    echo "    IP \"$CONSOLE_IP\"" >> $CONFIG_FILE
    echo "</User>" >> $CONFIG_FILE
    
    # Authenticate users via Telnet
    telnet_auth "xbox" "xbox"
    telnet_auth "flash" "flash"
    
    # Print the configuration file to confirm
    cat $CONFIG_FILE
    
    # Clean up
    rm arp_scan_results.txt
    
    echo "Script completed successfully. Configuration file created at $CONFIG_FILE."
    How to Use
    Install Necessary Tools
    Ensure arp-scan and expect are installed by running

    sudo apt-get install arp-scan expect

    Run the Script
    Save the script to a file named console_network_setup.sh, make it executable, and run it.

    chmod +x console_network_setup.sh
    ./console_network_setup.sh


    Follow Prompts
    When prompted, enter the MAC address of the console in the format xx:xx:xx:xx:xx:xx.

    The script will handle the rest, including network scanning, IP extraction, Telnet authentication, and configuration file creation.


    For Windows Users

    For network scanning, we can use arp and for Telnet automation, we can use plink (PuTTY Link), which is a command-line interface to the PuTTY backend.

    Ensure MinGW and necessary tools are installed: MinGW, PuTTY (plink), and the Telnet client must be installed and available in the PATH.

    Use arp for network scanning: arp -a is a common command on Windows to list ARP table entries.

    Use plink for Telnet automation: PuTTY's plink can automate Telnet sessions similarly to expect.

    Script Content for Windows (MinGW)

    Code:
    #!/bin/bash
    
    # Function to check if necessary tools are installed
    check_tools() {
        local REQUIRED_TOOLS=("plink" "arp")
        for tool in "${REQUIRED_TOOLS[@]}"; do
            if ! command -v $tool &> /dev/null; then
                echo "$tool is required but not installed. Please install it first."
                if [ "$tool" == "plink" ]; then
                    echo "Download and install PuTTY from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html"
                fi
                exit 1
            fi
        done
    }
    
    # Function to prompt user for MAC address
    get_mac_address() {
        read -p "Please enter the MAC address of the console (format: xx-xx-xx-xx-xx-xx): " CONSOLE_MAC
        if [[ ! $CONSOLE_MAC =~ ^([0-9A-Fa-f]{2}-){5}([0-9A-Fa-f]{2})$ ]]; then
            echo "Invalid MAC address format."
            exit 1
        fi
        echo $CONSOLE_MAC
    }
    
    # Function to scan network and find console IP
    find_console_ip() {
        local MAC_ADDRESS=$1
        echo "Scanning the network to find the console IP..."
        arp -a > arp_scan_results.txt
        local IP=$(grep -i $MAC_ADDRESS arp_scan_results.txt | awk '{print $2}' | tr -d '()')
        if [ -z "$IP" ]; then
            echo "Console IP not found. Ensure the console is on and connected to the network."
            exit 1
        fi
        echo $IP
    }
    
    # Function to perform Telnet authentication
    telnet_auth() {
        local IP=$1
        local USER=$2
        local PASS=$3
        plink -telnet $IP -l $USER -pw $PASS exit
    }
    
    # Main script execution
    main() {
        # Check for required tools
        check_tools
    
        # Get MAC address from user
        CONSOLE_MAC=$(get_mac_address)
    
        # Find console IP
        CONSOLE_IP=$(find_console_ip $CONSOLE_MAC)
        echo "Console IP found: $CONSOLE_IP"
    
        # Define the configuration file path
        CONFIG_FILE="config.conf"
    
        # Write the configuration settings to the file
        echo "BindPort 21" > $CONFIG_FILE
        echo "CommandTimeout 300" >> $CONFIG_FILE
        echo "ConnectTimeout 15" >> $CONFIG_FILE
        echo "MaxConnections 20" >> $CONFIG_FILE
        echo "" >> $CONFIG_FILE
    
        # Add user configurations
        echo "<User \"xbox\">" >> $CONFIG_FILE
        echo "    Password \"xbox\"" >> $CONFIG_FILE
        echo "    IP \"$CONSOLE_IP\"" >> $CONFIG_FILE
        echo "</User>" >> $CONFIG_FILE
        echo "<User \"flash\">" >> $CONFIG_FILE
        echo "    Password \"flash\"" >> $CONFIG_FILE
        echo "    IP \"$CONSOLE_IP\"" >> $CONFIG_FILE
        echo "</User>" >> $CONFIG_FILE
    
        # Authenticate users via Telnet
        telnet_auth $CONSOLE_IP "xbox" "xbox"
        telnet_auth $CONSOLE_IP "flash" "flash"
    
        # Print the configuration file to confirm
        cat $CONFIG_FILE
    
        # Clean up
        rm arp_scan_results.txt
    
        echo "Script completed successfully. Configuration file created at $CONFIG_FILE."
    }
    
    # Execute the main function
    main


    How to Use:
    Install Necessary Tools:

    MinGW: Install MinGW from MinGW.org.
    PuTTY (plink): Download and install PuTTY from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html.

    Enable Telnet Client on Windows

    Open Control Panel > Programs > Turn Windows features on or off.
    Check the box for "Telnet Client" and click OK.

    Run the Script

    Save the script to a file named console_network_setup.sh, and run it using the MinGW shell

    sh console_network_setup.sh

 
If you are having trouble with the windows script I have updated it to work without PuTTY

Code:
#!/bin/bash

# Function to check if necessary tools are installed
check_tools() {
    local REQUIRED_TOOLS=("telnet" "grep" "awk" "arp")
    for tool in "${REQUIRED_TOOLS[@]}"; do
        if ! command -v $tool &> /dev/null; then
            echo "$tool is required but not installed. Please install it first."
            if [ "$tool" == "telnet" ]; then
                echo "For Windows, you can enable Telnet Client from 'Turn Windows features on or off' in the Control Panel."
            elif [ "$tool" == "arp" ]; then
                echo "ARP should be available by default in Windows. Ensure you are using MinGW with network capabilities."
            fi
            exit 1
        fi
    done
}

# Function to prompt user for MAC address
get_mac_address() {
    read -p "Please enter the MAC address of the console (format: xx:xx:xx:xx:xx:xx): " CONSOLE_MAC
    if [[ ! $CONSOLE_MAC =~ ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$ ]]; then
        echo "Invalid MAC address format."
        exit 1
    fi
    echo $CONSOLE_MAC
}

# Function to scan network and find console IP
find_console_ip() {
    local MAC_ADDRESS=$1
    echo "Scanning the network to find the console IP..."
    arp -a > arp_scan_results.txt
    local IP=$(grep -i $(echo $MAC_ADDRESS | tr ':' '-') arp_scan_results.txt | awk '{print $2}' | tr -d '()')
    if [ -z "$IP" ]; then
        echo "Console IP not found. Ensure the console is on and connected to the network."
        exit 1
    fi
    echo $IP
}

# Function to perform Telnet authentication
telnet_auth() {
    local IP=$1
    local USER=$2
    local PASS=$3
    {
        echo open $IP
        sleep 1
        echo $USER
        sleep 1
        echo $PASS
        sleep 1
        echo exit
    } | telnet
}

# Main script execution
main() {
    # Check for required tools
    check_tools

    # Get MAC address from user
    CONSOLE_MAC=$(get_mac_address)

    # Find console IP
    CONSOLE_IP=$(find_console_ip $CONSOLE_MAC)
    echo "Console IP found: $CONSOLE_IP"

    # Define the configuration file path
    CONFIG_FILE="config.conf"

    # Write the configuration settings to the file
    echo "BindPort 21" > $CONFIG_FILE
    echo "CommandTimeout 300" >> $CONFIG_FILE
    echo "ConnectTimeout 15" >> $CONFIG_FILE
    echo "MaxConnections 20" >> $CONFIG_FILE
    echo "" >> $CONFIG_FILE

    # Add user configurations
    echo "<User \"xbox\">" >> $CONFIG_FILE
    echo "    Password \"xbox\"" >> $CONFIG_FILE
    echo "    IP \"$CONSOLE_IP\"" >> $CONFIG_FILE
    echo "</User>" >> $CONFIG_FILE
    echo "<User \"flash\">" >> $CONFIG_FILE
    echo "    Password \"flash\"" >> $CONFIG_FILE
    echo "    IP \"$CONSOLE_IP\"" >> $CONFIG_FILE
    echo "</User>" >> $CONFIG_FILE

    # Authenticate users via Telnet
    telnet_auth $CONSOLE_IP "xbox" "xbox"
    telnet_auth $CONSOLE_IP "flash" "flash"

    # Print the configuration file to confirm
    cat $CONFIG_FILE

    # Clean up
    rm arp_scan_results.txt

    echo "Script completed successfully. Configuration file created at $CONFIG_FILE."
}

# Execute the main function
main

This code should work on MINGW no problem
 
Top Bottom