metasploit-framework/dev/windows/msf3.nsi

122 lines
4.7 KiB
Plaintext

; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Metasploit Framework"
!define PRODUCT_VERSION "3.0-Beta-1"
!define PRODUCT_PUBLISHER "Metasploit.com"
!define PRODUCT_WEB_SITE "http://www.metasploit.com"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
SetCompressor lzma
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "license_3.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Metasploit 3"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "framework-3.0-beta1.exe"
InstallDir "$PROGRAMFILES\Metasploit\Framework3"
ShowInstDetails show
ShowUnInstDetails show
Section "MainSection" SEC01
SetOutPath $INSTDIR
File /r "X:\Framework3\*.*"
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MSFConsole.lnk" "$INSTDIR\msfconsole.exe"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Cygshell.lnk" "$INSTDIR\cygwin.bat"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Developer Guide.lnk" "$INSTDIR\developer_guide.pdf"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteRegStr "HKLM" "Software\Cygnus Solutions\Msf300\mounts v2" "cygdrive prefix" "/cygdrive"
WriteRegDword "HKLM" "Software\Cygnus Solutions\Msf300\mounts v2" "cygdrive flags" "0x22"
WriteRegDword "HKLM" "Software\Cygnus Solutions\Msf300\mounts v2\/" "flags" "0x02"
WriteRegStr "HKLM" "Software\Cygnus Solutions\Msf300\mounts v2\/" "native" "$INSTDIR"
WriteRegDword "HKLM" "Software\Cygnus Solutions\Msf300\mounts v2\/usr/bin" "flags" "0x02"
WriteRegStr "HKLM" "Software\Cygnus Solutions\Msf300\mounts v2\/usr/bin" "native" "$INSTDIR/bin"
WriteRegDword "HKLM" "Software\Cygnus Solutions\Msf300\mounts v2\/usr/lib" "flags" "0x02"
WriteRegStr "HKLM" "Software\Cygnus Solutions\Msf300\mounts v2\/usr/lib" "native" "$INSTDIR/lib"
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}" "$ICONS_GROUP"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
Exec "$INSTDIR\msfconsole.exe"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
ReadRegStr $ICONS_GROUP ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}"
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\MSFConsole.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Cygshell.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Developer Guide.lnk"
RMDir /r "$SMPROGRAMS\$ICONS_GROUP"
RMDir /r "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd