Initial script setup
This commit is contained in:
parent
e864836c31
commit
4b25effbc9
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -0,0 +1,40 @@
|
|||
set wShell = CreateObject("Wscript.Shell")
|
||||
set oArgs = WScript.Arguments
|
||||
|
||||
' strPw = Password( "Please enter your password:" )
|
||||
' WScript.Echo "Your password is: " & strPw
|
||||
|
||||
script = """" & oArgs.item(0) & """"
|
||||
|
||||
scriptArgs = ""
|
||||
For i = 1 to oArgs.Count - 1
|
||||
scriptArgs = scriptArgs & " """ & oArgs.item(i) & """"
|
||||
Next
|
||||
|
||||
wShell.Run script & " " & scriptArgs, 0, False
|
||||
|
||||
Function Password( myPrompt )
|
||||
' This function hides a password while it is being typed.
|
||||
' myPrompt is the text prompting the user to type a password.
|
||||
' The function clears the prompt and returns the typed password.
|
||||
' This code is based on Microsoft TechNet ScriptCenter "Mask Command Line Passwords"
|
||||
' http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true
|
||||
|
||||
' Standard housekeeping
|
||||
Dim objPassword
|
||||
|
||||
' Use ScriptPW.dll by creating an object
|
||||
' THIS IS ONLY AVAILABLE IN WinXP !!!
|
||||
Set objPassword = CreateObject( "ScriptPW.Password" )
|
||||
|
||||
' Display the prompt text
|
||||
WScript.StdOut.Write myPrompt
|
||||
|
||||
' Return the typed password
|
||||
Password = objPassword.GetPassword()
|
||||
|
||||
' Clear prompt
|
||||
WScript.StdOut.Write String( Len( myPrompt ), Chr( 8 ) ) _
|
||||
& Space( Len( myPrompt ) ) _
|
||||
& String( Len( myPrompt ), Chr( 8 ) )
|
||||
End Function
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,31 @@
|
|||
7-Zip Extra
|
||||
~~~~~~~~~~~
|
||||
License for use and distribution
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Copyright (C) 1999-2015 Igor Pavlov.
|
||||
|
||||
7-Zip Extra files are under the GNU LGPL license.
|
||||
|
||||
|
||||
Notes:
|
||||
You can use 7-Zip Extra on any computer, including a computer in a commercial
|
||||
organization. You don't need to register or pay for 7-Zip.
|
||||
|
||||
|
||||
GNU LGPL information
|
||||
--------------------
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You can receive a copy of the GNU Lesser General Public License from
|
||||
http://www.gnu.org/
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
@echo off
|
||||
|
||||
:: Get the password
|
||||
powershell -Command $pword = read-host "Enter password" -AsSecureString ; $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword) ; [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) > .tmp.txt & set /p passwd=<.tmp.txt & del .tmp.txt
|
||||
|
||||
wscript.exe hidden.vbs start.bat %passwd%
|
|
@ -0,0 +1,44 @@
|
|||
@echo off
|
||||
set ARCHIV="documents-sync.7z"
|
||||
:: [ 0 | 1 | 3 | 5 | 7 | 9 ]
|
||||
set COMPRESSION=0
|
||||
set SEVENEXE="libs\7-Zip\7za.exe"
|
||||
set PASSWD=%1
|
||||
set LOG_FILE="ownCloudPortable.log"
|
||||
|
||||
echo This is the ownCloudPortable starter script! > %LOG_FILE%
|
||||
|
||||
if exist %ARCHIV% (
|
||||
echo Extracting portable ownCloud client and data... >> %LOG_FILE%
|
||||
|
||||
%SEVENEXE% x %ARCHIV% -p%PASSWD% -y >> %LOG_FILE%
|
||||
|
||||
) else (
|
||||
echo Creating directory structure and downloading client... >> %LOG_FILE%
|
||||
|
||||
mkdir Documents >> %LOG_FILE%
|
||||
::xcopy libs\ownCloudPortable ownCloudPortable\ /E >> %LOG_FILE%
|
||||
%SEVENEXE% x libs\ownCloudPortable.7z -y >> %LOG_FILE%
|
||||
)
|
||||
|
||||
:: Check if the extraction worked (password verification)
|
||||
if not exist ownCloudPortable (
|
||||
echo Something went wrong! >> %LOG_FILE%
|
||||
goto exit
|
||||
)
|
||||
|
||||
echo Starting ownCloud client. >> %LOG_FILE%
|
||||
START /WAIT ownCloudPortable\ownCloudPortable.exe >> %LOG_FILE%
|
||||
|
||||
echo Encrypting ownCloud client and data... >> %LOG_FILE%
|
||||
:: Explanation:
|
||||
:: -mhe to encrypt headers so nobody can browse the archive
|
||||
:: -mx0 to not compress the archiv (only for performance)
|
||||
%SEVENEXE% u documents-sync.7z Documents -mx%COMPRESSION% -mhe -p%PASSWD% -y >> %LOG_FILE%
|
||||
%SEVENEXE% u documents-sync.7z ownCloudPortable -mx%COMPRESSION% -mhe -p%PASSWD% -y >> %LOG_FILE%
|
||||
|
||||
echo Securely removing data from this computer... >> %LOG_FILE%
|
||||
del /s /f /q ownCloudPortable & rd /s /q ownCloudPortable >> %LOG_FILE%
|
||||
del /s /f /q Documents & rd /s /q Documents >> %LOG_FILE%
|
||||
|
||||
:exit
|
Loading…
Reference in New Issue