Add files via upload

Fix for Uninstall leaves www/exec #53 and other improvements
 - Split regular installation and install-dev into separate scripts
 - Streamlined the installation script (only requires <enter> at the end to move to setup)
 - Redirected some unnecessary output to nul
 - Made formatting changes to prettify the output
This commit is contained in:
Jeff Odegard 2019-01-10 14:08:25 -07:00 committed by GitHub
parent 99eb5342cf
commit 5cc1fd2e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 183 additions and 94 deletions

100
install-dev.bat Normal file
View File

@ -0,0 +1,100 @@
@echo off
REM File: install-dev.bat
REM Author: Ryan Prather, Jeff Odegard
REM Purpose: Windows / XAMPP Installation Script
REM Created: Jan 5, 2015
REM Portions Copyright 2016-2019: Cyber Perspective, All rights reserved
REM Released under the Apache v2.0 License
REM Portions Copyright (c) 2012-2015, Salient Federal Solutions
REM Portions Copyright (c) 2008-2011, Science Applications International Corporation (SAIC)
REM Released under Modified BSD License
REM See license.txt for details
REM Change Log:
REM - Jan 5, 2015 - File created
REM - Sep 1, 2016 - Copyright updated, added comments and file header
REM - Oct 7, 2016 - Copying Windows / XAMPP config.xml
REM - Nov 14, 2016 - Converted xcopy for config file to copy
REM - Nov 18, 2016 - Changed file moves to copies, removed deleting existing *.cgi & *.pl script in the CGI_PATH and deleting CONF folder
REM - Dec 12, 2016 - Removed pthreads library because it is no longer needed.
REM Rename existing Apache, MySQL/mariaDB, and PHP config files to .old before copying hardened files.
REM - Dec 13, 2016 - Fixed syntax of the rename command
REM - Dec 19, 2016 - Fixed copy syntax for config.xml file
REM - Jan 30, 2017 - Fixed error with copy of config-xampp-win.xml to config.xml where it required full path
REM - Apr 5, 2017 - Added mkdir for \xampp\php\logs directory (not included when installed)
REM - Jun 27, 2017 - Removed copy cgi-bin contents
REM - Sep 19, 2018 - Deleting unnecessary C:\xampp\htdocs folder.
REM - Oct 3, 2018 - Redirected deletion of htdocs folder to nul
REM - Nov 27, 2018 - Added php-dev.ini to conf folder and added prompts to allow for development installation
@echo The Sagacity dev configuration installs and enables php xdebug used for troubleshooting and development work.
echo.
@echo NOTE: The dev configuration will *noticably* impact Sagacity's performance.
@echo *** For a production environment, please use install.bat instead! ***
@echo.
@echo For your dev installation we also recommend installing QCacheGrindWin from
@echo.
@echo https://sourceforge.net/projects/qcachegrindwin/
@echo.
set /p dev="Do you want to install the dev configuration? (y/N) "
set result=0
if "%dev%"=="Y" (set result=1)
if "%dev%"=="y" (set result=1)
if "%dev%"=="Yes" (set result=1)
if "%dev%"=="YES" (set result=1)
if "%dev%"=="yes" (set result=1)
if "%result%"=="0" (
@echo Dev installation aborted.
@echo Please use install.bat for a production installation.
exit
)
@echo - Create PHP log folder
mkdir c:\xampp\php\logs
@echo - Copy Apache, MySQL/mariaDB, and PHP configuration files
@echo - Renaming the original config files to *.old.
rename c:\xampp\mysql\bin\my.ini my.ini.old
copy c:\xampp\www\conf\my.ini c:\xampp\mysql\bin\
@echo - Installing MySQL service
c:\xampp\mysql\bin\mysqld --install mysql --defaults-file="c:\xampp\mysql\bin\my.ini"
net start mysql
rename c:\xampp\apache\conf\httpd.conf httpd.conf.old
copy c:\xampp\www\conf\httpd.conf c:\xampp\apache\conf
rename c:\xampp\apache\conf\extra\httpd-ssl.conf httpd-ssl.conf.old
copy c:\xampp\www\conf\httpd-ssl.conf c:\xampp\apache\conf\extra
rename c:\xampp\apache\conf\extra\httpd-xampp.conf httpd-xampp.conf.old
copy c:\xampp\www\conf\httpd-xampp.conf c:\xampp\apache\conf\extra
rename c:\xampp\php\php.ini php.ini.old
copy c:\xampp\www\conf\php-dev.ini c:\xampp\php\php.ini
copy c:\xampp\www\conf\php_xdebug-2.6.0-7.2-vc15.dll c:\xampp\php\ext\php_xdebug-2.6.0-7.2-vc15.dll
@echo - Deleting unnecessary C:\xampp\htdocs folder.
del /F /S /Q c:\xampp\htdocs 1>nul
@echo - Installing Apache service
c:\xampp\apache\bin\httpd -k install
net start apache2.4
@echo.
@echo Thank you for installing Sagacity. We want to know what you think!
@echo Please contact us at https://www.cyberperspectives.com/contact_us
@echo.
@echo If you like this tool, please tell a friend or co-worker!
@echo.
set /p browser="Press enter to continue setup with http://localhost/setup.php"
start http://localhost

View File

@ -5,7 +5,7 @@
REM Purpose: Windows / XAMPP Installation Script
REM Created: Jan 5, 2015
REM Portions Copyright 2016: Cyber Perspective, All rights reserved
REM Portions Copyright 2016-2019: Cyber Perspectives, LLC, All rights reserved
REM Released under the Apache v2.0 License
REM Portions Copyright (c) 2012-2015, Salient Federal Solutions
@ -31,14 +31,18 @@
REM - Oct 3, 2018 - Redirected deletion of htdocs folder to nul
REM - Nov 27, 2018 - Added php-dev.ini to conf folder and added prompts to allow for development installation
REM To install the php xdebug development tools, use install-dev.bat
@echo - Create PHP log folder
mkdir c:\xampp\php\logs
echo This is now going to copy configuration files for Apache, MySQL/mariaDB, and PHP after renaming the files to *.old.
@echo - Copy Apache, MySQL/mariaDB, and PHP configuration files
@echo - Renaming the original config files to *.old.
rename c:\xampp\mysql\bin\my.ini my.ini.old
copy c:\xampp\www\conf\my.ini c:\xampp\mysql\bin\
@echo Installing MySQL service
@echo - Installing MySQL service
c:\xampp\mysql\bin\mysqld --install mysql --defaults-file="c:\xampp\mysql\bin\my.ini"
net start mysql
@ -49,48 +53,24 @@ copy c:\xampp\www\conf\httpd-ssl.conf c:\xampp\apache\conf\extra
rename c:\xampp\apache\conf\extra\httpd-xampp.conf httpd-xampp.conf.old
copy c:\xampp\www\conf\httpd-xampp.conf c:\xampp\apache\conf\extra
rename c:\xampp\php\php.ini php.ini.old
copy c:\xampp\www\conf\php.ini c:\xampp\php
del c:\xampp\www\conf\php_xdebug-2.6.0-7.2-vc15.dll 1>nul
set /p dev="Do you want to install the dev configuration? (Y/n) "
set result=0
if "%dev%"=="Y" (set result=1)
if "%dev%"=="y" (set result=1)
if "%dev%"=="Yes" (set result=1)
if "%dev%"=="YES" (set result=1)
if "%dev%"=="yes" (set result=1)
if "%result%"=="1" (
copy c:\xampp\www\conf\php-dev.ini c:\xampp\php\php.ini
copy c:\xampp\www\conf\php_xdebug-2.6.0-7.2-vc15.dll c:\xampp\php\ext\php_xdebug-2.6.0-7.2-vc15.dll
@echo For a dev installation we also recommend installing QCacheGrindWin at
@echo.
@echo https://sourceforge.net/projects/qcachegrindwin/
@echo.
) else (
copy c:\xampp\www\conf\php.ini c:\xampp\php
del c:\xampp\www\conf\php_xdebug-2.6.0-7.2-vc15.dll 1>nul
)
echo Deleting unnecessary C:\xampp\htdocs folder.
@echo - Deleting unnecessary C:\xampp\htdocs folder.
del /F /S /Q c:\xampp\htdocs 1>nul
@echo Installing Apache service
@echo - Installing Apache service
c:\xampp\apache\bin\httpd -k install
net start apache2.4
echo Thank you for installing Sagacity. We want to know what you think!
echo Please contact us at https://www.cyberperspectives.com/contact_us
echo.
echo If you like this tool, please tell a friend or co-worker!
echo.
set /p browser="Continue setup with http://localhost/setup.php? (Y/n) "
@echo.
@echo Thank you for installing Sagacity. We want to know what you think!
@echo Please contact us at https://www.cyberperspectives.com/contact_us
@echo.
@echo If you like this tool, please tell a friend or co-worker!
@echo.
set result=1
if "%browser%"=="N" (set result=0)
if "%browser%"=="n" (set result=0)
if "%browser%"=="no" (set result=0)
if "%browser%"=="No" (set result=0)
if "%browser%"=="NO" (set result=0)
set /p foo="Press enter to continue setup."
start http://localhost
if "%result%"=="1" (
start http://localhost
)

View File

@ -1,54 +1,63 @@
@echo off
REM File: uninstall.bat
REM Author: Jeff Odegard
REM Purpose: Windows / XAMPP Uninstallation Script
REM Created: Oct 3, 2018
REM Copyright 2018: Cyber Perspective, All rights reserved
REM Released under the Apache v2.0 License
REM See license.txt for details
REM Change Log:
REM - Oct 3, 2018 - File created
echo.
echo This will completely uninstall Sagacity and XAMPP and delete
echo the findings database and all result files in www/tmp.
echo.
echo This cannot be undone.
echo.
set /p uninstall="Are you sure? (y/N) "
set result=0
if "%uninstall%"=="Y" (set result=1)
if "%uninstall%"=="y" (set result=1)
if "%uninstall%"=="Yes" (set result=1)
if "%uninstall%"=="yes" (set result=1)
if "%uninstall%"=="YES" (set result=1)
if "%result%"=="1" (
cd C:\
echo - Stopping Apache and MySQL services.
sc stop Apache2.4
sc stop mysql
echo - Deleting the MySQL service.
sc delete mysql
echo - Deleting the Sagacity www folder.
del /F /S /Q C:\xampp\www 1>nul
rmdir /S /Q C:\xampp\www
echo - Uninstalling XAMPP
C:\xampp\uninstall.exe --mode unattended
)
echo.
echo Thank you for trying Sagacity. If you have any questions or comments, please contact us at https://www.cyberperspectives.com/contact_us
echo.
if "%result%"=="1" (
set /p foo="Uninstall complete. Press enter to continue."
) else (
set /p foo="Whew, that was a close one! Uninstall aborted. Press enter to continue."
)
@echo off
REM File: uninstall.bat
REM Author: Jeff Odegard
REM Purpose: Windows / XAMPP Uninstallation Script
REM Created: Oct 3, 2018
REM Copyright 2018: Cyber Perspective, All rights reserved
REM Released under the Apache v2.0 License
REM See license.txt for details
REM Change Log:
REM - Oct 3, 2018 - File created
@echo.
@echo This will completely uninstall Sagacity and XAMPP and delete
@echo the findings database and all result files in www/tmp.
@echo.
@echo This cannot be undone.
@echo.
set /p uninstall="Are you sure? (y/N) "
set result=0
if "%uninstall%"=="Y" (set result=1)
if "%uninstall%"=="y" (set result=1)
if "%uninstall%"=="Yes" (set result=1)
if "%uninstall%"=="yes" (set result=1)
if "%uninstall%"=="YES" (set result=1)
if "%result%"=="1" (
cd C:\
@echo - Terminating PHP processes
taskkill /F /IM php.exe
@echo - Stopping Apache and MySQL services.
sc stop Apache2.4
sc stop mysql
@echo - Deleting the MySQL service.
sc delete mysql
@echo - Uninstalling XAMPP
C:\xampp\uninstall.exe --mode unattended
REM Deleting the www folder (and this script) has to wait until the very end
@echo.
@echo Waiting for background process uninstall.exe to finish
:LOOP
tasklist | find /i "uninstall" >nul 2>&1
IF ERRORLEVEL 1 (
timeout /T 1 >nul
GOTO LOOP
)
)
@echo.
if "%result%"=="1" (
@echo Thank you for trying Sagacity. If you have any questions or comments, please contact us at https://www.cyberperspectives.com/contact_us
@echo.
set /p foo="Uninstall complete. Press enter to continue."
rmdir /S /Q C:\xampp\www >nul 2>&1
exit /b
) else (
set /p foo="Whew, that was a close one! Uninstall aborted. Press enter to continue."
)