龙马谷

 找回密码
 立即注册

QQ登录

只需一步,快速开始

龙马谷VIP会员办理客服QQ:82926983(如果临时会话没有收到回复,请先加QQ好友再发。)
1 [已完结] GG修改器新手入门与实战教程 31课 2 [已完结] GG修改器美化修改教程 6课 3 [已完结] GG修改器Lua脚本新手入门教程 12课
4 [已完结] 触动精灵脚本新手入门必学教程 22课 5 [已完结] 手游自动化脚本入门实战教程 9课 6 [已完结] C++射击游戏方框骨骼透视与自瞄教程 27课
7 [已完结] C++零基础UE4逆向开发FPS透视自瞄教程 29课 8 [已完结] C++零基础大漠模拟器手游自动化辅助教程 22课 9 [已完结] C++零基础开发DXF内存脚本辅助教程 32课
以下是天马阁VIP教程,本站与天马阁合作,赞助VIP可以获得天马阁对应VIP会员,名额有限! 点击进入天马阁论坛
1 [已完结] x64CE与x64dbg入门基础教程 7课 2 [已完结] x64汇编语言基础教程 16课 3 [已完结] x64辅助入门基础教程 9课
4 [已完结] C++x64内存辅助实战技术教程 149课 5 [已完结] C++x64内存检测与过检测技术教程 10课 6 [已完结] C+x64二叉树分析遍历与LUA自动登陆教程 19课
7 [已完结] C++BT功能原理与x64实战教程 29课 8 [已完结] C+FPS框透视与自瞄x64实现原理及防护思路
查看: 4716|回复: 0

X64驱动R3R0通用汇编call执行库源码

[复制链接]

25

主题

1

回帖

37

积分

编程入门

Rank: 1

龙马币
108

这里是其中一小部分。



  1. byte * push_rsp() //64位编码
  2. {
  3. byte code[1] = { 0x54 };
  4. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));
  5. CodeLen = CodeLen + sizeof(code);
  6. return ShellCode;
  7. }


  8. byte * push_rbp() //64位编码
  9. {
  10. byte code[1] = { 0x55 };
  11. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));
  12. CodeLen = CodeLen + sizeof(code);
  13. return ShellCode;
  14. }


  15. byte * push_rsi() //64位编码
  16. {
  17. byte code[1] = { 0x56 };
  18. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));
  19. CodeLen = CodeLen + sizeof(code);
  20. return ShellCode;
  21. }


  22. byte * push_rdi() //64位编码
  23. {
  24. byte code[1] = { 0x57 };
  25. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));
  26. CodeLen = CodeLen + sizeof(code);
  27. return ShellCode;
  28. }



  29. byte * mov_rax_value(__int64 value)   //qword
  30. {
  31. byte code[2] = { 0x48,0xb8 };
  32. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));
  33. CodeLen = CodeLen + sizeof(code);
  34. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));
  35. CodeLen = CodeLen + sizeof(__int64);
  36. return ShellCode;
  37. }



  38. byte * mov_rcx_value(__int64 value)   //qword
  39. {

  40. byte code[2] = { 0x48,0xb9 };

  41. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  42. CodeLen = CodeLen + sizeof(code);

  43. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  44. CodeLen = CodeLen + 8;

  45. return ShellCode;

  46. }



  47. byte * mov_rdx_value(__int64 value)   //qword

  48. {

  49. byte code[2] = { 0x48,0xba };

  50. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  51. CodeLen = CodeLen + sizeof(code);

  52. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  53. CodeLen = CodeLen + 8;

  54. return ShellCode;

  55. }



  56. byte * mov_rbx_value(__int64 value)   //qword

  57. {

  58. byte code[2] = { 0x48,0xbb };

  59. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  60. CodeLen = CodeLen + sizeof(code);

  61. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  62. CodeLen = CodeLen + 8;

  63. return ShellCode;

  64. }



  65. byte * mov_r8_value(__int64 value)   //qword

  66. {

  67. byte code[2] = { 0x49,0xb8 };

  68. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  69. CodeLen = CodeLen + sizeof(code);

  70. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  71. CodeLen = CodeLen + 8;

  72. return ShellCode;

  73. }



  74. byte * mov_r9_value(__int64 value)   //qword

  75. {

  76. byte code[2] = { 0x49,0xb9 };

  77. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  78. CodeLen = CodeLen + sizeof(code);

  79. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  80. CodeLen = CodeLen + 8;

  81. return ShellCode;

  82. }



  83. byte * mov_r10_value(__int64 value)   //mov r10, 6FFFFFFFFFFFFFFF

  84. {

  85. byte code[2] = { 0x49,0xba };

  86. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  87. CodeLen = CodeLen + sizeof(code);

  88. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  89. CodeLen = CodeLen + 8;

  90. return ShellCode;

  91. }



  92. byte * mov_r11_value(__int64 value)   //qword

  93. {

  94. byte code[2] = { 0x49,0xbb };

  95. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  96. CodeLen = CodeLen + sizeof(code);

  97. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  98. CodeLen = CodeLen + 8;

  99. return ShellCode;

  100. }



  101. byte * mov_r12_value(__int64 value)   //qword

  102. {

  103. byte code[2] = { 0x49,0xbc };

  104. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  105. CodeLen = CodeLen + sizeof(code);

  106. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  107. CodeLen = CodeLen + 8;

  108. return ShellCode;

  109. }



  110. byte * mov_r13_value(__int64 value)   //qword

  111. {

  112. byte code[2] = { 0x49,0xbd };

  113. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  114. CodeLen = CodeLen + sizeof(code);

  115. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  116. CodeLen = CodeLen + 8;

  117. return ShellCode;

  118. }



  119. byte * mov_r14_value(__int64 value)   //qword

  120. {

  121. byte code[2] = { 0x49,0xbe };

  122. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  123. CodeLen = CodeLen + sizeof(code);

  124. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  125. CodeLen = CodeLen + 8;

  126. return ShellCode;

  127. }



  128. byte * mov_r15_value(__int64 value)   //qword

  129. {

  130. byte code[2] = { 0x49,0xbf };

  131. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  132. CodeLen = CodeLen + sizeof(code);

  133. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  134. CodeLen = CodeLen + 8;

  135. return ShellCode;

  136. }



  137. byte * mov_rcx_rax() //64位编码

  138. {

  139. byte code[3] = { 0x48,0x8b,0xc8 };

  140. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  141. CodeLen = CodeLen + sizeof(code);

  142. return ShellCode;

  143. }



  144. byte * mov_rax_rcx() //64位编码

  145. {

  146. byte code[3] = { 0x49,0x89,0xc8 };

  147. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  148. CodeLen = CodeLen + sizeof(code);

  149. return ShellCode;

  150. }



  151. byte * mov_rax_rdx() //64位编码

  152. {

  153. byte code[3] = { 0x48,0x89,0xd0 };

  154. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  155. CodeLen = CodeLen + sizeof(code);

  156. return ShellCode;

  157. }



  158. byte * mov_rdx_rax() //64位编码

  159. {

  160. byte code[3] = { 0x48,0x89,0xc2 };

  161. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  162. CodeLen = CodeLen + sizeof(code);

  163. return ShellCode;

  164. }



  165. byte * mov_r8_r9() //64位编码

  166. {

  167. byte code[3] = { 0x4d,0x89,0xc8 };

  168. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  169. CodeLen = CodeLen + sizeof(code);

  170. return ShellCode;

  171. }



  172. byte * mov_r9_r8() //64位编码

  173. {

  174. byte code[3] = { 0x4d,0x89,0xc1 };

  175. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  176. CodeLen = CodeLen + sizeof(code);

  177. return ShellCode;

  178. }



  179. byte * mov_rcx_ptr_rcx() //64位编码

  180. {

  181. byte code[3] = { 0x48,0x8b,0x09 };

  182. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  183. CodeLen = CodeLen + sizeof(code);

  184. return ShellCode;

  185. }



  186. byte * mov_rcx_ptr_rax() //64位编码

  187. {

  188. byte code[3] = { 0x48,0x8b,0x08 };

  189. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  190. CodeLen = CodeLen + sizeof(code);

  191. return ShellCode;

  192. }

  193. byte * mov_rcx_ptr_rdx() //64位编码

  194. {

  195. byte code[3] = { 0x48,0x8b,0x0a };

  196. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  197. CodeLen = CodeLen + sizeof(code);

  198. return ShellCode;

  199. }



  200. byte * mov_rcx_ptr_rbx() //64位编码

  201. {

  202. byte code[3] = { 0x48,0x8b,0x0b };

  203. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  204. CodeLen = CodeLen + sizeof(code);

  205. return ShellCode;

  206. }



  207. byte * mov_rdx_ptr_rdx() //64位编码

  208. {

  209. byte code[3] = { 0x48,0x8b,0x12 };

  210. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  211. CodeLen = CodeLen + sizeof(code);

  212. return ShellCode;

  213. }



  214. byte * mov_rdx_ptr_rcx() //64位编码

  215. {

  216. byte code[3] = { 0x48,0x8b,0x11 };

  217. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  218. CodeLen = CodeLen + sizeof(code);

  219. return ShellCode;

  220. }



  221. byte * mov_rdx_ptr_rbx() //64位编码

  222. {

  223. byte code[3] = { 0x48,0x8b,0x13 };

  224. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  225. CodeLen = CodeLen + sizeof(code);

  226. return ShellCode;

  227. }



  228. byte * mov_rdx_ptr_rax() //64位编码

  229. {

  230. byte code[3] = { 0x48,0x8b,0x10 };

  231. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  232. CodeLen = CodeLen + sizeof(code);

  233. return ShellCode;

  234. }



  235. byte * mov_r8_ptr_r8() //64位编码

  236. {

  237. byte code[3] = { 0x4d,0x8b,0x00 };

  238. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  239. CodeLen = CodeLen + sizeof(code);

  240. return ShellCode;

  241. }



  242. byte * mov_r8_ptr_r9() //64位编码

  243. {

  244. byte code[3] = { 0x4d,0x8b,0x01 };

  245. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  246. CodeLen = CodeLen + sizeof(code);

  247. return ShellCode;

  248. }



  249. byte * mov_r8_ptr_r10() //64位编码

  250. {

  251. byte code[3] = { 0x4d,0x8b,0x02 };

  252. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  253. CodeLen = CodeLen + sizeof(code);

  254. return ShellCode;

  255. }



  256. byte * mov_r9_ptr_r8() //64位编码

  257. {

  258. byte code[3] = { 0x4d,0x8b,0x08 };

  259. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  260. CodeLen = CodeLen + sizeof(code);

  261. return ShellCode;

  262. }

  263. byte * mov_r9_ptr_r9() //64位编码

  264. {

  265. byte code[3] = { 0x4d,0x8b,0x09 };

  266. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  267. CodeLen = CodeLen + sizeof(code);

  268. return ShellCode;

  269. }



  270. byte * mov_r9_ptr_r10() //64位编码

  271. {

  272. byte code[3] = { 0x4d,0x8b,0x0a };

  273. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  274. CodeLen = CodeLen + sizeof(code);

  275. return ShellCode;

  276. }



  277. byte * mov_r15_r8() //64位编码

  278. {

  279. byte code[3] = { 0x4d,0x89,0xc7 };

  280. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  281. CodeLen = CodeLen + sizeof(code);

  282. return ShellCode;

  283. }



  284. byte * mov_r15_r9() //64位编码

  285. {

  286. byte code[3] = { 0x4d,0x89,0xcf };

  287. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  288. CodeLen = CodeLen + sizeof(code);

  289. return ShellCode;

  290. }

  291. byte * mov_r15_r10() //64位编码

  292. {

  293. byte code[3] = { 0x4d,0x89,0xd7 };

  294. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  295. CodeLen = CodeLen + sizeof(code);

  296. return ShellCode;

  297. }



  298. byte * mov_r15_r11() //64位编码

  299. {

  300. byte code[3] = { 0x4d,0x89,0xdf };

  301. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  302. CodeLen = CodeLen + sizeof(code);

  303. return ShellCode;

  304. }



  305. byte * mov_r15_r12() //64位编码

  306. {

  307. byte code[3] = { 0x4d,0x89,0xe7 };

  308. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  309. CodeLen = CodeLen + sizeof(code);

  310. return ShellCode;

  311. }



  312. byte * mov_r15_r13() //64位编码

  313. {

  314. byte code[3] = { 0x4d,0x89,0xef };

  315. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  316. CodeLen = CodeLen + sizeof(code);

  317. return ShellCode;

  318. }



  319. byte * mov_r15_r14() //64位编码

  320. {

  321. byte code[3] = { 0x4d,0x89,0xf7 };

  322. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  323. CodeLen = CodeLen + sizeof(code);

  324. return ShellCode;

  325. }



  326. byte * mov_r15_r15() //64位编码

  327. {

  328. byte code[3] = { 0x4d,0x89,0xff };

  329. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  330. CodeLen = CodeLen + sizeof(code);

  331. return ShellCode;

  332. }



  333. byte * mov_r15_ptr_r8() //64位编码

  334. {

  335. byte code[3] = { 0x4d,0x8b,0x38 };

  336. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  337. CodeLen = CodeLen + sizeof(code);

  338. return ShellCode;

  339. }



  340. byte * mov_r15_ptr_r9() //64位编码

  341. {

  342. byte code[3] = { 0x4d,0x8b,0x39 };

  343. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  344. CodeLen = CodeLen + sizeof(code);

  345. return ShellCode;

  346. }



  347. byte * mov_r15_ptr_r10() //64位编码

  348. {

  349. byte code[3] = { 0x4d,0x8b,0x3a };

  350. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  351. CodeLen = CodeLen + sizeof(code);

  352. return ShellCode;

  353. }





  354. byte * mov_r15_ptr_r11() //64位编码

  355. {

  356. byte code[3] = { 0x4d,0x8b,0x3b };

  357. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  358. CodeLen = CodeLen + sizeof(code);

  359. return ShellCode;

  360. }



  361. byte * mov_r15_ptr_r12() //64位编码

  362. {

  363. byte code[4] = { 0x4d,0x8b,0x3c,0x24 };

  364. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  365. CodeLen = CodeLen + sizeof(code);

  366. return ShellCode;

  367. }



  368. byte * mov_r15_ptr_r13() //64位编码

  369. {

  370. byte code[4] = { 0x4d,0x8b,0x7d,0x00 };

  371. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  372. CodeLen = CodeLen + sizeof(code);

  373. return ShellCode;

  374. }

  375. byte * mov_r15_ptr_r14() //64位编码

  376. {

  377. byte code[3] = { 0x4d,0x8b,0x3e };

  378. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  379. CodeLen = CodeLen + sizeof(code);

  380. return ShellCode;

  381. }



  382. byte * mov_r15_ptr_r15() //64位编码

  383. {

  384. byte code[3] = { 0x4d,0x8b,0x3f };

  385. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  386. CodeLen = CodeLen + sizeof(code);

  387. return ShellCode;

  388. }





  389. byte * mov_qword_ptr_rax(__int64 value)   //qword这里是个内存地址

  390. {

  391. byte code[2] = { 0x48,0xa3 };

  392. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  393. CodeLen = CodeLen + sizeof(code);

  394. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(__int64));

  395. CodeLen = CodeLen + 8;

  396. return ShellCode;

  397. }



  398. byte * mov_rax_qword_ptr_rbp_add(int value)   //qword这里是个内存地址,mov rax, qword ptr ss:[rbp+FFFFFFF]

  399. {

  400. byte code[3] = { 0x48,0x8b,0x85 };

  401. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  402. CodeLen = CodeLen + sizeof(code);

  403. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(int));

  404. CodeLen = CodeLen + 4;

  405. return ShellCode;

  406. }



  407. byte * mov_rcx_qword_ptr_rbp_add(int value)   //qword这里是个内存地址,mov rax, qword ptr ss:[rbp+FFFFFFF]

  408. {

  409. byte code[3] = { 0x48,0x8b,0x8d };

  410. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  411. CodeLen = CodeLen + sizeof(code);

  412. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(int));

  413. CodeLen = CodeLen + 4;

  414. return ShellCode;

  415. }



  416. byte * lea_rcx_rcx() //64位编码   [rcx]

  417. {

  418. byte code[3] = { 0x48,0x8d,0x09 };

  419. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  420. CodeLen = CodeLen + sizeof(code);

  421. return ShellCode;

  422. }



  423. byte * lea_rax_rcx() //64位编码 [eax]

  424. {

  425. byte code[3] = { 0x48,0x8d,0x08 };

  426. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  427. CodeLen = CodeLen + sizeof(code);

  428. return ShellCode;

  429. }



  430. byte * lea_rax_rax() //64位编码 [eax]

  431. {

  432. byte code[3] = { 0x48,0x8d,0x00 };

  433. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  434. CodeLen = CodeLen + sizeof(code);

  435. return ShellCode;

  436. }



  437. byte * lea_rcx_rax() //64位编码   [eax]

  438. {

  439. byte code[3] = { 0x48,0x8d,0x01 };

  440. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  441. CodeLen = CodeLen + sizeof(code);

  442. return ShellCode;

  443. }



  444. byte * add_rax_rcx() //64位编码 [eax]

  445. {

  446. byte code[3] = { 0x48,0x01,0xc8 };

  447. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  448. CodeLen = CodeLen + sizeof(code);

  449. return ShellCode;

  450. }



  451. byte * add_rcx_rax() //64位编码 [eax]

  452. {

  453. byte code[3] = { 0x48,0x01,0xc1 };

  454. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  455. CodeLen = CodeLen + sizeof(code);

  456. return ShellCode;

  457. }



  458. byte * add_rsp_value(int value)   //减法最大值是0xffffffff,这个是32位

  459. {

  460. byte code[3] = { 0x48,0x81,0xc4 };

  461. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  462. CodeLen = CodeLen + sizeof(code);

  463. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(int));

  464. CodeLen = CodeLen + 4;

  465. return ShellCode;

  466. }



  467. byte * sub_rsp_value(int value)   //减法最大值是0xffffffff,这个是32位

  468. {

  469. byte code[3] = { 0x48,0x81,0xec };

  470. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  471. CodeLen = CodeLen + sizeof(code);

  472. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(int));

  473. CodeLen = CodeLen + 4;

  474. return ShellCode;

  475. }



  476. byte * sub_rax_rcx()   //减法

  477. {

  478. byte code[3] = { 0x48,0x29,0xc3 };

  479. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  480. CodeLen = CodeLen + sizeof(code);

  481. return ShellCode;

  482. }



  483. byte * sub_rcx_rax()   //减法

  484. {

  485. byte code[3] = { 0x48,0x29,0xc1 };

  486. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  487. CodeLen = CodeLen + sizeof(code);

  488. return ShellCode;

  489. }



  490. byte * ret()   //

  491. {

  492. byte code[1] = { 0xc3 };

  493. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  494. CodeLen = CodeLen + sizeof(code);

  495. return ShellCode;

  496. }



  497. byte * retn(short value)   //减法

  498. {

  499. byte code[1] = { 0xc2 };

  500. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  501. CodeLen = CodeLen + sizeof(code);

  502. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(short));

  503. CodeLen = CodeLen + sizeof(short);

  504. return ShellCode;

  505. }



  506. byte * idiv_rax()   //除法 ,首先要讲值传到rax,最后的值传给rax 0x48,0x99 =cpo

  507. {

  508. byte code[5] = { 0x48,0x99,0x48,0xf7,0xf8 };

  509. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  510. CodeLen = CodeLen + sizeof(code);

  511. return ShellCode;

  512. }



  513. byte * idiv_rcx()   //除法 ,首先要讲值传到rax,最后的值传给rax 0x48,0x99 =cpo

  514. {

  515. byte code[5] = { 0x48,0x99,0x48,0xf7,0xf9 };

  516. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  517. CodeLen = CodeLen + sizeof(code);

  518. return ShellCode;

  519. }



  520. byte * div_rax()   //除法 ,首先要讲值传到rax,最后的值传给rax 0x48,0x99 =cpo

  521. {

  522. byte code[5] = { 0x48,0x99,0x48,0xf7,0xf0 };

  523. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  524. CodeLen = CodeLen + sizeof(code);

  525. return ShellCode;

  526. }



  527. byte * div_rcx()   //除法 ,首先要讲值传到rax,最后的值传给rax 0x48,0x99 =cpo

  528. {

  529. byte code[5] = { 0x48,0x99,0x48,0xf7,0xf1 };

  530. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  531. CodeLen = CodeLen + sizeof(code);

  532. return ShellCode;

  533. }



  534. byte * imul_rax_rcx()   //乘法

  535. {

  536. byte code[4] = { 0x48,0x0f,0xaf,0xc1 };

  537. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  538. CodeLen = CodeLen + sizeof(code);

  539. return ShellCode;

  540. }



  541. byte * imul_r8_r9()   //乘法

  542. {

  543. byte code[4] = { 0x4d,0x0f,0xaf,0xc1 };

  544. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  545. CodeLen = CodeLen + sizeof(code);

  546. return ShellCode;

  547. }



  548. byte * call_rax()   //易变

  549. {

  550. byte code[2] = { 0xff,0xd0 };

  551. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  552. CodeLen = CodeLen + sizeof(code);

  553. return ShellCode;

  554. }



  555. byte * call_rcx()   //易变

  556. {

  557. byte code[2] = { 0xff,0xd1 };

  558. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  559. CodeLen = CodeLen + sizeof(code);

  560. return ShellCode;

  561. }



  562. byte * call_r8()    //易变

  563. {

  564. byte code[3] = { 0x41,0xff,0xd0 };

  565. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  566. CodeLen = CodeLen + sizeof(code);

  567. return ShellCode;

  568. }



  569. byte * call_r9()   //易变

  570. {

  571. byte code[3] = { 0x41,0xff,0xd1 };

  572. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  573. CodeLen = CodeLen + sizeof(code);

  574. return ShellCode;

  575. }



  576. byte * call_r10()   //易变

  577. {

  578. byte code[3] = { 0x41,0xff,0xd2 };

  579. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  580. CodeLen = CodeLen + sizeof(code);

  581. return ShellCode;

  582. }



  583. byte * call_r11()   //易变

  584. {

  585. byte code[3] = { 0x41,0xff,0xd3 };

  586. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  587. CodeLen = CodeLen + sizeof(code);

  588. return ShellCode;

  589. }



  590. byte * call_r12()   //易变

  591. {

  592. byte code[3] = { 0x41,0xff,0xd4 };

  593. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  594. CodeLen = CodeLen + sizeof(code);

  595. return ShellCode;

  596. }



  597. byte * call_r13()   //易变

  598. {

  599. byte code[3] = { 0x41,0xff,0xd5 };

  600. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  601. CodeLen = CodeLen + sizeof(code);

  602. return ShellCode;

  603. }



  604. byte * call_r14()   //易变

  605. {

  606. byte code[3] = { 0x41,0xff,0xd6 };

  607. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  608. CodeLen = CodeLen + sizeof(code);

  609. return ShellCode;

  610. }



  611. byte * call_r15()   //易变

  612. {

  613. byte code[3] = { 0x41,0xff,0xd7 };

  614. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  615. CodeLen = CodeLen + sizeof(code);

  616. return ShellCode;

  617. }



  618. byte * jmp_r15()   //易变

  619. {

  620. byte code[3] = { 0x41,0xff,0xe7 };

  621. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  622. CodeLen = CodeLen + sizeof(code);

  623. return ShellCode;

  624. }



  625. byte * call_ptr(int value)   //减法最大值是0xffffffff,这个是32位//这个函数x64有问题的,不建议用

  626. {

  627. byte code[2] = { 0xff,0x14};

  628. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  629. CodeLen = CodeLen + sizeof(code);

  630. RtlMoveMemory(ShellCode + CodeLen, &value, sizeof(int));

  631. CodeLen = CodeLen + 4;

  632. return ShellCode;

  633. }



  634. byte * movss_xmm0_dword_ptr_rcx()   //浮点数地址传值   movss xmm0, dword ptr ds:[rax]

  635. {

  636. byte code[4] = { 0xF3, 0x0F, 0x10, 0x01 };

  637. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  638. CodeLen = CodeLen + sizeof(code);

  639. return ShellCode;

  640. }



  641. byte * movss_xmm0_dword_ptr_rax()   //浮点数地址传值   movss xmm0, dword ptr ds:[rax]

  642. {

  643. byte code[4] = { 0xF3, 0x0F, 0x10, 0x00 };

  644. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  645. CodeLen = CodeLen + sizeof(code);

  646. return ShellCode;

  647. }



  648. byte * movss_xmm1_dword_ptr_rax()   //浮点数地址传值   movss xmm1, dword ptr ds:[rax]

  649. {

  650. byte code[4] = { 0xF3, 0x0F, 0x10, 0x08 };

  651. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  652. CodeLen = CodeLen + sizeof(code);

  653. return ShellCode;

  654. }



  655. byte * movss_xmm2_dword_ptr_rax()   //浮点数地址传值   movss xmm2, dword ptr ds:[rax]

  656. {

  657. byte code[4] = { 0xF3, 0x0F, 0x10, 0x10 };

  658. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  659. CodeLen = CodeLen + sizeof(code);

  660. return ShellCode;

  661. }



  662. byte * movss_xmm3_dword_ptr_rax()   //浮点数地址传值   movss xmm3, dword ptr ds:[rax]

  663. {

  664. byte code[4] = { 0xF3, 0x0F, 0x10, 0x18 };

  665. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  666. CodeLen = CodeLen + sizeof(code);

  667. return ShellCode;

  668. }



  669. byte * movss_xmm4_dword_ptr_rax()   //浮点数地址传值   movss xmm4, dword ptr ds:[rax]

  670. {

  671. byte code[4] = { 0xF3, 0x0F, 0x10, 0x20 };

  672. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  673. CodeLen = CodeLen + sizeof(code);

  674. return ShellCode;

  675. }



  676. byte * movss_xmm1_dword_ptr_rcx()                 //浮点数地址传值   movss xmm0, dword ptr ds:[rcx]

  677. {

  678. byte code[4] = { 0xF3, 0x0F, 0x10, 0x09 };

  679. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  680. CodeLen = CodeLen + sizeof(code);

  681. return ShellCode;

  682. }



  683. byte * movss_xmm0_dword_ptr_r8()                   //浮点数地址传值   movss xmm0, dword ptr ds:[r8]

  684. {

  685. byte code[5] = { 0xF3, 0x41, 0x0f, 0x10,0x00 };

  686. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  687. CodeLen = CodeLen + sizeof(code);

  688. return ShellCode;

  689. }



  690. byte * movss_xmm0_dword_ptr_r9()                    //浮点数地址传值   movss xmm0, dword ptr ds:[r9]

  691. {

  692. byte code[5] = { 0xF3, 0x41, 0x0f, 0x10,0x01 };

  693. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  694. CodeLen = CodeLen + sizeof(code);

  695. return ShellCode;

  696. }



  697. byte * movss_dword_ptr_xmm0()   // movss dword ptr ds : [rax], xmm0 |

  698. {

  699. byte code[5] = { 0xF3, 0x67, 0x0F, 0x11, 0x01 };

  700. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  701. CodeLen = CodeLen + sizeof(code);

  702. return ShellCode;

  703. }



  704. byte * addss_xmm0_dword_ptr_rax()   // addss xmm0, dword ptr ds : [rax]   浮点加法

  705. {

  706. byte code[4] = { 0xF3, 0x0f, 0x58, 0x00 };

  707. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  708. CodeLen = CodeLen + sizeof(code);

  709. return ShellCode;

  710. }



  711. byte * subss_xmm0_dword_ptr_rax()   // addss xmm0, dword ptr ds : [rax]   浮点减法

  712. {

  713. byte code[4] = { 0xF3, 0x0f, 0x5c, 0x00 };

  714. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  715. CodeLen = CodeLen + sizeof(code);

  716. return ShellCode;

  717. }



  718. byte * mulss_xmm0_dword_ptr_rax()   // addss xmm0, dword ptr ds : [rax]   浮点乘法

  719. {

  720. byte code[4] = { 0xF3, 0x0f, 0x59, 0x00 };

  721. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  722. CodeLen = CodeLen + sizeof(code);

  723. return ShellCode;

  724. }



  725. byte * divss_xmm0_dword_ptr_rax()   // addss xmm0, dword ptr ds : [rax]   浮点除法

  726. {

  727. byte code[4] = { 0xF3, 0x0f, 0x5e, 0x00 };

  728. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  729. CodeLen = CodeLen + sizeof(code);

  730. return ShellCode;

  731. }



  732. byte * xor_r9d_r9d()   // addss xmm0, dword ptr ds : [rax]   清空

  733. {

  734. byte code[3] = { 0x45, 0x31, 0xc9 };

  735. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  736. CodeLen = CodeLen + sizeof(code);

  737. return ShellCode;

  738. }



  739. byte * xor_r8d_r8d()   // addss xmm0, dword ptr ds : [rax]   清空

  740. {

  741. byte code[3] = { 0x45, 0x31, 0xc0 };

  742. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  743. CodeLen = CodeLen + sizeof(code);

  744. return ShellCode;

  745. }



  746. byte * xor_eax_eax()   // addss xmm0, dword ptr ds : [rax]   清空

  747. {

  748. byte code[2] = { 0x31, 0xc0 };

  749. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  750. CodeLen = CodeLen + sizeof(code);

  751. return ShellCode;

  752. }



  753. byte * xor_ecx_ecx()   // addss xmm0, dword ptr ds : [rax]   清空

  754. {

  755. byte code[2] = { 0x31, 0xc9 };

  756. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  757. CodeLen = CodeLen + sizeof(code);

  758. return ShellCode;

  759. }



  760. byte * xor_edx_edx()   // addss xmm0, dword ptr ds : [rax]   清空

  761. {

  762. byte code[2] = { 0x31, 0xd2 };

  763. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  764. CodeLen = CodeLen + sizeof(code);

  765. return ShellCode;

  766. }



  767. byte * xor_rax_rax()   // addss xmm0, dword ptr ds : [rax]   清空

  768. {

  769. byte code[3] = { 0x48, 0x31,0xc0 };

  770. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  771. CodeLen = CodeLen + sizeof(code);

  772. return ShellCode;

  773. }



  774. byte * xor_rcx_rcx()   // addss xmm0, dword ptr ds : [rax]   清空

  775. {

  776. byte code[3] = { 0x48, 0x31,0xc9 };

  777. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  778. CodeLen = CodeLen + sizeof(code);

  779. return ShellCode;

  780. }



  781. byte * xor_r8_r8()   // addss xmm0, dword ptr ds : [rax]   清空

  782. {

  783. byte code[3] = { 0x4d, 0x31,0xc0 };

  784. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  785. CodeLen = CodeLen + sizeof(code);

  786. return ShellCode;

  787. }



  788. byte * xor_r9_r9()   // addss xmm0, dword ptr ds : [rax]   清空

  789. {

  790. byte code[3] = { 0x4d, 0x31,0xc9 };

  791. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  792. CodeLen = CodeLen + sizeof(code);

  793. return ShellCode;

  794. }



  795. byte * int3()   // addss xmm0, dword ptr ds : [rax]   清空

  796. {

  797. byte code[1] = { 0xcc };

  798. RtlMoveMemory(ShellCode + CodeLen, &code, sizeof(code));

  799. CodeLen = CodeLen + sizeof(code);

  800. return ShellCode;

  801. }



  802. short WordToByteArray(short Value) //2字节整数转byte数组,网络转换

  803. {

  804. return htons(Value);

  805. }



  806. int intToByteArray(int Value) //4字节整数转byte数组,网络转换 ntohl应该也可以

  807. {

  808. return htonl(Value);

  809. }



  810. void ByteToHexStr(const unsigned char* source, char* dest, int sourceLen)//char*字符串转编码   备份函数

  811. {

  812. short i;

  813. unsigned char highByte, lowByte;



  814. for (i = 0; i < sourceLen; i++)

  815. {

  816. highByte = source[i] >> 4;

  817. lowByte = source[i] & 0x0f;



  818. highByte += 0x30;



  819. if (highByte > 0x39)

  820. dest[i * 2] = highByte + 0x07;

  821. else

  822. dest[i * 2] = highByte;



  823. lowByte += 0x30;

  824. if (lowByte > 0x39)

  825. dest[i * 2 + 1] = lowByte + 0x07;

  826. else

  827. dest[i * 2 + 1] = lowByte;

  828. }

  829. return;

  830. }



  831. bool HexToString(unsigned char *pSrc, std::string &dest, int nL) //char[]字节数组转->字符串

  832. {

  833. char buf[256];



  834. memset((char *)buf, 0, sizeof(buf));



  835. unsigned char hb;

  836. unsigned char lb;



  837. for (int i = 0; i < nL; i++)

  838. {

  839. hb = (pSrc[i] & 0xf0) >> 4;



  840. if (hb >= 0 && hb <= 9)

  841. hb += 0x30;

  842. else if (hb >= 10 && hb <= 15)

  843. hb = hb - 10 + 'A';

  844. else

  845. return false;



  846. lb = pSrc[i] & 0x0f;

  847. if (lb >= 0 && lb <= 9)

  848. lb += 0x30;

  849. else if (lb >= 10 && lb <= 15)

  850. lb = lb - 10 + 'A';

  851. else

  852. return false;



  853. buf[i * 2] = hb;

  854. buf[i * 2 + 1] = lb;

  855. }

  856. dest = buf;

  857. return true;

  858. }



  859. bool StringToHex(std::string &src, unsigned char *dest)////字符串====字节数组

  860. {

  861. unsigned char hb;

  862. unsigned char lb;



  863. if (src.size() % 2 != 0)

  864. return false;



  865. transform(src.begin(), src.end(), src.begin(), toupper);



  866. for (int i = 0, j = 0; i < (int)src.size(); i++)

  867. {

  868. hb = src[i];

  869. if (hb >= 'A' && hb <= 'F')

  870. hb = hb - 'A' + 10;

  871. else if (hb >= '0' && hb <= '9')

  872. hb = hb - '0';

  873. else

  874. return false;



  875. i++;

  876. lb = src[i];

  877. if (lb >= 'A' && lb <= 'F')

  878. lb = lb - 'A' + 10;

  879. else if (lb >= '0' && lb <= '9')

  880. lb = lb - '0';

  881. else

  882. return false;

  883. dest[j++] = (hb << 4) | (lb);

  884. }

  885. return true;
  886. }

复制代码

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

龙马谷| C/C++辅助教程| 安卓逆向安全| 论坛导航| 免责申明|Archiver|
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表龙马谷立场!
任何人不得以任何方式翻录、盗版或出售本站视频,一经发现我们将追究其相关责任!
我们一直在努力成为最好的编程论坛!
Copyright© 2018-2021 All Right Reserved.
在线客服
快速回复 返回顶部 返回列表