Openbullet2 Documentation

repository·master·Indexed 25 days ago

https://github.com/openbullet/openbullet2

Documentation for Openbullet2 and its associated RuriLib libraries. Includes RuriLib.Http for advanced .NET HTTP client capabilities with curl-impersonate and proxy support, RuriLib.Parallelization for asynchronous task processing with dynamic Degree of Parallelism (DoP), and RuriLib.Proxies for raw TCP connection proxying across HTTP and SOCKS protocols. Also covers the Openbullet2WebClient Angular project development and build process.

Tokens
14.3K
Snippets
36
Records
79
Agent score
81%

What's inside Openbullet2

  1. Overview of RuriLib.Http features

    master

    RuriLib.Http is a library providing specialized HTTP client capabilities built on top of RuriLib.Proxies. Key features include:

    • Custom proxied HTTP client: Using RLHttpClient.
    • HttpMessageHandler integration: Use ProxyClientHandler with the standard System.Net.Http.HttpClient.
    • curl-impersonate integration: Provides browser-like TLS and HTTP fingerprints via CurlImpersonateHttpClient.
    • Proxy Support: Supports HTTP, SOCKS, and proxiless connections.
    • Response Decoding: Automatic decoding for gzip, deflate, brotli, and zstd.
    • Cookie Management: Built-in cookie parsing and CookieContainer support.
  2. Manage shared state and locking in globals

    master

    Use globals only for values that must be shared across all bots (e.g., auth tokens produced at startup, counters, caches, or shared resources). If multiple bots mutate the same shared value, you must use locking to prevent race conditions:

    • Synchronous critical sections: Use LOCK globals.
    • Asynchronous critical sections: Use ACQUIRELOCK globals combined with a TRY / FINALLY / RELEASELOCK pattern.
  3. How Script block interop works

    master

    The Script block allows LoliCode to interoperate with external runtimes like NodeJS, Python, IronPython, or Jint.

    Key Mechanics:

    • INPUT: Explicitly copies selected OB2 variables into the foreign runtime.
    • OUTPUT: Marshals values from the foreign runtime back into OB2 variables.
    • Best Practice: Keep the interface narrow. Instead of passing many values, pass only what is necessary. For complex nested structures, serialize them to JSON strings manually before passing them through the interop boundary.

    Variable Availability:

    • In the main script, you can use input, data, and globals.
    • In the startup script, only globals is available.
    BLOCK:Script
    INTERPRETER:Python
    INPUT x,y
    BEGIN SCRIPT
    result = x + y
    END SCRIPT
    OUTPUT Int @result
    ENDBLOCK
  4. How RuriLib.Proxies works

    master

    RuriLib.Proxies is a library designed to proxy a TcpClient through various proxy protocols. Instead of handling high-level HTTP requests directly, this library provides a proxied raw TCP connection.

    Supported Protocols:

    • HTTP
    • SOCKS4
    • SOCKS4a
    • SOCKS5
    • No proxy

    When to use this library:

    • Use this if you need to work with raw TCP connections.
    • Use this if you intend to feed the resulting TcpClient into another library that supports higher-layer protocols.
    • Do not use this library directly if your goal is simply to send standard HTTP requests; instead, use the RuriLib.Http library, which is built on top of this one.
  5. Understand the OpenBullet2 execution model

    master

    When authoring a config, you must distinguish between the startup script and the main script, as well as between per-bot state and shared state:

    • Startup Script: Runs exactly once before any bots start.
    • Main Script: Runs once per bot. In multi-run jobs, many bots execute this script in parallel.
    • Per-bot state: input and data are unique to each bot.
    • Shared state: globals is shared across all bots.

    Warning: A script that works in the Debugger (which uses only one bot where data.BOTNUM is 0) may fail in a Multi-run job if it attempts to mutate shared state (globals) without proper synchronization.

  6. When to use Blocks vs C# in OB2

    master

    Deciding between LoliCode blocks and inline C# depends on the complexity of the task:

    Use Blocks when:

    • A standard block exists for the operation (e.g., requests, parsing, keycheck, constants, random values).
    • You want built-in UI semantics or safer parameter typing.

    Use Inline C# when:

    • You need glue logic between blocks.
    • You need LINQ, regex, custom parsing, or complex branching.
    • You need to work with .NET types directly.
    • No existing block provides the required behavior.
  7. Understand the Wordlist validation and parsing order

    master

    Wordlist processing follows a specific sequence to transform raw data into usable variables. Understanding this order is critical for deciding whether to use environment-level regex or config-level data rules.

    1. Raw Validation: The raw data line is checked against the selected wordlist type's regex.
    2. Slicing: If validation passes, the line is split into parts using the configured Separator.
    3. Variable Assignment: The resulting slices are assigned to input.* variables (e.g., input.KEYWORD).
    4. Data Rule Application: Config-level data rules are applied to the parsed slices.

    Key Distinction: Environment-level regex validates the raw line shape, whereas config-level data rules validate the already parsed slices.

  8. Configure wordlist slices via Environment.ini

    master

    Config behavior depends heavily on the wordlist types defined in the environment. A wordlist type determines how raw lines are parsed into input.* variables using Slices.

    Example Environment.ini configuration:

    [WORDLIST TYPE]
    Name=Credentials
    Regex=^.*:.*$
    Verify=True
    Separator=:
    Slices=USERNAME,PASSWORD

    With the above configuration, a wordlist line like john:secret will automatically produce:

    • input.USERNAME = "john"
    • input.PASSWORD = "secret"

    Note: Changing Environment.ini requires an OB2 restart.

  9. Understand the structure of an OpenBullet 2 Config

    master

    An OpenBullet 2 (OB2) config is a multi-part object that contains more than just a script. It consists of:

    • metadata: Information such as name, author, and category.
    • settings: Configuration for the config, including allowed wordlist types, custom inputs, proxy defaults, resources, data rules, and script usings.
    • main script: The core per-bot logic that executes for every bot in a run.
    • startup script (optional): Shared initialization logic that runs once before any bots start. This is used for setting up shared state.
    • readme (optional): Human-readable usage notes for operators.
  10. ProxyClient implementations and ProxySettings

    master

    All proxy clients in this library derive from the ProxyClient base class. You can instantiate specific clients based on your proxy protocol using a ProxySettings object.

    ProxySettings Configuration

    Use the ProxySettings class to define connection parameters:

    • Host: The proxy server address.
    • Port: The proxy server port.
    • ConnectTimeout: TimeSpan defining how long to wait for a connection.
    • ReadWriteTimeOut: TimeSpan defining the timeout for read/write operations.
    • Credentials: An optional NetworkCredential object for proxies requiring authentication.

    Available Proxy Clients

    Depending on your protocol, instantiate one of the following from RuriLib.Proxies.Clients:

    • HttpProxyClient(settings)
    • Socks4ProxyClient(settings)
    • Socks4aProxyClient(settings)
    • Socks5ProxyClient(settings)
    • NoProxyClient(settings)
  11. Understand LoliCode basics and C# integration

    master

    LoliCode is the primary scripting language for OpenBullet 2. It serves as the representation used by the Stacker UI, but it is more powerful than just a collection of blocks.

    Key characteristics:

    • Hybrid Scripting: A single script can contain LoliCode blocks, standalone LoliCode statements, and plain C# code side-by-side.
    • Compilation: LoliCode compiles to C# when a configuration runs.
    • Extensibility: While blocks are used for standard OpenBullet 2 operations, you can use inline C# as an "escape hatch" to implement custom logic, helper methods, or to access .NET APIs that are not exposed via standard blocks.
    int Add(int first, int second)
    {
      return first + second;
    }
    
    BLOCK:RandomInteger
      minimum = 0
      maximum = 10
      => VAR @num1
    ENDBLOCK
    
    int result = Add(num1, 5);
    LOG $"Result: {result}"