查找CTakeDamageInfoGetWeaponName

tools-only2026-10-25查看 416复制 378

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

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.md3544 chars
---
name: find-CTakeDamageInfo_GetWeaponName
description: Find and identify the CTakeDamageInfo_GetWeaponName function in CS2 binary using IDA Pro MCP. Use this skill when reverse engineering CS2 server.dll or server.so to locate the GetWeaponName function by searching for the "_projectile" string reference and analyzing cross-references.
---

# Find CTakeDamageInfo_GetWeaponName

Locate `CTakeDamageInfo::GetWeaponName` in CS2 server.dll or server.so using IDA Pro MCP tools.

## Method

1. Search for the string "_projectile":

   ```
   mcp__ida-pro-mcp__find_regex pattern="_projectile"
   ```

   Look for the exact string `_projectile` (not the ones with prefixes like `flashbang_projectile`).

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

3. Decompile the referencing function and verify it matches this pattern:
   ```
   mcp__ida-pro-mcp__decompile addr="<function_addr>"
   ```

   The target function should contain code similar to:
   ```cpp
   if ( (unsigned __int8)sub_XXXXXXXX(v6) )
       return v6 + 7;
   v15 = sub_XXXXXXXX(v6, 95i64);  // 95 = '_' character
   v16 = v15;
   if ( !v15 || (unsigned int)V_stricmp_fast(v15, "_projectile") )
       return v6;
   sub_XXXXXXXX(&unk_XXXXXXXX, "%.*s", (unsigned int)(v16 - (_DWORD)v6), v6);
   return (char *)&unk_XXXXXXXX;
   ```

   Key characteristics:
   - Uses `V_stricmp_fast` to compare with `"_projectile"`
   - Uses `"%.*s"` format string for string manipulation
   - Returns a `const char*`

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

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`: `CTakeDamageInfo_GetWeaponName`
   - `func_addr`: The function address from step 3
   - `func_sig`: The validated signature from step 5

   Note: This is NOT a virtual function, so no vtable parameters are needed.

## Signature Pattern

The function contains:
- String comparison with `"_projectile"` using `V_stricmp_fast`
- Format string `"%.*s"` for extracting weapon name prefix
- Character search for `'_'` (95 decimal)

## Function Characteristics

- **Prototype**: `const char *CTakeDamageInfo::GetWeaponName(CTakeDamageInfo *pthis)`
- **Parameters**:
  - `pthis`: Pointer to the CTakeDamageInfo instance (this)
- **Return**: `const char*` - the weapon name with `_projectile` suffix stripped if present

## DLL Information

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

## Notes

- This is a regular member function, NOT a virtual function
- No vtable information is needed for this function

## Output YAML Format

The output YAML filename depends on the platform:
- `server.dll` → `CTakeDamageInfo_GetWeaponName.windows.yaml`
- `server.so` → `CTakeDamageInfo_GetWeaponName.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

登录后参与评论

还没有评论,来抢沙发吧