|
分享源码
界面截图: |
- |
是否带模块: |
纯源码 |
备注说明: |
- |
本帖最后由 11665583 于 2021-4-23 17:17 编辑
通过系统提供的命令 GetCommandLineA GetCommandLineW 获取到内存里命令行保存的地址,进而来读取或修改其他进程的命令地址.
因为进程内是保存了ansi 跟unicode两种字符串,所以对应的也就提供了2个查询及修改的命令.
缺了个常量,现在补上了.. 其实常量名子都没改,直接百度可以搜到的.
窗口程序集名 | 保 留 | 保 留 | 备 注 | 窗口程序集_启动窗口 | | | | SetProcessCommandLine_A (7788, 到字节集 (“kslkjljljkjsdf”)) SetProcessCommandLine_W (7788, 编码_Ansi到Unicode (“ABCDDEFDSFSF”)) 调试输出 (GetProcessCommandLine_A (7788 )) 调试输出 (GetProcessCommandLine_W (7788 )) |
GetProcessCommandLine_A | 文本型 | | |
pid | 整数型 | | | |
变量名 | 类 型 | 静态 | 数组 | 备 注 | lProcess | 整数型 | | | mod | 整数型 | | | lpAddr | 整数型 | | | disAddr | 整数型 | | | tmp | 字节集 | | | dwPos | 整数型 | | | bRet | 整数型 | | | pCmdLine | 字节集 | | |
dwPos = 1 pCmdLine = 取空白字节集 ( #MAX_PATH )lProcess = OpenProcess ( #PROCESS_VM_READ, 0, pid )如果真 (lProcess ≤ 0 ) 返回 (“”)
mod = GetModuleHandle (“kernel32”)lpAddr = GetProcAddress (mod, “GetCommandLineA”)tmp = 指针到字节集 (lpAddr, 30 )如果真 (tmp [dwPos ] = 235 且 tmp [dwPos + 1 ] = 5 )dwPos = dwPos + 7 如果真 (tmp [dwPos ] = 255 且 tmp [dwPos + 1 ] = 37 )dwPos = dwPos + 2 lpAddr = 指针到整数 (lpAddr + dwPos - 1 )lpAddr = 指针到整数 (lpAddr )dwPos = 1 tmp = 指针到字节集 (lpAddr, 30 )如果真 (tmp [dwPos ] = 161 )lpAddr = 指针到整数 (lpAddr + dwPos )bRet = ReadProcessMemory (lProcess, lpAddr, disAddr, 4, 0 )如果真 (bRet > 0 )bRet = ReadProcessMemory_字节集 (lProcess, disAddr, pCmdLine, #MAX_PATH, 0 )CloseHandle (lProcess )返回 (到文本 (pCmdLine )) |
SetProcessCommandLine_A | | | |
pid | 整数型 | | | | strCmdLine | 字节集 | | | |
变量名 | 类 型 | 静态 | 数组 | 备 注 | lProcess | 整数型 | | | mod | 整数型 | | | lpAddr | 整数型 | | | disAddr | 整数型 | | | tmp | 字节集 | | | dwPos | 整数型 | | | bRet | 整数型 | | | OldProtect | 整数型 | | |
strCmdLine = strCmdLine + { 0, 0 }dwPos = 1 lProcess = OpenProcess ( #PROCESS_ALL_ACCESS, 0, pid )如果真 (lProcess ≤ 0 ) 返回 ()
mod = GetModuleHandle (“kernel32”)lpAddr = GetProcAddress (mod, “GetCommandLineA”)tmp = 指针到字节集 (lpAddr, 30 )如果真 (tmp [dwPos ] = 235 且 tmp [dwPos + 1 ] = 5 )dwPos = dwPos + 7 如果真 (tmp [dwPos ] = 255 且 tmp [dwPos + 1 ] = 37 )dwPos = dwPos + 2 lpAddr = 指针到整数 (lpAddr + dwPos - 1 )lpAddr = 指针到整数 (lpAddr )dwPos = 1 tmp = 指针到字节集 (lpAddr, 30 )如果真 (tmp [dwPos ] = 161 )lpAddr = 指针到整数 (lpAddr + dwPos )bRet = ReadProcessMemory (lProcess, lpAddr, disAddr, 4, 0 )如果真 (bRet > 0 )bRet = API_VirtualProtectEx (lProcess, disAddr, 1024, #PAGE_EXECUTE_READWRITE, OldProtect )调试输出 (取字节集长度 (strCmdLine )) WriteProcessMemory (lProcess, disAddr, 字节集_取指针 (strCmdLine ), 取字节集长度 (strCmdLine ), 0 )VirtualProtectEx (lProcess, disAddr, 4096, OldProtect, OldProtect )CloseHandle (lProcess )|
GetProcessCommandLine_W | 文本型 | | |
pid | 整数型 | | | |
变量名 | 类 型 | 静态 | 数组 | 备 注 | lProcess | 整数型 | | | mod | 整数型 | | | lpAddr | 整数型 | | | disAddr | 整数型 | | | tmp | 字节集 | | | dwPos | 整数型 | | | bRet | 整数型 | | | pCmdLine | 字节集 | | | c | 文本型 | | |
dwPos = 1 pCmdLine = 取空白字节集 ( #MAX_PATH )lProcess = OpenProcess ( #PROCESS_VM_READ, 0, pid )如果真 (lProcess ≤ 0 ) 返回 (“”)
mod = GetModuleHandle (“kernel32”)lpAddr = GetProcAddress (mod, “GetCommandLineW”)tmp = 指针到字节集 (lpAddr, 30 )如果真 (tmp [dwPos ] = 235 且 tmp [dwPos + 1 ] = 5 )dwPos = dwPos + 7 如果真 (tmp [dwPos ] = 255 且 tmp [dwPos + 1 ] = 37 )dwPos = dwPos + 2 lpAddr = 指针到整数 (lpAddr + dwPos - 1 )lpAddr = 指针到整数 (lpAddr )dwPos = 1 tmp = 指针到字节集 (lpAddr, 30 )如果真 (tmp [dwPos ] = 161 )lpAddr = 指针到整数 (lpAddr + dwPos )bRet = ReadProcessMemory (lProcess, lpAddr, disAddr, 4, 0 )如果真 (bRet > 0 )bRet = ReadProcessMemory_字节集 (lProcess, disAddr, pCmdLine, #MAX_PATH, 0 )CloseHandle (lProcess )返回 (编码_Unicode到Ansi (pCmdLine )) |
SetProcessCommandLine_W | | | |
pid | 整数型 | | | | strCmdLine | 字节集 | | | |
变量名 | 类 型 | 静态 | 数组 | 备 注 | lProcess | 整数型 | | | mod | 整数型 | | | lpAddr | 整数型 | | | disAddr | 整数型 | | | tmp | 字节集 | | | dwPos | 整数型 | | | bRet | 整数型 | | | OldProtect | 整数型 | | |
strCmdLine = strCmdLine + { 0, 0 }dwPos = 1 lProcess = OpenProcess ( #PROCESS_ALL_ACCESS, 0, pid )如果真 (lProcess ≤ 0 ) 返回 ()
mod = GetModuleHandle (“kernel32”)lpAddr = GetProcAddress (mod, “GetCommandLineW”)tmp = 指针到字节集 (lpAddr, 30 )如果真 (tmp [dwPos ] = 235 且 tmp [dwPos + 1 ] = 5 )dwPos = dwPos + 7 如果真 (tmp [dwPos ] = 255 且 tmp [dwPos + 1 ] = 37 )dwPos = dwPos + 2 lpAddr = 指针到整数 (lpAddr + dwPos - 1 )lpAddr = 指针到整数 (lpAddr )dwPos = 1 tmp = 指针到字节集 (lpAddr, 30 )如果真 (tmp [dwPos ] = 161 )lpAddr = 指针到整数 (lpAddr + dwPos )bRet = ReadProcessMemory (lProcess, lpAddr, disAddr, 4, 0 )如果真 (bRet > 0 )bRet = API_VirtualProtectEx (lProcess, disAddr, 1024, #PAGE_EXECUTE_READWRITE, OldProtect )调试输出 (取字节集长度 (strCmdLine )) WriteProcessMemory (lProcess, disAddr, 字节集_取指针 (strCmdLine ), 取字节集长度 (strCmdLine ), 0 )VirtualProtectEx (lProcess, disAddr, 4096, OldProtect, OldProtect )CloseHandle (lProcess )
|
评分
-
查看全部评分
|