如何访问 NSIS 安装程序脚本?
好吧,这就是这篇文章的大主题。
http://netcologne.dl.sourceforge.net/project/nsis/NSIS%202/2.09/nsis-2.09-src.tar.bz2 http://netcologne.dl.sourceforge.net/project/nsis/NSIS%202/2.09/nsis-2.09-src.tar.bz2
nsis-2.09-src\Source\exehead\fileform.c
nsis-2.09-src\Source\exehead\fileform.h
#define FH_SIG 0xDEADBEEF
// neato surprise signature that goes in firstheader. :)
#define FH_INT1 0x6C6C754E // 'Null'
#define FH_INT2 0x74666F73 // 'soft'
#define FH_INT3 0x74736E49 // 'Inst'
typedef struct
{
int flags; // FH_FLAGS_*
int siginfo; // FH_SIG
int nsinst[3]; // FH_INT1,FH_INT2,FH_INT3
// these point to the header+sections+entries+stringtable in the datablock
int length_of_header;
// this specifies the length of all the data (including the firstheader and CRC)
int length_of_all_following_data;
} firstheader;
数据样本:
$ ==> 00000000 ....
$+4 DEADBEEF
$+8 6C6C754E Null
$+C 74666F73 soft
$+10 74736E49 Inst
$+14 000268E2 157 922 length_of_header (inside <<Compressed Data>>)
$+18 011947CB 18 433 995 length_of_all_following_data
<<Compressed Data>>
$+011947CB CRC32
获取未压缩的>
好吧,这个数据被写入%temp%
但是,如果 ShareMode=None 且 Attributes = DELETE_ON_CLOSE,则您无法访问它。
Fix:
Inside 'NSIS Setup.exe'
Replace
68 00 01 00 04 with
68 00 00 00 00
To avoid that this tempfile get's create with DELETE_ON_CLOSE
Background:
00402E56 |. 68 00010004 PUSH 4000100 ; |Attributes = TEMPORARY|DELETE_ON_CLOSE
^^^^^^^^^^^-Patch Target
00402E5B |. 6A 02 PUSH 2 ; |Mode = CREATE_ALWAYS
00402E5D |. 53 PUSH EBX ; |pSecurity
00402E5E |. 53 PUSH EBX ; |ShareMode
00402E65 |. 68 000000C0 PUSH C0000000 ; |Access = GENERIC_READ|GENERIC_WRITE
00402E6A |. 50 PUSH EAX ; |FileName
00402E6B |. FF15 90704000 CALL [<&KERNEL32.CreateFileA>] ; \CreateFileA
好吧,那个大 未压缩的临时文件是这样开始的:
00000000 E2 68 02 00 A0 00 00 00 2C 01 00 00 08 00 00 00 2C âh , ,
E2 68 02 00 -> 000268E2 157 922 length_of_header (内)
只需剪切这个数据块,我们就可以将 NSIS 脚本作为未压缩的原始脚本
其余数据是 7z 将为您提取的数据文件。
更新:获取通用提取器 http://legroom.net/software/uniextract
It uses
cmdTotal 1.02 (c) 2006/2007 KaKeeware, http://www.kakeeware.com
带插件:InstExpl.wcx http://www.totalcmd.net/plugring/installexplorer.html
或多或少成功地提取了 Nullsoft Setup.exe。
小心不要太相信提取的文件 - 有些东西已损坏。
(为此更喜欢 7zip。)
然而该程序的主要内容是脚本文件这是我在 3-4 示例中测试的,状态良好。 :)
Okay an update:
这是我的一个非常早期的版本Nullsoft 反编译器 1.2 alpha http://deioncube.in/files/cw2k/Nullsoft%20Installer%20Decompiler/nsiDecomp%232.7z
目前它仍在大力开发中,但这是它的第一个未完成的原始版本。
UPDATE(About a year later):
NullsoftDecompiler 3 http://sourceforge.net/projects/nsidis/
Finally I added decompression support.