查找网络状态变更

tools-only2026-10-25查看 838复制 319

使用 IDA Pro MCP 在 CS2 二进制文件中查找并识别 NetworkStateChanged 函数。在逆向工程 CS2 server.dll 或 server.so 以通过搜索 "light_capsule" 字符串引用并分析交叉引用来定位 NetworkStateChanged 函数时使用此技能。

Download (.md)

📘如何使用这个技能

  1. 1
    复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
  2. 2
    打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
  3. 3
    粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
  4. 4
    直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景

💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。

SKILL.md3779 chars
---
name: find-NetworkStateChanged
description: Find and identify the NetworkStateChanged function in CS2 binary using IDA Pro MCP. Use this skill when reverse engineering CS2 server.dll or server.so to locate the NetworkStateChanged function by searching for the "light_capsule" string reference and analyzing cross-references.
---

# Find NetworkStateChanged

Locate `NetworkStateChanged` in CS2 server.dll or server.so using IDA Pro MCP tools.

## Method

1. Search for the string:
   ```
   mcp__ida-pro-mcp__find_regex pattern="light_capsule"
   ```

2. Get cross-references to the string:
   ```
   mcp__ida-pro-mcp__xrefs_to addrs="<string_addr>"
   ```

3. Decompile the referencing function:
   ```
   mcp__ida-pro-mcp__decompile addr="<function_addr>"
   ```

   The target function should contain:
   - Multiple `V_stricmp_fast` calls comparing against light type strings:
     - `"light_omni"`
     - `"light_capsule"`
     - `"light_spot"`
     - `"light_ortho"`
     - `"light_directional"`
     - `"light_environment"`
   - Sets a light type value (1-4) based on the string comparison
   - Contains a network state notification call at the end

   Example pattern:
   ```cpp
   if ( (unsigned int)V_stricmp_fast(v6, "light_omni") )
   {
       if ( (unsigned int)V_stricmp_fast(v6, "light_capsule") )
       {
           // ... more light type checks
       }
       else
       {
           v7 = 1;
       }
   }
   // ...
   *(_DWORD *)(a1 + 112) = v7;
   // ...
   v11 = V_stricmp_fast(v3, "light_capsule");
   *(_BYTE *)(a1 + 116) = v11 == 0;
   if ( v12 && ... )
   {
       sub_XXXXXXXX(a1 + 413, -1, -1);  // Internal notification call
       *(_BYTE *)(a1 + 413) = 1;
   }
   ```

4. Rename the function:
   ```
   mcp__ida-pro-mcp__rename batch={"func": [{"addr": "<function_addr>", "name": "NetworkStateChanged"}]}
   ```

5. Generate and validate unique signature:

   **ALWAYS** Use SKILL `/generate-signature-for-function` to generate a robust and unique signature for the function.

6. Write IDA analysis output as YAML beside the binary:

   **ALWAYS** Use SKILL `/write-func-as-yaml` to write the analysis results.

   Required parameters:
   - `func_name`: `NetworkStateChanged`
   - `func_addr`: The function address from step 3
   - `func_sig`: The validated signature from step 5

## Function Characteristics

- **Prototype**: `void NetworkStateChanged(void *chainEntity, int offset, int a3)`
- **Parameters**:
  - `chainEntity`: Pointer to the entity/component being updated
  - `offset`: Offset parameter for network state tracking
- **Return**: char (1 on success)

## Key Behaviors

1. Compares input string against various light type names
2. Sets appropriate light type enum value (0-4)
3. Stores `light_capsule` comparison result as a flag
4. Triggers internal network state notification when conditions are met
5. Called when light entity properties change to notify the network system

## DLL Information

- **DLL**: `server.dll` (Windows) / `server.so` (Linux)

## Notes

- This is NOT a virtual function
- The function handles light type classification and network state updates
- Contains multiple string comparisons for different light types

## Output YAML Format

The output YAML filename depends on the platform:
- `server.dll` → `NetworkStateChanged.windows.yaml`
- `server.so` → `NetworkStateChanged.linux.yaml`

```yaml
func_va: 0x180XXXXXX      # Virtual address of the function - This can change when game updates.
func_rva: 0xXXXXXX        # Relative virtual address (VA - image base) - This can change when game updates.
func_size: 0xXXX          # Function size in bytes - This can change when game updates.
func_sig: XX XX XX XX XX  # Unique byte signature for pattern scanning - This can change when game updates.
```
来源:skillsdirectory

评论0

登录后参与评论

还没有评论,来抢沙发吧