Skip to content

A Python script for logging into Steam using an authentication token. It automates Steam configuration file setup, locates the Steam installation via Windows registry, and decodes tokens. For educational use only; comply with Steam's terms to avoid policy violations.

Notifications You must be signed in to change notification settings

Winnie-ourson/Steam-Token-Login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Steam Token Login

Overview

The Steam Token Login script is a Python utility designed to facilitate logging into a Steam account using a provided authentication token. It automates the process of configuring Steam's local configuration files to authenticate a user without requiring manual password entry. The script interacts with the Windows registry to locate the Steam installation, decodes the provided token, and sets up necessary configuration files in Steam's userdata and config directories.

Note: This script is intended for educational purposes and should be used responsibly and in compliance with Steam's terms of service. Unauthorized use of tokens or account access may violate Steam's policies and applicable laws.

Features

  • Token-based Authentication: Logs into a Steam account using a provided authentication token.
  • Registry Integration: Automatically detects the Steam installation path via the Windows registry.
  • Configuration File Management: Creates and updates Steam configuration files (localconfig.vdf, config.vdf, loginusers.vdf, and local.vdf) to enable login.
  • SteamID Conversion: Supports multiple SteamID formats (SteamID, SteamID3, SteamID32, SteamID64) using the SteamID class.
  • Process Management: Terminates running Steam processes to ensure clean configuration updates.
  • Token Validation: Validates and decodes JWT tokens, handling encoding errors gracefully.
  • Encrypted Storage: Stores the token securely using Windows' CryptProtectData for local storage.

Prerequisites

  • Operating System: Windows (due to reliance on winreg and win32crypt).
  • Python Version: Python 3.6 or higher.
  • Required Libraries:
    • winreg (built-in)
    • pathlib (built-in)
    • vdf (for parsing and writing Valve Data Format files)
    • jwt (for decoding JSON Web Tokens)
    • win32crypt (via pywin32 for Windows encryption)
    • binascii (built-in)
    • zlib (built-in)
  • Steam Installation: A valid Steam client installation on the system.
  • Administrator Privileges: May be required to terminate Steam processes and write to certain directories.

Usage

  1. Run the script using Python:

    python login_steam.py
  2. When prompted, enter the Steam authentication token in the format <login>.<token_part>.

    • Example: username.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
    • The token must include a valid JWT with a sub field containing the SteamID.
  3. The script will:

    • Locate the Steam installation directory.
    • Terminate running Steam processes.
    • Decode the token to extract the SteamID.
    • Create or update necessary configuration files in the Steam directory.
    • Launch Steam with the configured login.
  4. Press Enter to exit the script after completion.

File Structure

  • login_steam.py: Main script containing the token login logic and SteamID conversion class.
  • README.md: This documentation file.
  • requirements.txt: List of required Python packages.

How It Works

  1. Token Input: The user provides a token in the format <login>.<token_part>.
  2. Steam Path Detection: The script queries the Windows registry (HKEY_CURRENT_USER\Software\Valve\Steam) to find the Steam installation path.
  3. Token Validation and Decoding:
    • Validates the token format (allowed characters: A-Z, a-z, 0-9, -, _, ., =).
    • Decodes the JWT token to extract the SteamID (sub field).
    • Handles encoding errors (UTF-8 and Windows-1251 fallback).
  4. SteamID Conversion: Uses the SteamID class to convert the provided SteamID into SteamID32 format for directory creation.
  5. Process Termination: Kills Steam-related processes (Steam.exe, steamwebhelper.exe, steamservice.exe) to prevent file access conflicts.
  6. Configuration Setup:
    • Creates the user's configuration directory (userdata\<SteamID32>\config).
    • Writes localconfig.vdf to disable streaming and friends sign-in.
    • Updates config.vdf and loginusers.vdf in the Steam config directory with account details.
    • Stores the encrypted token in %LOCALAPPDATA%\Steam\local.vdf using CryptProtectData.
  7. Steam Launch: Starts Steam using the steam://0 protocol.
  8. Error Handling: Provides detailed error messages for invalid tokens, missing Steam installations, or other issues.

SteamID Class

The SteamID class handles conversion between different SteamID formats:

  • Input: Accepts SteamID (e.g., STEAM_0:1:123456), SteamID3 (e.g., U:1:123456), SteamID32, or SteamID64.
  • Methods:
    • get_steam64_id(): Returns the 64-bit SteamID.
    • get_steam32_id(): Returns the 32-bit SteamID.
    • get_steam_id3(): Returns the SteamID3 format.
    • get_steam_id(): Returns the traditional SteamID format.
  • Error Handling: Raises InvalidSteamID for invalid inputs.

Example Token

A valid token might look like:

johndoe.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI3NjU2MTE5Nzk2MDI2NTcyOCIsImV4cCI6MTcyOTM4NzIwMH0.SIGNATURE
  • johndoe: The Steam account login name.
  • eyJhb...: The JWT token containing the SteamID in the sub field.

Limitations

  • Windows Only: Relies on Windows-specific libraries (winreg, win32crypt).
  • Token Dependency: Requires a valid JWT token with a sub field.
  • Steam Terms of Service: Using tokens to access accounts may violate Steam's policies. Use with caution.
  • No macOS/Linux Support: The script is not compatible with non-Windows systems due to registry and encryption dependencies.

Troubleshooting

  • "Steam directory not found": Ensure Steam is installed and has been run at least once to create registry entries.
  • "Invalid token format": Check that the token contains only allowed characters and includes a . separator.
  • "Decoded token does not contain 'sub' key": Verify that the JWT token includes a valid SteamID in the sub field.
  • Permission Issues: Run the script as an administrator if Steam processes cannot be terminated or files cannot be written.

Disclaimer

This script is provided for educational purposes only. The author is not responsible for any misuse or violation of Steam's terms of service. Use at your own risk.

About

A Python script for logging into Steam using an authentication token. It automates Steam configuration file setup, locates the Steam installation via Windows registry, and decodes tokens. For educational use only; comply with Steam's terms to avoid policy violations.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages