Advertisement
MalwareMustDie

Zbic Decompression Data | China DDoSer

Jun 16th, 2014
2,558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; Zlib Decompression Reversed | #MalwareMustDie - @unixfreaxjp /malware/Iptablex]$ date
  2. ;; Mon Jun 16 14:08:22 JST 2014
  3. ;; Is really advised to take a deep breath before read this (delicious) spaghetti codes :-)
  4.  
  5. ;;The decompress data trace.
  6.  
  7. .text:0804DB64                 jz      short loc_804DBC5
  8. .text:0804DB66                 mov     [esp+18h+var_10], 1E8h
  9. .text:0804DB6E                 mov     [esp+18h+var_14], 0
  10. .text:0804DB76                 mov     [esp+18h+var_18], offset g_mainsrvinfo
  11. .text:0804DB7D                 call    memset
  12. .text:0804DB82                 mov     eax, [ebp+arg_0]
  13. .text:0804DB85                 mov     [esp+18h+var_18], eax
  14. .text:0804DB88                 call    DeCtlInfo
  15. .text:0804DB8D                 test    eax, eax
  16. .text:0804DB8F                 mov     dword ptr ds:g_mainsrvinfo+124h, eax
  17. .text:0804DB94                 jnz     short loc_804DBD1
  18.  
  19.  
  20. ;; The control for decompressor:
  21. public DeCtlInfo
  22. DeCtlInfo proc near
  23.  
  24. var_28= dword ptr -28h
  25. var_24= dword ptr -24h
  26. var_20= dword ptr -20h
  27. var_14= dword ptr -14h
  28. var_10= dword ptr -10h
  29. var_C= dword ptr -0Ch
  30. var_8= dword ptr -8
  31. arg_0= dword ptr  8
  32.  
  33. push    ebp
  34. mov     ebp, esp
  35. push    ebx
  36. sub     esp, 24h
  37. mov     eax, [ebp+arg_0]
  38. lea     edx, [ebp+var_14]
  39. mov     [ebp+var_14], eax
  40. mov     eax, [eax+23Ch]
  41. mov     [ebp+var_C], 0
  42. mov     [ebp+var_8], 0
  43. mov     [esp+28h+var_28], edx
  44. mov     [ebp+var_10], eax
  45. lea     eax, [ebp+var_C]
  46. mov     [esp+28h+var_24], eax
  47. call    Hb_DeCompress
  48. test    eax, eax
  49.  
  50.  
  51. ;; main function for decompression handles...
  52.  
  53. public Hb_DeCompress
  54. Hb_DeCompress proc near
  55.  
  56. var_28= dword ptr -28h
  57. var_24= dword ptr -24h
  58. var_20= dword ptr -20h
  59. var_1C= dword ptr -1Ch
  60. var_18= dword ptr -18h
  61. var_C= dword ptr -0Ch
  62. var_8= dword ptr -8
  63. var_4= dword ptr -4
  64. arg_0= dword ptr  8
  65. arg_4= dword ptr  0Ch
  66.  
  67. push    ebp
  68. mov     ebp, esp
  69. sub     esp, 28h
  70. mov     [ebp+var_C], ebx
  71. mov     [ebp+var_8], esi
  72. mov     esi, 0FFFFFFFFh
  73. mov     [ebp+var_4], edi
  74. mov     edi, [ebp+arg_4]
  75. call    zlib_decompress_init
  76. test    eax, eax
  77. mov     ebx, eax
  78. jz      short loc_804BBA7
  79.  
  80.  
  81. ;; Subroutine of zlib decompress initiation
  82.  
  83. .text:0804B100 public zlib_decompress_init
  84. .text:0804B100 zlib_decompress_init proc near
  85. .text:0804B100
  86. .text:0804B100 var_138         = dword ptr -138h
  87. .text:0804B100 var_134         = dword ptr -134h
  88. .text:0804B100 var_130         = dword ptr -130h
  89. .text:0804B100 var_128         = dword ptr -128h
  90. .text:0804B100 var_124         = dword ptr -124h
  91. .text:0804B100 var_120         = dword ptr -120h
  92. .text:0804B100 var_11C         = dword ptr -11Ch
  93. .text:0804B100 var_118         = dword ptr -118h
  94. .text:0804B100 var_114         = dword ptr -114h
  95. .text:0804B100 var_110         = dword ptr -110h
  96. .text:0804B100 var_10C         = dword ptr -10Ch
  97. .text:0804B100 var_98          = dword ptr -98h
  98. .text:0804B100 var_28          = dword ptr -28h
  99. .text:0804B100 var_24          = dword ptr -24h
  100. .text:0804B100 var_20          = dword ptr -20h
  101. .text:0804B100 var_1C          = dword ptr -1Ch
  102. .text:0804B100 var_18          = dword ptr -18h
  103. .text:0804B100 var_14          = dword ptr -14h
  104. .text:0804B100 var_10          = dword ptr -10h
  105. .text:0804B100 var_C           = dword ptr -0Ch
  106. .text:0804B100
  107. .text:0804B100                 push    ebp
  108. .text:0804B101                 mov     ebp, esp
  109. .text:0804B103                 push    esi
  110. .text:0804B104                 push    ebx
  111. .text:0804B105                 sub     esp, 130h
  112. .text:0804B10B                 mov     [esp+138h+var_138], 81ACh
  113. .text:0804B112                 lea     esi, [ebp+var_128]
  114. .text:0804B118                 call    malloc
  115. .text:0804B11D                 mov     [esp+138h+var_138], esi
  116. .text:0804B120                 mov     [esp+138h+var_130], 90h
  117. .text:0804B128                 mov     [esp+138h+var_134], 8
  118. .text:0804B130                 mov     ebx, eax
  119. .text:0804B132                 call    memset
  120. .text:0804B137                 lea     eax, [ebp+var_98]
  121. .text:0804B13D                 mov     [esp+138h+var_130], 70h
  122. .text:0804B145                 mov     [esp+138h+var_134], 9
  123. .text:0804B14D                 mov     [esp+138h+var_138], eax
  124. .text:0804B150                 call    memset
  125. .text:0804B155                 mov     edx, 120h
  126. .text:0804B15A                 mov     eax, esi
  127. .text:0804B15C                 mov     [ebp+var_28], 7070707h
  128. .text:0804B163                 mov     [ebp+var_24], 7070707h
  129. .text:0804B16A                 mov     [ebp+var_20], 7070707h
  130. .text:0804B171                 mov     [ebp+var_1C], 7070707h
  131. .text:0804B178                 mov     [ebp+var_18], 7070707h
  132. .text:0804B17F                 mov     [ebp+var_14], 7070707h
  133. .text:0804B186                 mov     [ebp+var_10], (offset loc_8080806+2)
  134. .text:0804B18D                 mov     [ebp+var_C], (offset loc_8080806+2)
  135. .text:0804B194                 call    zlib_mktable
  136. .text:0804B199                 mov     edx, 20h
  137. .text:0804B19E                 mov     [ebp+var_128], 5050505h
  138. .text:0804B1A8                 mov     [ebp+var_124], 5050505h
  139. .text:0804B1B2                 mov     [ebp+var_120], 5050505h
  140. .text:0804B1BC                 mov     [ebp+var_11C], 5050505h
  141. .text:0804B1C6                 mov     [ebp+var_118], 5050505h
  142. .text:0804B1D0                 mov     [ebx], eax
  143. .text:0804B1D2                 mov     eax, esi
  144. .text:0804B1D4                 mov     [ebp+var_114], 5050505h
  145. .text:0804B1DE                 mov     [ebp+var_110], 5050505h
  146. .text:0804B1E8                 mov     [ebp+var_10C], 5050505h
  147. .text:0804B1F2                 call    zlib_mktable
  148. .text:0804B1F7                 mov     dword ptr [ebx+14h], 0
  149. .text:0804B1FE                 mov     dword ptr [ebx+10h], 0
  150. .text:0804B205                 mov     dword ptr [ebx+0Ch], 0
  151. .text:0804B20C                 mov     dword ptr [ebx+8], 0
  152. .text:0804B213                 mov     dword ptr [ebx+194h], 0
  153. .text:0804B21D                 mov     [ebx+4], eax
  154. .text:0804B220                 mov     eax, ebx
  155. .text:0804B222                 mov     dword ptr [ebx+198h], 0
  156. .text:0804B22C                 mov     dword ptr [ebx+819Ch], 0
  157. .text:0804B236                 add     esp, 130h
  158. .text:0804B23C                 pop     ebx
  159. .text:0804B23D                 pop     esi
  160. .text:0804B23E                 pop     ebp
  161. .text:0804B23F                 retn
  162. .text:0804B23F zlib_decompress_init endp
  163. .text:0804B23F
  164.  
  165.  
  166. ;; Table data creation for zlib decompression purpose...
  167.  
  168. .text:0804AF10 zlib_mktable    proc near
  169. .text:0804AF10
  170. .text:0804AF10 var_528         = dword ptr -528h
  171. .text:0804AF10 var_524         = dword ptr -524h
  172. .text:0804AF10 var_520         = dword ptr -520h
  173. .text:0804AF10 var_518         = dword ptr -518h
  174. .text:0804AF10 var_514         = dword ptr -514h
  175. .text:0804AF10 var_510         = dword ptr -510h
  176. .text:0804AF10 var_50C         = dword ptr -50Ch
  177. .text:0804AF10 var_8C          = dword ptr -8Ch
  178. .text:0804AF10 var_4C          = dword ptr -4Ch
  179. .text:0804AF10
  180. .text:0804AF10                 push    ebp
  181. .text:0804AF11                 mov     ebp, esp
  182. .text:0804AF13                 push    edi
  183. .text:0804AF14                 push    esi
  184. .text:0804AF15                 push    ebx
  185. .text:0804AF16                 sub     esp, 51Ch
  186. .text:0804AF1C                 lea     ebx, [ebp+var_4C]
  187. .text:0804AF1F                 mov     [ebp+var_514], eax
  188. .text:0804AF25                 xor     eax, eax
  189. .text:0804AF27                 mov     [ebp+var_518], edx
  190. .text:0804AF2D                 lea     esi, [esi+0]
  191. .text:0804AF30
  192. .text:0804AF30 loc_804AF30:
  193. .text:0804AF30                 mov     dword ptr [ebx+eax*4+4], 0
  194. .text:0804AF38                 add     eax, 1
  195. .text:0804AF3B                 cmp     eax, 0Fh
  196. .text:0804AF3E                 jnz     short loc_804AF30
  197. .text:0804AF40                 mov     eax, [ebp+var_518]
  198. .text:0804AF46                 mov     [ebp+var_510], 0
  199. .text:0804AF50                 test    eax, eax
  200. .text:0804AF52                 jle     short loc_804AF7E
  201. .text:0804AF54                 xor     edx, edx
  202. .text:0804AF56
  203. .text:0804AF56 loc_804AF56:
  204. .text:0804AF56                 mov     ecx, [ebp+var_514]
  205. .text:0804AF5C                 movzx   eax, byte ptr [edx+ecx]
  206. .text:0804AF60                 add     [ebp+eax*4+var_4C], 1
  207. .text:0804AF65                 cmp     [ebp+var_510], eax
  208. .text:0804AF6B                 jge     short loc_804AF73
  209. .text:0804AF6D                 mov     [ebp+var_510], eax
  210. .text:0804AF73
  211. .text:0804AF73 loc_804AF73:  
  212. .text:0804AF73                 add     edx, 1
  213. .text:0804AF76                 cmp     edx, [ebp+var_518]
  214. .text:0804AF7C                 jnz     short loc_804AF56
  215. .text:0804AF7E
  216. .text:0804AF7E loc_804AF7E:                            ; CODE XREF: zlib_mktable+42
  217. .text:0804AF7E                 xor     eax, eax
  218. .text:0804AF80                 xor     edx, edx
  219. .text:0804AF82                 lea     ecx, [ebp+var_8C]
  220. .text:0804AF88
  221. .text:0804AF88 loc_804AF88:  
  222. .text:0804AF88                 mov     [ecx+edx*4+4], eax
  223. .text:0804AF8C                 add     eax, [ebx+edx*4+4]
  224. .text:0804AF90                 add     edx, 1
  225. .text:0804AF93                 add     eax, eax
  226. .text:0804AF95                 cmp     edx, 0Fh
  227. .text:0804AF98                 jnz     short loc_804AF88
  228. .text:0804AF9A                 mov     eax, [ebp+var_518]
  229. .text:0804AFA0                 test    eax, eax
  230. .text:0804AFA2                 jle     short loc_804AFFA
  231. .text:0804AFA4                 xor     edi, edi
  232. .text:0804AFA6
  233. .text:0804AFA6 loc_804AFA6:
  234. .text:0804AFA6                 mov     eax, [ebp+var_514]
  235. .text:0804AFAC                 movzx   edx, byte ptr [edi+eax]
  236. .text:0804AFB0                 mov     [ebp+edi*4+var_50C], 0
  237. .text:0804AFBB                 mov     ecx, [ebp+edx*4+var_8C]
  238. .text:0804AFC2                 test    edx, edx
  239. .text:0804AFC4                 lea     eax, [ecx+1]
  240. .text:0804AFC7                 mov     [ebp+edx*4+var_8C], eax
  241. .text:0804AFCE                 jle     short loc_804AFEF
  242. .text:0804AFD0                 mov     esi, edx
  243. .text:0804AFD2                 xor     ebx, ebx
  244. .text:0804AFD4                 xor     edx, edx
  245. .text:0804AFD6
  246. .text:0804AFD6 loc_804AFD6:  
  247. .text:0804AFD6                 mov     eax, ecx
  248. .text:0804AFD8                 add     edx, edx
  249. .text:0804AFDA                 and     eax, 1
  250. .text:0804AFDD                 add     ebx, 1
  251. .text:0804AFE0                 or      edx, eax
  252. .text:0804AFE2                 sar     ecx, 1
  253. .text:0804AFE4                 cmp     esi, ebx
  254. .text:0804AFE6                 jg      short loc_804AFD6
  255. .text:0804AFE8                 mov     [ebp+edi*4+var_50C], edx
  256. .text:0804AFEF
  257. .text:0804AFEF loc_804AFEF:
  258. .text:0804AFEF                 add     edi, 1
  259. .text:0804AFF2                 cmp     edi, [ebp+var_518]
  260. .text:0804AFF8                 jnz     short loc_804AFA6
  261. .text:0804AFFA
  262. .text:0804AFFA loc_804AFFA:  
  263. .text:0804AFFA                 mov     eax, [ebp+var_510]
  264. .text:0804B000                 cmp     eax, 9
  265. .text:0804B003                 jle     short loc_804B00A
  266. .text:0804B005                 mov     eax, 9
  267. .text:0804B00A
  268. .text:0804B00A loc_804B00A:  
  269. .text:0804B00A                 mov     ecx, [ebp+var_518]
  270. .text:0804B010                 mov     edx, [ebp+var_514]
  271. .text:0804B016                 mov     [esp+528h+var_520], eax
  272. .text:0804B01A                 lea     eax, [ebp+var_50C]
  273. .text:0804B020                 mov     [esp+528h+var_524], 0
  274. .text:0804B028                 mov     [esp+528h+var_528], 0
  275. .text:0804B02F                 call    zlib_mkonetab
  276. .text:0804B034                 add     esp, 51Ch
  277. .text:0804B03A                 pop     ebx
  278. .text:0804B03B                 pop     esi
  279. .text:0804B03C                 pop     edi
  280. .text:0804B03D                 pop     ebp
  281. .text:0804B03E                 retn
  282. .text:0804B03E zlib_mktable    endp
  283. .text:0804B03E
  284.  
  285. // zlib decompression block...main cource..welcome to the spaghetti code..
  286.  
  287. .text:0804B3D0 public zlib_decompress_block
  288. .text:0804B3D0 zlib_decompress_block proc near
  289. .text:0804B3D0
  290. .text:0804B3D0 var_18          = dword ptr -18h
  291. .text:0804B3D0 var_14          = dword ptr -14h
  292. .text:0804B3D0 var_10          = dword ptr -10h
  293. .text:0804B3D0 arg_0           = dword ptr  8
  294. .text:0804B3D0 arg_4           = dword ptr  0Ch
  295. .text:0804B3D0 arg_8           = dword ptr  10h
  296. .text:0804B3D0 arg_C           = dword ptr  14h
  297. .text:0804B3D0 arg_10          = dword ptr  18h
  298. .text:0804B3D0
  299. .text:0804B3D0                 push    ebp
  300. .text:0804B3D1                 mov     ebp, esp
  301. .text:0804B3D3                 push    edi
  302. .text:0804B3D4                 push    esi
  303. .text:0804B3D5                 push    ebx
  304. .text:0804B3D6                 sub     esp, 0Ch
  305. .text:0804B3D9                 mov     esi, [ebp+arg_0]
  306. .text:0804B3DC                 mov     [esp+18h+var_18], 100h
  307. .text:0804B3E3                 call    malloc
  308. .text:0804B3E8                 mov     dword ptr [esi+81A8h], 100h
  309. .text:0804B3F2                 mov     dword ptr [esi+81A4h], 0
  310. .text:0804B3FC                 mov     [esi+81A0h], eax
  311. .text:0804B402
  312. .text:0804B402 loc_804B402:    
  313. .text:0804B402                 mov     eax, [ebp+arg_8]
  314. .text:0804B405                 test    eax, eax
  315. .text:0804B407                 jle     short loc_804B450
  316. .text:0804B409                 mov     edx, [esi+198h]
  317. .text:0804B40F                 cmp     edx, 17h
  318. .text:0804B412                 mov     [ebp+var_14], edx
  319. .text:0804B415                 jg      short loc_804B461
  320. .text:0804B417
  321. .text:0804B417 loc_804B417:  
  322. .text:0804B417                 mov     ecx, [ebp+arg_4]
  323. .text:0804B41A                 add     edx, 8
  324. .text:0804B41D                 movzx   eax, byte ptr [ecx]
  325. .text:0804B420                 movzx   ecx, byte ptr [ebp+var_14]
  326. .text:0804B424                 add     [ebp+arg_4], 1
  327. .text:0804B428                 mov     [esi+198h], edx
  328. .text:0804B42E                 shl     eax, cl
  329. .text:0804B430                 sub     [ebp+arg_8], 1
  330. .text:0804B434                 or      [esi+194h], eax
  331. .text:0804B43A                 cmp     edx, 17h
  332. .text:0804B43D                 mov     [ebp+var_14], edx
  333. .text:0804B440                 jg      short loc_804B461
  334. .text:0804B442                 mov     eax, [ebp+arg_8]
  335. .text:0804B445                 test    eax, eax
  336. .text:0804B447                 jle     short loc_804B461
  337. .text:0804B449                 mov     edx, [ebp+var_14]
  338. .text:0804B44C                 jmp     short loc_804B417
  339. .text:0804B450
  340. .text:0804B450 loc_804B450:  
  341. .text:0804B450                 mov     ecx, [esi+198h]
  342. .text:0804B456                 test    ecx, ecx
  343. .text:0804B458                 mov     [ebp+var_14], ecx
  344. .text:0804B45B                 jle     loc_804B92D
  345. .text:0804B461
  346. .text:0804B461 loc_804B461:  
  347. .text:0804B461                 cmp     dword ptr [esi+14h], 0Ch
  348. .text:0804B465                 ja      short loc_804B402
  349. .text:0804B467                 mov     eax, [esi+14h]
  350. .text:0804B46A                 jmp     ds:off_80B3400[eax*4]
  351. .text:0804B471
  352. .text:0804B471 loc_804B471:    
  353. .text:0804B471                 cmp     [ebp+var_14], 0Fh
  354. .text:0804B475                 jle     loc_804B92D
  355. .text:0804B47B                 mov     eax, [esi+194h]
  356. .text:0804B481                 shr     dword ptr [esi+194h], 10h
  357. .text:0804B488                 movzx   ebx, al
  358. .text:0804B48B                 movzx   eax, ah
  359. .text:0804B48E                 shl     ebx, 8
  360. .text:0804B491                 or      ebx, eax
  361. .text:0804B493                 mov     eax, [ebp+var_14]
  362. .text:0804B496                 sub     eax, 10h
  363. .text:0804B499                 mov     [esi+198h], eax
  364. .text:0804B49F                 mov     eax, ebx
  365. .text:0804B4A1                 and     eax, 0F00h
  366. .text:0804B4A6                 cmp     eax, 800h
  367. .text:0804B4AB                 jnz     loc_804BA89
  368. .text:0804B4B1                 mov     eax, ebx
  369. .text:0804B4B3                 and     eax, 0F000h
  370. .text:0804B4B8                 cmp     eax, 7000h
  371. .text:0804B4BD                 jg      loc_804BA89
  372. .text:0804B4C3                 test    bl, 20h
  373. .text:0804B4C6                 jnz     loc_804BA89
  374. .text:0804B4CC                 mov     eax, ebx
  375. .text:0804B4CE                 mov     edx, 84210843h
  376. .text:0804B4D3                 imul    edx
  377. .text:0804B4D5                 add     edx, ebx
  378. .text:0804B4D7                 sar     edx, 4
  379. .text:0804B4DA                 mov     eax, edx
  380. .text:0804B4DC                 shl     eax, 5
  381. .text:0804B4DF                 sub     eax, edx
  382. .text:0804B4E1                 cmp     ebx, eax
  383. .text:0804B4E3                 jnz     loc_804BA89
  384. .text:0804B4E9
  385. .text:0804B4E9 loc_804B4E9:    
  386. .text:0804B4E9                 mov     dword ptr [esi+14h], 1
  387. .text:0804B4F0                 jmp     loc_804B402
  388. .text:0804B4F5
  389. .text:0804B4F5 loc_804B4F5:            
  390. .text:0804B4F5                 cmp     [ebp+var_14], 2
  391. .text:0804B4F9                 jle     loc_804B92D
  392. .text:0804B4FF                 mov     eax, [ebp+var_14]
  393. .text:0804B502                 sub     eax, 1
  394. .text:0804B505                 mov     [esi+198h], eax
  395. .text:0804B50B                 mov     eax, [esi+194h]
  396. .text:0804B511                 sub     dword ptr [esi+198h], 2
  397. .text:0804B518                 shr     eax, 1
  398. .text:0804B51A                 mov     [esi+194h], eax
  399. .text:0804B520                 shr     dword ptr [esi+194h], 2
  400. .text:0804B527                 and     eax, 3
  401. .text:0804B52A                 jnz     loc_804B98B
  402. .text:0804B530                 mov     ecx, [esi+198h]
  403. .text:0804B536                 mov     dword ptr [esi+14h], 0Ah
  404. .text:0804B53D                 and     ecx, 7
  405. .text:0804B540                 sub     [esi+198h], ecx
  406. .text:0804B546                 shr     dword ptr [esi+194h], cl
  407. .text:0804B54C                 jmp     loc_804B402
  408. .text:0804B551
  409. .text:0804B551 loc_804B551:      
  410. .text:0804B551                 cmp     [ebp+var_14], 0Dh
  411. .text:0804B555                 jle     loc_804B92D
  412. .text:0804B55B                 mov     eax, [esi+194h]
  413. .text:0804B561                 mov     edx, [esi+194h]
  414. .text:0804B567                 sub     dword ptr [esi+198h], 5
  415. .text:0804B56E                 sub     dword ptr [esi+198h], 5
  416. .text:0804B575                 and     eax, 1Fh
  417. .text:0804B578                 add     eax, 101h
  418. .text:0804B57D                 shr     edx, 5
  419. .text:0804B580                 mov     [esi+1Ch], eax
  420. .text:0804B583                 mov     eax, edx
  421. .text:0804B585                 shr     edx, 5
  422. .text:0804B588                 and     eax, 1Fh
  423. .text:0804B58B                 mov     [esi+194h], edx
  424. .text:0804B591                 and     edx, 0Fh
  425. .text:0804B594                 add     eax, 1
  426. .text:0804B597                 sub     dword ptr [esi+198h], 4
  427. .text:0804B59E                 shr     dword ptr [esi+194h], 4
  428. .text:0804B5A5                 lea     ebx, [edx+4]
  429. .text:0804B5A8                 mov     [esi+20h], eax
  430. .text:0804B5AB                 mov     [esi+24h], ebx
  431. .text:0804B5AE                 mov     dword ptr [esi+28h], 0
  432. .text:0804B5B5                 mov     dword ptr [esi+14h], 3
  433. .text:0804B5BC                 mov     dword ptr [esi+40h], 0
  434. .text:0804B5C3                 mov     dword ptr [esi+44h], 0
  435. .text:0804B5CA                 mov     dword ptr [esi+48h], 0
  436. .text:0804B5D1                 mov     dword ptr [esi+4Ch], 0
  437. .text:0804B5D8                 mov     word ptr [esi+50h], 0
  438. .text:0804B5DE                 mov     byte ptr [esi+52h], 0
  439. .text:0804B5E2                 jmp     loc_804B402
  440. .text:0804B5E7
  441. .text:0804B5E7 loc_804B5E7:                  
  442. .text:0804B5E7                 mov     edx, [esi+1Ch]
  443. .text:0804B5EA                 mov     eax, edx
  444. .text:0804B5EC                 add     eax, [esi+20h]
  445. .text:0804B5EF                 cmp     [esi+28h], eax
  446. .text:0804B5F2                 jl      loc_804B950
  447. .text:0804B5F8                 lea     ebx, [esi+53h]
  448. .text:0804B5FB                 mov     eax, ebx
  449. .text:0804B5FD                 call    zlib_mktable
  450. .text:0804B602                 mov     edx, [esi+20h]
  451. .text:0804B605                 add     ebx, [esi+1Ch]
  452. .text:0804B608                 mov     [esi+8], eax
  453. .text:0804B60B                 mov     eax, ebx
  454. .text:0804B60D                 call    zlib_mktable
  455. .text:0804B612                 mov     [esi+0Ch], eax
  456. .text:0804B615                 lea     eax, [esi+10h]
  457. .text:0804B618                 call    zlib_freetable
  458. .text:0804B61D                 mov     dword ptr [esi+10h], 0
  459. .text:0804B624                 mov     dword ptr [esi+14h], 6
  460. .text:0804B62B                 jmp     loc_804B402
  461. .text:0804B630
  462. .text:0804B630 loc_804B630:  
  463. .text:0804B630                 mov     edx, [esi+2Ch]
  464. .text:0804B633                 cmp     edx, [ebp+var_14]
  465. .text:0804B636                 jg      loc_804B92D
  466. .text:0804B63C                 mov     ecx, edx
  467. .text:0804B63E                 mov     eax, 1
  468. .text:0804B643                 shl     eax, cl
  469. .text:0804B645                 sub     [ebp+var_14], edx
  470. .text:0804B648                 lea     ebx, [eax-1]
  471. .text:0804B64B                 mov     eax, [ebp+var_14]
  472. .text:0804B64E                 and     ebx, [esi+194h]
  473. .text:0804B654                 add     ebx, [esi+30h]
  474. .text:0804B657                 shr     dword ptr [esi+194h], cl
  475. .text:0804B65D                 test    ebx, ebx
  476. .text:0804B65F                 mov     [esi+198h], eax
  477. .text:0804B665                 jle     short loc_804B69D
  478. .text:0804B667                 mov     eax, [esi+1Ch]
  479. .text:0804B66A                 mov     edx, [esi+28h]
  480. .text:0804B66D                 mov     [ebp+var_10], eax
  481. .text:0804B670                 add     eax, [esi+20h]
  482. .text:0804B673                 mov     ecx, edx
  483. .text:0804B675                 cmp     edx, eax
  484. .text:0804B677                 jge     short loc_804B69D
  485. .text:0804B679                 mov     edi, [esi+38h]
  486. .text:0804B67C                 jmp     short loc_804B68C
  487. .text:0804B680
  488. .text:0804B680 loc_804B680:        
  489. .text:0804B680                 mov     eax, [ebp+var_10]
  490. .text:0804B683                 add     eax, [esi+20h]
  491. .text:0804B686                 cmp     eax, edx
  492. .text:0804B688                 jle     short loc_804B69D
  493. .text:0804B68A                 mov     ecx, edx
  494. .text:0804B68C
  495. .text:0804B68C loc_804B68C:        
  496. .text:0804B68C                 mov     eax, edi
  497. .text:0804B68E                 sub     ebx, 1
  498. .text:0804B691                 mov     [edx+esi+53h], al
  499. .text:0804B695                 lea     edx, [ecx+1]
  500. .text:0804B698                 mov     [esi+28h], edx
  501. .text:0804B69B                 jnz     short loc_804B680
  502. .text:0804B69D
  503. .text:0804B69D loc_804B69D:  
  504. .text:0804B69D                 mov     dword ptr [esi+14h], 4
  505. .text:0804B6A4                 jmp     loc_804B402
  506. .text:0804B6A9
  507. .text:0804B6A9 loc_804B6A9:          
  508. .text:0804B6A9                 cmp     [ebp+var_14], 2
  509. .text:0804B6AD                 jle     loc_804B92D
  510. .text:0804B6B3                 mov     ecx, [esi+28h]
  511. .text:0804B6B6                 mov     ebx, [esi+24h]
  512. .text:0804B6B9                 cmp     ecx, ebx
  513. .text:0804B6BB                 jl      short loc_804B6F1
  514. .text:0804B6BD                 lea     esi, [esi+0]
  515. .text:0804B6C0                 jmp     short loc_804B6FA
  516. .text:0804B6C2
  517. .text:0804B6C2 loc_804B6C2:        
  518. .text:0804B6C2                 movzx   edx, byte ptr [esi+194h]
  519. .text:0804B6C9                 movzx   eax, ds:lenlenmap_6439[ecx]
  520. .text:0804B6D0                 sub     dword ptr [esi+198h], 3
  521. .text:0804B6D7                 shr     dword ptr [esi+194h], 3
  522. .text:0804B6DE                 and     edx, 7
  523. .text:0804B6E1                 mov     [eax+esi+40h], dl
  524. .text:0804B6E5                 lea     eax, [ecx+1]
  525. .text:0804B6E8                 cmp     eax, ebx
  526. .text:0804B6EA                 mov     ecx, eax
  527. .text:0804B6EC                 mov     [esi+28h], eax
  528. .text:0804B6EF                 jge     short loc_804B6FA
  529. .text:0804B6F1
  530. .text:0804B6F1 loc_804B6F1:  
  531. .text:0804B6F1                 cmp     dword ptr [esi+198h], 2
  532. .text:0804B6F8                 jg      short loc_804B6C2
  533. .text:0804B6FA
  534. .text:0804B6FA loc_804B6FA:    
  535. .text:0804B6FA                 cmp     ecx, ebx
  536. .text:0804B6FC                 jnz     loc_804B402
  537. .text:0804B702                 lea     eax, [esi+40h]
  538. .text:0804B705                 mov     edx, 13h
  539. .text:0804B70A                 call    zlib_mktable
  540. .text:0804B70F                 mov     dword ptr [esi+14h], 4
  541. .text:0804B716                 mov     dword ptr [esi+28h], 0
  542. .text:0804B71D                 mov     [esi+10h], eax
  543. .text:0804B720                 jmp     loc_804B402
  544. .text:0804B725
  545. .text:0804B725 loc_804B725:  
  546. .text:0804B725                 mov     ecx, [esi+8]
  547. .text:0804B728                 lea     edx, [esi+198h]
  548. .text:0804B72E                 lea     eax, [esi+194h]
  549. .text:0804B734                 call    zlib_huflookup
  550. .text:0804B739                 cmp     eax, 0FFFFFFFFh
  551. .text:0804B73C                 jz      loc_804B92D
  552. .text:0804B742                 cmp     eax, 0FFFFFFFEh
  553. .text:0804B745                 jz      loc_804BA89
  554. .text:0804B74B                 cmp     eax, 0FFh
  555. .text:0804B750                 jle     loc_804B9A9
  556. .text:0804B756                 cmp     eax, 100h
  557. .text:0804B75B                 nop
  558. .text:0804B75C                 lea     esi, [esi+0]
  559. .text:0804B760                 jz      loc_804B9F1
  560. .text:0804B766                 cmp     eax, 11Dh
  561. .text:0804B76B                 nop
  562. .text:0804B76C                 lea     esi, [esi+0]
  563. .text:0804B770                 jg      loc_804B402
  564. .text:0804B776                 mov     dword ptr [esi+14h], 7
  565. .text:0804B77D                 mov     [esi+18h], eax
  566. .text:0804B780                 jmp     loc_804B402
  567. .text:0804B785
  568. .text:0804B785 loc_804B785:          
  569. .text:0804B785                 cmp     [ebp+var_14], 0Fh
  570. .text:0804B789                 jle     loc_804B92D
  571. .text:0804B78F                 movzx   eax, word ptr [esi+194h]
  572. .text:0804B796                 sub     dword ptr [esi+198h], 10h
  573. .text:0804B79D                 shr     dword ptr [esi+194h], 10h
  574. .text:0804B7A4                 mov     [esi+3Ch], eax
  575. .text:0804B7A7                 mov     dword ptr [esi+14h], 0Bh
  576. .text:0804B7AE                 jmp     loc_804B402
  577. .text:0804B7B3
  578. .text:0804B7B3 loc_804B7B3:                
  579. .text:0804B7B3                 cmp     [ebp+var_14], 0Fh
  580. .text:0804B7B7                 jle     loc_804B92D
  581. .text:0804B7BD                 mov     eax, [ebp+var_14]
  582. .text:0804B7C0                 movzx   edx, word ptr [esi+194h]
  583. .text:0804B7C7                 shr     dword ptr [esi+194h], 10h
  584. .text:0804B7CE                 sub     eax, 10h
  585. .text:0804B7D1                 mov     [esi+198h], eax
  586. .text:0804B7D7                 mov     eax, [esi+3Ch]
  587. .text:0804B7DA                 xor     edx, 0FFFFh
  588. .text:0804B7E0                 cmp     eax, edx
  589. .text:0804B7E2                 jnz     loc_804BA89
  590. .text:0804B7E8                 cmp     eax, 1
  591. .text:0804B7EB                 sbb     eax, eax
  592. .text:0804B7ED                 and     eax, 0FFFFFFF5h
  593. .text:0804B7F0                 add     eax, 0Ch
  594. .text:0804B7F3                 mov     [esi+14h], eax
  595. .text:0804B7F6                 jmp     loc_804B402
  596. .text:0804B7FB
  597. .text:0804B7FB loc_804B7FB:    
  598. .text:0804B7FB                 mov     ecx, [esi+0Ch]
  599. .text:0804B7FE                 lea     edx, [esi+198h]
  600. .text:0804B804                 lea     eax, [esi+194h]
  601. .text:0804B80A                 call    zlib_huflookup
  602. .text:0804B80F                 cmp     eax, 0FFFFFFFFh
  603. .text:0804B812                 jz      loc_804B92D
  604. .text:0804B818                 cmp     eax, 0FFFFFFFEh
  605. .text:0804B81B                 jz      loc_804BA89
  606. .text:0804B821                 mov     dword ptr [esi+14h], 9
  607. .text:0804B828                 mov     [esi+18h], eax
  608. .text:0804B82B                 jmp     loc_804B402
  609. .text:0804B830
  610. .text:0804B830 loc_804B830:                  
  611. .text:0804B830                 mov     eax, [esi+18h]
  612. .text:0804B833                 lea     eax, [eax+eax*2]
  613. .text:0804B836                 lea     edi, ds:80B35A0h[eax*4]
  614. .text:0804B83D                 movsx   edx, word ptr [edi+2]
  615. .text:0804B841                 cmp     edx, [ebp+var_14]
  616. .text:0804B844                 jg      loc_804B92D
  617. .text:0804B84A                 mov     ecx, edx
  618. .text:0804B84C                 mov     eax, 1
  619. .text:0804B851                 shl     eax, cl
  620. .text:0804B853                 sub     [ebp+var_14], edx
  621. .text:0804B856                 lea     ebx, [eax-1]
  622. .text:0804B859                 mov     eax, [ebp+var_14]
  623. .text:0804B85C                 and     ebx, [esi+194h]
  624. .text:0804B862                 shr     dword ptr [esi+194h], cl
  625. .text:0804B868                 add     ebx, [edi+4]
  626. .text:0804B86B                 mov     dword ptr [esi+14h], 6
  627. .text:0804B872                 mov     [esi+198h], eax
  628. .text:0804B878                 jmp     short loc_804B89C
  629. .text:0804B880 loc_804B880:                        
  630. .text:0804B880                 mov     eax, [esi+819Ch]
  631. .text:0804B886                 sub     eax, ebx
  632. .text:0804B888                 and     eax, 7FFFh
  633. .text:0804B88D                 movzx   edx, byte ptr [eax+esi+19Ch]
  634. .text:0804B895                 mov     eax, esi
  635. .text:0804B897                 call    zlib_emit_char
  636. .text:0804B89C
  637. .text:0804B89C loc_804B89C:                        
  638. .text:0804B89C                 mov     eax, [esi+34h]
  639. .text:0804B89F                 sub     eax, 1
  640. .text:0804B8A2                 mov     [esi+34h], eax
  641. .text:0804B8A5                 add     eax, 1
  642. .text:0804B8A8                 jnz     short loc_804B880
  643. .text:0804B8AA                 jmp     loc_804B402
  644. .text:0804B8AF loc_804B8AF:                      
  645. .text:0804B8AF                 mov     eax, [esi+18h]
  646. .text:0804B8B2                 lea     eax, [eax+eax*2]
  647. .text:0804B8B5                 lea     ebx, ds:80B2834h[eax*4]
  648. .text:0804B8BC                 movsx   edx, word ptr [ebx+2]
  649. .text:0804B8C0                 cmp     edx, [ebp+var_14]
  650. .text:0804B8C3                 jg      short loc_804B92D
  651. .text:0804B8C5                 mov     ecx, edx
  652. .text:0804B8C7                 mov     eax, 1
  653. .text:0804B8CC                 shl     eax, cl
  654. .text:0804B8CE                 sub     eax, 1
  655. .text:0804B8D1                 and     eax, [esi+194h]
  656. .text:0804B8D7                 shr     dword ptr [esi+194h], cl
  657. .text:0804B8DD                 add     eax, [ebx+4]
  658. .text:0804B8E0                 sub     [esi+198h], edx
  659. .text:0804B8E6                 mov     [esi+34h], eax
  660. .text:0804B8E9                 mov     dword ptr [esi+14h], 8
  661. .text:0804B8F0                 jmp     loc_804B402
  662. .text:0804B8F5 loc_804B8F5:                          
  663. .text:0804B8F5                 cmp     [ebp+var_14], 7
  664. .text:0804B8F9                 jle     short loc_804B92D
  665. .text:0804B8FB                 movzx   edx, byte ptr [esi+194h]
  666. .text:0804B902                 mov     eax, esi
  667. .text:0804B904                 call    zlib_emit_char
  668. .text:0804B909                 mov     eax, [esi+3Ch]
  669. .text:0804B90C                 sub     dword ptr [esi+198h], 8
  670. .text:0804B913                 shr     dword ptr [esi+194h], 8
  671. .text:0804B91A                 sub     eax, 1
  672. .text:0804B91D                 test    eax, eax
  673. .text:0804B91F                 mov     [esi+3Ch], eax
  674. .text:0804B922                 jnz     loc_804B402
  675. .text:0804B928                 jmp     loc_804B4E9
  676. .text:0804B92D
  677. .text:0804B92D loc_804B92D:    
  678. .text:0804B92D                 mov     eax, [esi+81A0h]
  679. .text:0804B933                 mov     ebx, [ebp+arg_C]
  680. .text:0804B936                 mov     edx, [ebp+arg_10]
  681. .text:0804B939                 mov     [ebx], eax
  682. .text:0804B93B                 mov     eax, [esi+81A4h]
  683. .text:0804B941                 mov     [edx], eax
  684. .text:0804B943                 add     esp, 0Ch
  685. .text:0804B946                 mov     eax, 1
  686. .text:0804B94B                 pop     ebx
  687. .text:0804B94C                 pop     esi
  688. .text:0804B94D                 pop     edi
  689. .text:0804B94E                 pop     ebp
  690. .text:0804B94F                 retn
  691. .text:0804B950 loc_804B950:          
  692. .text:0804B950                 mov     ecx, [esi+10h]
  693. .text:0804B953                 lea     edx, [esi+198h]
  694. .text:0804B959                 lea     eax, [esi+194h]
  695. .text:0804B95F                 call    zlib_huflookup
  696. .text:0804B964                 cmp     eax, 0FFFFFFFFh
  697. .text:0804B967                 mov     edx, eax
  698. .text:0804B969                 jz      short loc_804B92D
  699. .text:0804B96B                 cmp     eax, 0FFFFFFFEh
  700. .text:0804B96E                 jz      loc_804BA89
  701. .text:0804B974                 cmp     eax, 0Fh
  702. .text:0804B977                 jg      short loc_804B9B7
  703. .text:0804B979                 mov     eax, [esi+28h]
  704. .text:0804B97C                 mov     [eax+esi+53h], dl
  705. .text:0804B980                 add     eax, 1
  706. .text:0804B983                 mov     [esi+28h], eax
  707. .text:0804B986                 jmp     loc_804B402
  708. .text:0804B98B loc_804B98B:                          
  709. .text:0804B98B                 cmp     eax, 1
  710. .text:0804B98E                 jz      loc_804BA2E
  711. .text:0804B994                 cmp     eax, 2
  712. .text:0804B997                 jnz     loc_804B402
  713. .text:0804B99D                 mov     dword ptr [esi+14h], 2
  714. .text:0804B9A4                 jmp     loc_804B402
  715. .text:0804B9A9 loc_804B9A9:                  
  716. .text:0804B9A9                 mov     edx, eax
  717. .text:0804B9AB                 mov     eax, esi
  718. .text:0804B9AD                 call    zlib_emit_char
  719. .text:0804B9B2                 jmp     loc_804B402
  720. .text:0804B9B7 loc_804B9B7:    
  721. .text:0804B9B7                 cmp     eax, 10h
  722. .text:0804B9BA                 jz      loc_804BA45
  723. .text:0804B9C0                 cmp     eax, 11h
  724. .text:0804B9C3                 jz      loc_804BA66
  725. .text:0804B9C9                 cmp     eax, 12h
  726. .text:0804B9CC                 mov     dword ptr [esi+2Ch], 7
  727. .text:0804B9D3                 jz      loc_804BA7B
  728. .text:0804B9D9                 mov     dword ptr [esi+30h], 3
  729. .text:0804B9E0                 xor     eax, eax
  730. .text:0804B9E2
  731. .text:0804B9E2 loc_804B9E2:
  732. .text:0804B9E2                 mov     [esi+38h], eax
  733. .text:0804B9E5                 mov     dword ptr [esi+14h], 5
  734. .text:0804B9EC                 jmp     loc_804B402
  735. .text:0804B9F1 loc_804B9F1:  
  736. .text:0804B9F1                 mov     eax, [esi+8]
  737. .text:0804B9F4                 cmp     eax, [esi]
  738. .text:0804B9F6                 mov     dword ptr [esi+14h], 1
  739. .text:0804B9FD                 jz      short loc_804BA0E
  740. .text:0804B9FF                 lea     eax, [esi+8]
  741. .text:0804BA02                 call    zlib_freetable
  742. .text:0804BA07                 mov     dword ptr [esi+8], 0
  743. .text:0804BA0E
  744. .text:0804BA0E loc_804BA0E:  
  745. .text:0804BA0E                 mov     eax, [esi+0Ch]
  746. .text:0804BA11                 cmp     eax, [esi+4]
  747. .text:0804BA14                 jz      loc_804B402
  748. .text:0804BA1A                 lea     eax, [esi+0Ch]
  749. .text:0804BA1D                 call    zlib_freetable
  750. .text:0804BA22                 mov     dword ptr [esi+0Ch], 0
  751. .text:0804BA29                 jmp     loc_804B402
  752. .text:0804BA2E
  753. .text:0804BA2E loc_804BA2E:
  754. .text:0804BA2E                 mov     eax, [esi]
  755. .text:0804BA30                 mov     dword ptr [esi+14h], 6
  756. .text:0804BA37                 mov     [esi+8], eax
  757. .text:0804BA3A                 mov     eax, [esi+4]
  758. .text:0804BA3D                 mov     [esi+0Ch], eax
  759. .text:0804BA40                 jmp     loc_804B402
  760. .text:0804BA45
  761. .text:0804BA45 loc_804BA45:  
  762. .text:0804BA45                 mov     edx, [esi+28h]
  763. .text:0804BA48                 xor     eax, eax
  764. .text:0804BA4A                 mov     dword ptr [esi+2Ch], 2
  765. .text:0804BA51                 mov     dword ptr [esi+30h], 3
  766. .text:0804BA58                 test    edx, edx
  767. .text:0804BA5A                 jle     short loc_804B9E2
  768. .text:0804BA5C                 movzx   eax, byte ptr [edx+esi+52h]
  769. .text:0804BA61                 jmp     loc_804B9E2
  770. .text:0804BA66
  771. .text:0804BA66 loc_804BA66:          
  772. .text:0804BA66                 xor     eax, eax
  773. .text:0804BA68                 mov     dword ptr [esi+2Ch], 3
  774. .text:0804BA6F                 mov     dword ptr [esi+30h], 3
  775. .text:0804BA76                 jmp     loc_804B9E2
  776. .text:0804BA7B
  777. .text:0804BA7B loc_804BA7B:  
  778. .text:0804BA7B                 xor     eax, eax
  779. .text:0804BA7D                 mov     dword ptr [esi+30h], 0Bh
  780. .text:0804BA84                 jmp     loc_804B9E2
  781. .text:0804BA89
  782. .text:0804BA89 loc_804BA89:  
  783. .text:0804BA89                 mov     eax, [esi+81A0h]
  784. .text:0804BA8F                 mov     [esp+18h+var_18], eax
  785. .text:0804BA92                 call    free
  786. .text:0804BA97                 mov     ebx, [ebp+arg_10]
  787. .text:0804BA9A                 xor     eax, eax
  788. .text:0804BA9C                 mov     ecx, [ebp+arg_C]
  789. .text:0804BA9F                 mov     dword ptr [esi+81A0h], 0
  790. .text:0804BAA9                 mov     dword ptr [ebx], 0
  791. .text:0804BAAF                 mov     dword ptr [ecx], 0
  792. .text:0804BAB5                 add     esp, 0Ch
  793. .text:0804BAB8                 pop     ebx
  794. .text:0804BAB9                 pop     esi
  795. .text:0804BABA                 pop     edi
  796. .text:0804BABB                 pop     ebp
  797. .text:0804BABC                 retn
  798. .text:0804BABC zlib_decompress_block endp
  799.  
  800. :: Finally...
  801. ;; cleaning up mess after decompressing...
  802.  
  803. .text:0804B2B0 public zlib_decompress_cleanup
  804. .text:0804B2B0 zlib_decompress_cleanup proc near
  805. .text:0804B2B0
  806. .text:0804B2B0 arg_0           = dword ptr  8
  807. .text:0804B2B0
  808. .text:0804B2B0                 push    ebp
  809. .text:0804B2B1                 mov     ebp, esp
  810. .text:0804B2B3                 push    ebx
  811. .text:0804B2B4                 sub     esp, 4
  812. .text:0804B2B7                 mov     ebx, [ebp+arg_0]
  813. .text:0804B2BA                 mov     eax, [ebx+8]
  814. .text:0804B2BD                 test    eax, eax
  815. .text:0804B2BF                 jz      short loc_804B2CD
  816. .text:0804B2C1                 cmp     eax, [ebx]
  817. .text:0804B2C3                 jz      short loc_804B2CD
  818. .text:0804B2C5                 lea     eax, [ebx+8]
  819. .text:0804B2C8                 call    zlib_freetable
  820. .text:0804B2CD loc_804B2CD:  
  821. .text:0804B2CD                 mov     eax, [ebx+0Ch]
  822. .text:0804B2D0                 test    eax, eax
  823. .text:0804B2D2                 jz      short loc_804B2E1
  824. .text:0804B2D4                 cmp     eax, [ebx+4]
  825. .text:0804B2D7                 jz      short loc_804B2E1
  826. .text:0804B2D9                 lea     eax, [ebx+0Ch]
  827. .text:0804B2DC                 call    zlib_freetable
  828. .text:0804B2E1
  829. .text:0804B2E1 loc_804B2E1:  
  830. .text:0804B2E1                 mov     eax, [ebx+10h]
  831. .text:0804B2E4                 test    eax, eax
  832. .text:0804B2E6                 jz      short loc_804B2F0
  833. .text:0804B2E8                 lea     eax, [ebx+10h]
  834. .text:0804B2EB                 call    zlib_freetable
  835. .text:0804B2F0
  836. .text:0804B2F0 loc_804B2F0:  
  837. .text:0804B2F0                 mov     eax, ebx
  838. .text:0804B2F2                 call    zlib_freetable
  839. .text:0804B2F7                 lea     eax, [ebx+4]
  840. .text:0804B2FA                 call    zlib_freetable
  841. .text:0804B2FF                 mov     [ebp+arg_0], ebx
  842. .text:0804B302                 add     esp, 4
  843. .text:0804B305                 pop     ebx
  844. .text:0804B306                 pop     ebp
  845. .text:0804B307                 jmp     free
  846. .text:0804B307 zlib_decompress_cleanup endp
  847.  
  848.  
  849. ;; #MalwareMustDie!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement