eurysco

eurysco is a free and open source project based on PHP language, in order to enhance and simplify the remote administration of Microsoft operating systems with an intuitive, fast and responsive web interface

view my linkedin profileview my linkedin profile :)

Privacy Policy
     

Total sweet donations $23
Help me to support eurysco (^_^) !

Source euryscosrv

Source /




0001 setlocal enableextensions
0002 cd /d "%~dp0"
0003 
0004 wmic.exe os get osarchitecture | find "64"
0005 if %errorlevel% equ 0 set osarc=x64
0006 if %errorlevel% neq 0 set osarc=x86
0007 ver.exe | find " 5."
0008 if %errorlevel% equ 0 set osarc=x86&set osold="_xp2k3"&set sslprotocol=TLSv1
0009 if %errorlevel% neq 0 set osold=""
0010 
0011 if not exist "%cd%\ext\7zip.exe" copy "%cd%\installs\7z_%osarc%\7z.exe" "%cd%\ext\7zip.exe" /y
0012 if not exist "%cd%\ext\7z.dll" copy "%cd%\installs\7z_%osarc%\7z.dll" "%cd%\ext\7z.dll" /y
0013 
0014 set clr=0
0015 if exist "%cd%\apache_%osarc%" if not exist "%cd%\apache" ren "%cd%\apache_%osarc%" "apache" & set clr=1
0016 if exist "%cd%\apache_x64" rd "%cd%\apache_x64" /s /q
0017 if exist "%cd%\apache_x86" rd "%cd%\apache_x86" /s /q
0018 if exist "%cd%\php_%osarc%%osold:~1,-1%" if not exist "%cd%\php" ren "%cd%\php_%osarc%%osold:~1,-1%" "php" & set clr=1
0019 if exist "%cd%\php_x64" rd "%cd%\php_x64" /s /q
0020 if exist "%cd%\php_x86" rd "%cd%\php_x86" /s /q
0021 if exist "%cd%\php_x86_xp2k3" rd "%cd%\php_x86_xp2k3" /s /q
0022 if %clr% equ 1 cscript.exe "euryscoclr.vbs"
0023 
0024 set servicename_last=%1
0025 set servicename=%2
0026 set servicestart=%3
0027 set serviceuser=%4
0028 set servicedisplay=%5
0029 set serviceport=%6
0030 set phpport=%7
0031 set phpexe=%8
0032 set relpath=%9
0033 
0034 cd "%cd%"
0035 if not exist "euryscosrv.exe" cd..
0036 
0037 if %relpath:~1,-1% neq agent if not exist "%cd%\cert\%phpexe:~1,-1%.crt" cd "%cd%\apache\bin" & openssl.exe req -x509 -nodes -days 1825 -newkey rsa:2048 -sha512 -keyout "..\..\cert\%phpexe:~1,-1%.key" -out "..\..\cert\%phpexe:~1,-1%.crt" -config "..\conf\openssl.cnf" -subj "/C=EU/ST=eurysco Any State/L=eurysco Any Locality/O=eurysco Any Organization/OU=eurysco/CN=%computername%" & openssl.exe req -new -key "..\..\cert\%phpexe:~1,-1%.key" -out "..\..\cert\%phpexe:~1,-1%.csr" -config "..\conf\openssl.cnf" -subj "/C=EU/ST=eurysco Any State/L=eurysco Any Locality/O=eurysco Any Organization/OU=eurysco/CN=%computername%" & cd ..\..\
0038 if %relpath:~1,-1% neq agent echo Define SRVROOT "%cd%\apache">"%cd%\apache\conf\httpd_srvroot.conf"
0039 if %relpath:~1,-1% neq agent echo Listen %serviceport:~1,-1%>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_port.conf"
0040 if %relpath:~1,-1% neq agent echo ^<VirtualHost *:%serviceport:~1,-1%^>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0041 if %relpath:~1,-1% neq agent echo 	SSLProxyEngine On>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0042 if %relpath:~1,-1% neq agent echo 	SSLEngine On>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0043 if %relpath:~1,-1% neq agent echo 	SSLProtocol %sslprotocol%>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0044 if %relpath:~1,-1% neq agent echo 	ProxyPreserveHost On>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0045 if %relpath:~1,-1% neq agent echo 	ProxyRequests Off>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0046 if %relpath:~1,-1% neq agent echo 	SSLCertificateFile      ../cert/%phpexe:~1,-1%.crt>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0047 if %relpath:~1,-1% neq agent echo 	SSLCertificateKeyFile   ../cert/%phpexe:~1,-1%.key>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0048 if %relpath:~1,-1% neq agent echo 	^<Location /^>>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0049 if %relpath:~1,-1% neq agent if %phpexe:~9,-1% equ core echo 		ProxyPass http://127.0.0.1:%phpport:~1,-1%/ Timeout=180 KeepAlive=On>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0050 if %relpath:~1,-1% neq agent if %phpexe:~9,-1% equ executor echo 		ProxyPass http://127.0.0.1:%phpport:~1,-1%/ Timeout=2000 KeepAlive=On>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0051 if %relpath:~1,-1% neq agent if %phpexe:~9,-1% equ server echo 		ProxyPass http://127.0.0.1:%phpport:~1,-1%/ Timeout=35 KeepAlive=On>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0052 if %relpath:~1,-1% neq agent echo 		ProxyPassReverse http://127.0.0.1:%phpport:~1,-1%/>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0053 if %relpath:~1,-1% neq agent echo 		ProxyPreserveHost On>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0054 if %relpath:~1,-1% neq agent echo 		SSLRequireSSL>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0055 if %relpath:~1,-1% neq agent echo 	^</Location^>>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0056 if %relpath:~1,-1% neq agent echo ^</VirtualHost^>>>"%cd%\apache\conf\httpd_%phpexe:~1,-1%_virtual.conf"
0057 if %relpath:~1,-1% neq agent net.exe stop "%servicename_last:~1,-1%SSL"
0058 if %relpath:~1,-1% neq agent taskkill.exe /f /im "httpd_%phpexe:~1,-1%.exe" /t
0059 if %relpath:~1,-1% neq agent sc.exe delete "%servicename_last:~1,-1%SSL"
0060 if %relpath:~1,-1% neq agent reg.exe delete "HKLM\SYSTEM\CurrentControlSet\services\%servicename_last:~1,-1%SSL" /f
0061 if %relpath:~1,-1% neq agent netsh.exe firewall delete allowedprogram "%cd%\apache\bin\httpd_%phpexe:~1,-1%.exe" all
0062 if %relpath:~1,-1% neq agent netsh.exe advfirewall firewall delete rule name=httpd_%phpexe:~1,-1% dir=in
0063 if %relpath:~1,-1% neq agent sc.exe create "%servicename:~1,-1%SSL" start= "%servicestart:~1,-1%" binPath= "%cd%\euryscosrv.exe" obj= "%serviceuser:~1,-1%" DisplayName= "%servicedisplay:~1,-1% SSL"
0064 if %relpath:~1,-1% neq agent reg.exe add "HKLM\SYSTEM\CurrentControlSet\services\%servicename:~1,-1%SSL\Parameters" /v "Application" /t REG_SZ /d "\"%cd%\apache\bin\httpd_%phpexe:~1,-1%.exe\" -f \"%cd%\apache\conf\httpd_%phpexe:~1,-1%.conf\"" /f
0065 if %relpath:~1,-1% neq agent if %errorlevel% neq 0 cscript.exe "%cd%\euryscosrv.vbs" %servicename:~1,-1%SSL "@%cd%\apache\bin\httpd_%phpexe:~1,-1%.exe@ -f @%cd%\apache\conf\httpd_%phpexe:~1,-1%.conf@"
0066 if %relpath:~1,-1% neq agent if not exist "%cd%\apache\bin\httpd_%phpexe:~1,-1%.exe" if exist "%cd%\apache\bin\httpd.exe" copy "%cd%\apache\bin\httpd.exe" "%cd%\apache\bin\httpd_%phpexe:~1,-1%.exe" /y
0067 if %relpath:~1,-1% neq agent netsh.exe advfirewall firewall add rule name="httpd_%phpexe:~1,-1%" dir=in action=allow protocol=6 localport=%serviceport:~1,-1% program="%cd%\apache\bin\httpd_%phpexe:~1,-1%.exe" enable=yes
0068 if %relpath:~1,-1% neq agent if %errorlevel% neq 0 netsh.exe firewall add allowedprogram "%cd%\apache\bin\httpd_%phpexe:~1,-1%.exe" "httpd_%phpexe:~1,-1%" enable
0069 
0070 net.exe stop "%servicename_last:~1,-1%"
0071 taskkill.exe /f /im "php_%phpexe:~1,-1%.exe" /t
0072 if %relpath:~1,-1% equ agent taskkill.exe /f /im "eurysco.agent.status.check.exe" /im "eurysco.agent.exec.timeout.exe" /t
0073 sc.exe delete "%servicename_last:~1,-1%"
0074 reg.exe delete "HKLM\SYSTEM\CurrentControlSet\services\%servicename_last:~1,-1%" /f
0075 
0076 sc.exe create "%servicename:~1,-1%" start= "%servicestart:~1,-1%" binPath= "%cd%\euryscosrv.exe" obj= "%serviceuser:~1,-1%" DisplayName= "%servicedisplay:~1,-1%"
0077 if %relpath:~1,-1% neq agent reg.exe add "HKLM\SYSTEM\CurrentControlSet\services\%servicename:~1,-1%\Parameters" /v "Application" /t REG_SZ /d "\"%cd%\php\php_%phpexe:~1,-1%.exe\" -c \"%cd%\php\php.ini\" -t \"%cd%\%relpath:~1,-1%\" -S 127.0.0.1:%phpport:~1,-1%" /f
0078 if %relpath:~1,-1% neq agent if %errorlevel% neq 0 cscript.exe "%cd%\euryscosrv.vbs" %servicename:~1,-1% "@%cd%\php\php_%phpexe:~1,-1%.exe@ -c @%cd%\php\php.ini@ -t @%cd%\%relpath:~1,-1%@ -S 127.0.0.1:%phpport:~1,-1%"
0079 if %relpath:~1,-1% equ agent reg.exe add "HKLM\SYSTEM\CurrentControlSet\services\%servicename:~1,-1%\Parameters" /v "Application" /t REG_SZ /d "\"%cd%\php\php_%phpexe:~1,-1%.exe\" -c \"%cd%\php\php.ini\" \"%cd%\agent\conf\agent.init.php\"" /f
0080 if %relpath:~1,-1% equ agent if %errorlevel% neq 0 cscript.exe "%cd%\euryscosrv.vbs" %servicename:~1,-1% "@%cd%\php\php_%phpexe:~1,-1%.exe@ -c @%cd%\php\php.ini@ @%cd%\agent\conf\agent.init.php@"
0081 
0082 if %relpath:~1,-1% equ agent del "%cd%\agent\temp\agent.status" /f /q
0083 if %relpath:~1,-1% equ server copy "%cd%\euryscoServer.default" "%cd%\sqlite\euryscoServer" /y
0084 if %relpath:~1,-1% equ server if not exist "%cd%\sqlite\euryscoAudit" copy "%cd%\euryscoAudit.default" "%cd%\sqlite\euryscoAudit" /y
0085 
0086 if %relpath:~1,-1% equ agent type "%cd%\agent\agent.inittop">"%cd%\agent\conf\agent.init.php"
0087 if %relpath:~1,-1% equ agent echo session_save_path('%cd%\agent\temp'); session_start(); $_SESSION['agentpath'] = '%cd%\agent'; include($_SESSION['agentpath'] . '\\' . 'agent.php'); session_write_close();>>"%cd%\agent\conf\agent.init.php"
0088 if %relpath:~1,-1% equ agent type "%cd%\agent\agent.initbot">>"%cd%\agent\conf\agent.init.php"
0089 
0090 if not exist "%cd%\php\php.ini" if exist "%cd%\php.default_%osarc%%osold:~1,-1%" copy "%cd%\php.default_%osarc%%osold:~1,-1%" "%cd%\php\php.ini" /y
0091 type "%cd%\php\php.ini" | find /i "error_log = " | find /i "logs\php_errors.log"
0092 if %errorlevel% neq 0 echo error_log = "%cd%\php\logs\php_errors.log">>"%cd%\php\php.ini"
0093 type "%cd%\php\php.ini" | find /i "upload_tmp_dir = " | find /i "temp"
0094 if %errorlevel% neq 0 echo upload_tmp_dir = "%cd%\php\temp">>"%cd%\php\php.ini"
0095 if not exist "%cd%\php\php_%phpexe:~1,-1%.exe" if exist "%cd%\php\php.exe" copy "%cd%\php\php.exe" "%cd%\php\php_%phpexe:~1,-1%.exe" /y
0096 
0097 net.exe start "%servicename:~1,-1%"
0098 if %relpath:~1,-1% neq agent net.exe start "%servicename:~1,-1%SSL"