Expand description
Parse and inspect NSIS installer binaries.
This crate provides typed access to all internal structures within an NSIS (NullSoft Scriptable Install System) installer executable, from the PE overlay through decompressed headers down to individual script instructions and embedded files.
§Quick Start
use nsis::NsisInstaller;
let file_bytes = std::fs::read("installer.exe").unwrap();
let installer = NsisInstaller::from_bytes(&file_bytes).unwrap();
println!("Version: {:?}", installer.version());
for section in installer.sections() {
let section = section.unwrap();
println!(" Section: code_size={}", section.code_size());
}§Architecture
The crate is organized in layers:
- PE overlay detection (
addressmap::PeOverlay): Locates the NSIS data appended after the PE sections. - Decompression (
decompress): Handles zlib, bzip2, and LZMA decompression of the header block. - Low-level structures (
header,nsis,strings,opcode): View types for each structure in the NSIS format. - High-level API (
NsisInstaller): Ties everything together into a convenient exploration interface.
§Design
Low-level structure types borrow from either the original file byte slice or the decompressed header buffer. Accessor methods read directly from the underlying buffer using little-endian byte decoding. The only heap allocations are for decompressed data and decoded strings.
Re-exports§
pub use error::Error;pub use installer::BasicBlock;pub use installer::BranchCondition;pub use installer::Callback;pub use installer::ControlFlowEdge;pub use installer::ControlFlowTarget;pub use installer::EdgeKind;pub use installer::ExecCommand;pub use installer::ExecIter;pub use installer::ExecOp;pub use installer::ExtractedFile;pub use installer::FileIter;pub use installer::NsisInstaller;pub use installer::PageHandler;pub use installer::PluginCall;pub use installer::PluginCallIter;pub use installer::RegDelete;pub use installer::RegRead;pub use installer::RegValueType;pub use installer::RegWrite;pub use installer::RegistryIter;pub use installer::RegistryOp;pub use installer::ScriptAnalysis;pub use installer::ScriptAnalysisDiagnostic;pub use installer::ScriptFunction;pub use installer::ScriptRoot;pub use installer::ScriptRootKind;pub use installer::ShellExecOp;pub use installer::Shortcut;pub use installer::ShortcutIter;pub use installer::Uninstaller;pub use installer::UninstallerIter;pub use opcode::EW_ABORT;pub use opcode::EW_ASSIGNVAR;pub use opcode::EW_BRINGTOFRONT;pub use opcode::EW_CALL;pub use opcode::EW_CHDETAILSVIEW;pub use opcode::EW_COPYFILES;pub use opcode::EW_CREATEDIR;pub use opcode::EW_CREATESHORTCUT;pub use opcode::EW_DELETEFILE;pub use opcode::EW_DELREG;pub use opcode::EW_EXECUTE;pub use opcode::EW_EXTRACTFILE;pub use opcode::EW_FCLOSE;pub use opcode::EW_FGETS;pub use opcode::EW_FGETWS;pub use opcode::EW_FINDCLOSE;pub use opcode::EW_FINDFIRST;pub use opcode::EW_FINDNEXT;pub use opcode::EW_FINDWINDOW;pub use opcode::EW_FOPEN;pub use opcode::EW_FPUTS;pub use opcode::EW_FPUTWS;pub use opcode::EW_FSEEK;pub use opcode::EW_GETDLGITEM;pub use opcode::EW_GETDLLVERSION;pub use opcode::EW_GETFILETIME;pub use opcode::EW_GETFLAG;pub use opcode::EW_GETFULLPATHNAME;pub use opcode::EW_GETOSINFO;pub use opcode::EW_GETTEMPFILENAME;pub use opcode::EW_IFFILEEXISTS;pub use opcode::EW_IFFLAG;pub use opcode::EW_INSTTYPESET;pub use opcode::EW_INTCMP;pub use opcode::EW_INTFMT;pub use opcode::EW_INTOP;pub use opcode::EW_INVALID_OPCODE;pub use opcode::EW_ISWINDOW;pub use opcode::EW_LOADANDSETIMAGE;pub use opcode::EW_LOCKWINDOW;pub use opcode::EW_LOG;pub use opcode::EW_MESSAGEBOX;pub use opcode::EW_NOP;pub use opcode::EW_PUSHPOP;pub use opcode::EW_QUIT;pub use opcode::EW_READENVSTR;pub use opcode::EW_READINISTR;pub use opcode::EW_READREGSTR;pub use opcode::EW_REBOOT;pub use opcode::EW_REGENUM;pub use opcode::EW_REGISTERDLL;pub use opcode::EW_RENAME;pub use opcode::EW_RESERVEDOPCODE;pub use opcode::EW_RET;pub use opcode::EW_RMDIR;pub use opcode::EW_SEARCHPATH;pub use opcode::EW_SECTIONSET;pub use opcode::EW_SENDMESSAGE;pub use opcode::EW_SETCTLCOLORS;pub use opcode::EW_SETFILEATTRIBUTES;pub use opcode::EW_SETFLAG;pub use opcode::EW_SHELLEXEC;pub use opcode::EW_SHOWWINDOW;pub use opcode::EW_SLEEP;pub use opcode::EW_STRCMP;pub use opcode::EW_STRLEN;pub use opcode::EW_UPDATETEXT;pub use opcode::EW_WRITEINI;pub use opcode::EW_WRITEREG;pub use opcode::EW_WRITEUNINSTALLER;
Modules§
- addressmap
- PE overlay detection for NSIS installers.
- decompress
- Decompression support for NSIS installer data.
- error
- Error types for NSIS installer parsing.
- header
- NSIS header structures.
- installer
- High-level NSIS installer API.
- nsis
- NSIS data structure view types.
- opcode
- NSIS opcode definitions and version-aware resolution.
- strings
- NSIS string table parsing.