created folder structure

This commit is contained in:
2022-09-13 11:37:49 -05:00
commit 251dbfb0eb
112 changed files with 16067 additions and 0 deletions

402
vbs/1ExportPermissions.vbs Normal file
View File

@@ -0,0 +1,402 @@
'FILENAME: ExportVirtualPermissions.vbs
'DATE: 1 JUL 2011
'PROGRAMMER: A. ACUNA
'USE: Use this to export all the permissions in a site.
'**** run cmd "cscript (script location) > (location of output txt document)****
'Create GlobalSCAPE object
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
Dim strHost, strLogin, strPassword, strTextFile, strSite, strPort
Dim oSFTPServer, oSites, oSite
CRLF = (Chr(13)& Chr(10))
'Comment this next line if you want to use arguments passed to the script
If (ProcessArgs=-1) then wscript.quit
'Un-comment if you want to hardcode the variable info
REM strHost = "192.168.102.143"
REM strPort = "1100"
REM strLogin = "test"
REM strPassword = "test"
REM strTextFile = "output.txt"
REM strSite = "MySite"
WScript.Echo "Runtime Parameters:" & vbCrLf & "-------------------" & vbCrLf & _
"strHost = " & strHost & vbCrLf & _
"strPort = " & strPort & vbCrLf & _
"Login = " & strLogin & vbCrLf & _
"Password= " & strPassword & vbCrLf & _
"strSite = " & strSite & vbCrLf & _
"strTextFile = " & strTextFile & vbCrLf
'Get File Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Create/overwrite log file
Set objLogFile = objFSO.CreateTextFile(strTextFile, True)
Call ConnectAndLogin()
Sub ConnectAndLogIn()
Dim WshShell
' Let's check to be sure we can connect to the specified EFT Server:
WScript.Echo "<CONNECTING TO SERVER>"
WScript.Echo Chr(9) & "Connecting to " & strLogin & "@" & strHost & ":1100 [Site " & strSite & "]"
Set oSFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
' NOTE we assume default ADMIN port of 1100 -- please chang this if you have
' manually configured your EFT to be different.
On Error Resume Next
oSFTPServer.Connect strHost, CLng(strPort), strLogin, strPassword
If Err.Number <> 0 Then
WScript.Echo Chr(9) & "Error connecting to '" & strHost & ":" & 1100 & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Echo Chr(9) & "Attempting to restart service..."
err.Clear
Set WshShell = WScript.CreateObject("WScript.Shell")
call WshShell.Run("net start ""eft server""", 1, true)
Set WshShell = nothing
WScript.Echo Chr(9) & "Waiting for 5 seconds for the service to initiate..."
WScript.Sleep 5000
WScript.Echo Chr(9) & "Connecting to " & strLogin & "@" & strHost & ":1100 [Site " & strSite & "]"
oSFTPServer.Connect strHost, CLng(strPort), strLogin, strPassword
If Err.Number <> 0 Then
WScript.Echo Chr(9) & "Error connecting to '" & strHost & ":" & 1100 & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quit 253
Else
WScript.Echo Chr(9) & "Connected to " & strHost
end if
End If
On Error GoTo 0 ' resume error trapping
set oSites=oSFTPServer.Sites
Dim iCount
For iCount=0 to oSites.count - 1
Set oSite = oSites.Item(iCount)
if LCase(Trim(oSite.Name)) = LCase(Trim(strSite)) then
exit for
End if
Next
WScript.Echo Chr(9) & "Connected to site '" & oSite.Name & "'" & vbCrLf
End Sub
'==============================================================================
'
' ProcessArgs
'
' Parse the command-line arguments. Results are set in global variables
' (strHost, strLogin, strPassword, strTextFile, strSite, strPort ).
'
'==============================================================================
public function ProcessArgs
Dim iCount
Dim oArgs
on error resume next
' Default our arguments. Some are required.
strHost = ""
strLogin = ""
strPassword = ""
strPort = "1100"
strSite = ""
strTextFile=""
' Get the command-line arguments
'
Set oArgs = WScript.Arguments
if oArgs.Count > 0 then
' We have command-line arguments. Loop through them.
iCount = 0
ProcessArgs = 0
do while iCount < oArgs.Count
select case oArgs.Item(iCount)
'
' Server name argument
'
case "-s"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strHost = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' What port to connect to for EFT server. Default to 1100
'
case "-port"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strPort = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' admin login name argument
'
case "-u"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strLogin = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' admin password argument
'
case "-p"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strPassword = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' Which site to look into. Defaults into 1.
'
case "-site"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strSite = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' CSVFile name argument
'
case "-f"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strTextFile = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' Help option
'
case "-?"
Syntax
ProcessArgs = -1
exit function
'
' Invalid argument
'
case else
' Display the syntax and return an error
wscript.echo "Unknown argument: " & oArgs.Item(iCount) & vbCrLf
Syntax
ProcessArgs = -1
Exit function
end select
loop
Else
'
' There were no command-line arguments, display the syntax
' and return an error.
'
Syntax
ProcessArgs = -1
End if
Set oArgs = Nothing
If ( strHost = "" OR strLogin = "" or strSite = "" or strPassword = "" or strTextFile = "" ) Then
Syntax
ProcessArgs = -1
End If
End function ' ProcessArgs
REM Start code here
g_strVFSBuffer= ""
'Retrieve all the paths that have permissions in the config and decorate the orphans with a *
arVFolders = oSite.GetPermPathsList("-do")
'Uncomment this next line to show the folder list for debug only
'objLogFile.WriteLine(arVFolders)
'Break down the return string by its delimiter CRLF
arVFolders = Split(arVFolders, CRLF)
For Each fl in arVFolders
sPath = fl
If Not IsOrphan(spath) Then
WScript.Echo "Getting permissions for path: " & fl
On Error Resume Next
'WScript.Echo "Calling GetFolderPerms "
pFolder = oSite.GetFolderPermissions(sPath)
'Check to see if there was an error getting the permissions. If so, we don't want to write this to path to file.
If Not Err.Number <> 0 Then
'WScript.Echo "Calling StorePermissions "
Call StorePermissions(pFolder,sPath)
Err.Number = 0
Else
WScript.Echo "Error when checking folder: " & fl
WScript.Echo "Error Description: " & Err.Number & ": " & Err.Description
End If
End If
Next
SFTPServer.Close
Set SFTPServer = nothing
'Function used to determine if the returned path is an orphan in the VFS.
Function IsOrphan(chkpath)
IsOrphan = False
If Right(chkpath,1) = "*" then
IsOrphan = True
End If
End Function
'User-defined IIf function to perform ternary operation i.e. expression? true_value : false_value
Function IIf(bCondition, sTrueValue, sFalseValue)
if bCondition Then
If IsObject(sTrueValue) Then
Set IIf = sTrueValue
Else
IIf = sTrueValue
End If
Else
If IsObject(sFalseValue) Then
Set IIf = sFalseValue
Else
IIf = sFalseValue
End If
End If
End Function
Function StripVirtualPortion(ByVal sPath)
Dim iPos , sVirtualFolderPath,bIsVirtual
iPos = InStr(1, sPath, " - Virtual", 1 )
If ( iPos > 0 ) Then
WScript.Echo "-->Stripping VIRTUAL portion of folder name"
sVirtualFolderPath = sPath
sPath = Left( sPath, iPos -1 ) & "/"
End If
StripVirtualPortion = sPath
End Function
function StorePermissions(arPerms, strFullFolderPath)
Dim iCount, oPermission
sPath = StripVirtualPortion(strFullFolderPath)
If sPath = "" Or Right(sPath, 1) <> "/" Then
sPath = sPath & "/"
End If
'WScript.Echo "Begin StorePerimssions: Exporting data for folder " & strFullFolderPath
'WScript.Echo "Looping through permissions..."
For iCount = LBound(arPerms) To UBound(arPerms)
Set oPermission = arPerms (iCount)
'WScript.Echo "DEBUG: Checking path... " & sPath
'WScript.Echo "DEBUG: Value of oPermission.InheritedFrom = " & oPermission.InheritedFrom
'If the current folder is the root folder Or
'If the folder path length matches that of the "inherited from" path
'(means that personal permissions are set on the folder for this group and inherit status is not set)
If (sPath = "/" Or (Len(sPath) = Len(oPermission.InheritedFrom))) then
'WScript.Echo "DEBUG: First If has been matched "
'Append permissions group name
g_sOutPut = g_sOutPut & strFullFolderPath & ","
g_sOutPut = g_sOutPut & oPermission.Client & ","
'Append folder permissions
g_sOutPut = g_sOutPut & IIf(oPermission.FileUpload, "U", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.FileDownload, "D", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.FileAppend, "A", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.FileDelete, "D", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.FileRename, "R", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.DirShowinList, "S", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.DirCreate, "C", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.DirDelete, "D", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.DirList, "L", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.DirShowHidden, "H", "-")
g_sOutPut = g_sOutPut & IIf(oPermission.DirShowReadOnly,"O", "-")
g_sOutPut = g_sOutPut & ","
'Append "Inherited from" foldername
g_sOutPut = g_sOutPut & IIf(oPermission.Folder = "", "/", oPermission.Folder)
WScript.Echo g_sOutPut
g_strVFSBuffer = g_strVFSBuffer & g_sOutPut
objLogFile.WriteLine(g_strVFSBuffer)
g_strVFSBuffer = ""
g_sOutPut = ""
Else
'In case of virtual folder with inheritance set to true, then
'the above logic fails to make an entry into the back up permissions file
'so handle the virtual folder case here
'WScript.Echo "Else has been matched "
'If the folder is a virtual folder and if the folder entry is not found in the global buffer
If InStr(1,strFullFolderPath, "- Virtual", 1 ) > 0 And InStr (1, g_strVFSBuffer, strFullFolderPath, 1) = 0 Then
WScript.Echo "Found a virtual folder " + strFullFolderPath + " with inherited group permission. Adding a blank entry"
g_strVFSBuffer = g_strVFSBuffer & strFullFolderPath &",,,"
objLogFile.WriteLine(g_strVFSBuffer)
g_strVFSBuffer = ""
End If
End If
Next
end function
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function
'==============================================================================
' Syntax
' Show the command-line syntax
'==============================================================================
public function Syntax
wscript.echo vbCrLf & _
"Purpose: Export VFS tree permissions to a text file " & vbCrLf & _
"Usage: " & wscript.scriptname & " <arguments>" & vbCrLf & _
"Required Arguments:" & vbCrLf & _
" -s EFT Server" & vbCrLf & _
" -u Admin username for EFT Server" & vbCrLf & _
" -p Admin password" & vbCrLf & _
" -site Site name on the server we are manipulating. Defaults to first site" & vbCrLf & _
" -f Path of text file to retrieve data " & vbCrLf & _
vbCrLf & _
"Optional Arguments: " & vbCrLf & _
" -? This help" & vbCrLf & _
" -port Admin port on EFT server. Defaults to 1100" & vbCrLf & _
"Example: " & wscript.scriptname & " -s localhost -port 1100 -u admin -p secret -site SiteName -f c:\migrate.txt"
end function ' Syntax

View File

@@ -0,0 +1,282 @@
'FILENAME: Export Virtual Folders.vbs
'DATE: 19 April 2011
'PROGRAMMER: A. ACUNA
'USE: Use this to export all the virtual folders in a site.
'**** run cmd "cscript (script location) > (location of output txt document)****
'Get File Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim strHost, strLogin, strPassword, strTextFile, strSite, strPort
Dim oSFTPServer, oSites, oSite
'Create GlobalSCAPE object
Set oSFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
'Comment this next line if you want to use arguments passed to the script
If (ProcessArgs=-1) then wscript.quit
'Un-comment if you want to hardcode the variable info
REM strHost = "192.168.102.143"
REM strPort = "1100"
REM strLogin = "test"
REM strPassword = "test"
REM strTextFile = "output.txt"
REM strSite = "MySite"
WScript.Echo "Runtime Parameters:" & vbCrLf & "-------------------" & vbCrLf & _
"strHost = " & strHost & vbCrLf & _
"strPort = " & strPort & vbCrLf & _
"Login = " & strLogin & vbCrLf & _
"Password= " & strPassword & vbCrLf & _
"strSite = " & strSite & vbCrLf & _
"strTextFile = " & strTextFile & vbCrLf
'Get File Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Create/overwrite log file
Set objLogFile = objFSO.CreateTextFile(strTextFile, True)
Call ConnectAndLogin()
Call ExportFolders()
oSFTPServer.Close
Set oSFTPServer = nothing
Public function ExportFolders
g_strVFSBuffer= ""
arVFolders = oSite.GetVirtualFolderList("/")
'objLogFile.WriteLine(arVFolders)
arVFolders = Split(arVFolders, CRLF)
For Each fl in arVFolders
if Not fl = "" then
WScript.Echo "INFO: Exporting info for folder: " & fl
physPath = oSite.GetPhysicalPath(fl)
objLogFile.WriteLine(fl & "," & physPath)
End if
Next
End function
'==============================================================================
'
' ProcessArgs
'
' Parse the command-line arguments. Results are set in global variables
' (strHost, strLogin, strPassword, strTextFile, strSite, strPort ).
'
'==============================================================================
public function ProcessArgs
Dim iCount
Dim oArgs
on error resume next
' Default our arguments. Some are required.
strHost = ""
strLogin = ""
strPassword = ""
strPort = "1100"
strSite = ""
strTextFile=""
' Get the command-line arguments
'
Set oArgs = WScript.Arguments
if oArgs.Count > 0 then
' We have command-line arguments. Loop through them.
iCount = 0
ProcessArgs = 0
do while iCount < oArgs.Count
select case oArgs.Item(iCount)
'
' Server name argument
'
case "-s"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strHost = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' What port to connect to for EFT server. Default to 1100
'
case "-port"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strPort = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' admin login name argument
'
case "-u"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strLogin = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' admin password argument
'
case "-p"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strPassword = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' Which site to look into. Defaults into 1.
'
case "-site"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strSite = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' CSVFile name argument
'
case "-f"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strTextFile = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' Help option
'
case "-?"
Syntax
ProcessArgs = -1
exit function
'
' Invalid argument
'
case else
' Display the syntax and return an error
wscript.echo "### ERROR: UNKNOWN ARGUMENT " & oArgs.Item(iCount) & vbCrLf
Syntax
ProcessArgs = -1
Exit function
end select
loop
Else
'
' There were no command-line arguments, display the syntax
' and return an error.
'
Syntax
ProcessArgs = -1
End if
Set oArgs = Nothing
If ( strHost = "" OR strLogin = "" or strSite = "" or strPassword = "" or strTextFile = "" ) Then
WScript.Echo "### ERROR : MISSING PARAMETERS" & vbCrLf & "-------------------" & vbCrLf & _
"strHost = " & strHost & vbCrLf & _
"strPort = " & strPort & vbCrLf & _
"Login = " & strLogin & vbCrLf & _
"Password= " & strPassword & vbCrLf & _
"strSite = " & strSite & vbCrLf & _
"strTextFile = " & strTextFile & vbCrLf
Syntax
ProcessArgs = -1
End If
End function ' ProcessArgs
'==============================================================================
' Syntax
' Show the command-line syntax
'==============================================================================
public function Syntax
wscript.echo "Purpose: Export Virtual Folders to a text file " & vbCrLf & _
"Usage: " & wscript.scriptname & " <arguments>" & vbCrLf & _
"Required Arguments:" & vbCrLf & _
" -s EFT Server" & vbCrLf & _
" -u Admin username for EFT Server" & vbCrLf & _
" -p Admin password" & vbCrLf & _
" -site Site name on the server we are manipulating. Defaults to first site" & vbCrLf & _
" -f Path of text file to retrieve data " & vbCrLf & _
vbCrLf & _
"Optional Arguments: " & vbCrLf & _
" -? This help" & vbCrLf & _
" -port Admin port on EFT server. Defaults to 1100" & vbCrLf & _
"Example: " & wscript.scriptname & " -s localhost -port 1100 -u admin -p secret -site SiteName -f c:\migrate.txt"
end function ' Syntax
'==============================================================================
' This method connectst to the specified EFT server and attempts to
' log in using the supplied information.
'==============================================================================
Sub ConnectAndLogIn()
Dim WshShell
' Let's check to be sure we can connect to the specified EFT Server:
WScript.Echo "<CONNECTING TO SERVER>"
WScript.Echo Chr(9) & "Connecting to " & strLogin & "@" & strHost & ":1100 [Site " & strSite & "]"
Set oSFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
' NOTE we assume default ADMIN port of 1100 -- please chang this if you have
' manually configured your EFT to be different.
On Error Resume Next
oSFTPServer.Connect strHost, CLng(strPort), strLogin, strPassword
If Err.Number <> 0 Then
WScript.Echo Chr(9) & "Error connecting to '" & strHost & ":" & 1100 & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Echo Chr(9) & "Attempting to restart service..."
err.Clear
Set WshShell = WScript.CreateObject("WScript.Shell")
call WshShell.Run("net start ""eft server""", 1, true)
Set WshShell = nothing
WScript.Echo Chr(9) & "Waiting for 5 seconds for the service to initiate..."
WScript.Sleep 5000
WScript.Echo Chr(9) & "Connecting to " & strLogin & "@" & strHost & ":1100 [Site " & strSite & "]"
oSFTPServer.Connect strHost, CLng(strPort), strLogin, strPassword
If Err.Number <> 0 Then
WScript.Echo Chr(9) & "Error connecting to '" & strHost & ":" & 1100 & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quit 253
Else
WScript.Echo Chr(9) & "Connected to " & strHost
end if
End If
On Error GoTo 0 ' resume error trapping
set oSites=oSFTPServer.Sites
Dim iCount
For iCount=0 to oSites.count - 1
Set oSite = oSites.Item(iCount)
if LCase(Trim(oSite.Name)) = LCase(Trim(strSite)) then
exit for
End if
Next
WScript.Echo Chr(9) & "Connected to site '" & oSite.Name & "'" & vbCrLf
End Sub 'End ConnectAndLogin

View File

@@ -0,0 +1,318 @@
'FILENAME: Import Virtual Folders.vbs
'DATE: 19 April 2011
'PROGRAMMER: A. ACUNA
'USE: Use this to export all the virtual folders in a site.
'**** run cmd "cscript (script location) > (location of output txt document)****
Dim g_arrFileLines()
Dim strHost, strLogin, strPassword, strTextFile, strSite, strPort
Dim oSFTPServer, oSites, oSite
'Create GlobalSCAPE object
Set oSFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
'Comment this next line if you want to use arguments passed to the script
If (ProcessArgs=-1) then wscript.quit
'Un-comment if you want to hardcode the variable info
REM strHost = "192.168.102.143"
REM strPort = "1100"
REM strLogin = "test"
REM strPassword = "test"
REM strTextFile = "output.txt"
REM strSite = "MySite"
WScript.Echo "Runtime Parameters:" & vbCrLf & "-------------------" & vbCrLf & _
"strHost = " & strHost & vbCrLf & _
"strPort = " & strPort & vbCrLf & _
"Login = " & strLogin & vbCrLf & _
"Password= " & strPassword & vbCrLf & _
"strSite = " & strSite & vbCrLf & _
"strTextFile = " & strTextFile & vbCrLf
'Get File Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Call ConnectAndLogin()
Call ReadVFSData()
Call ImportVFSData()
oSFTPServer.Close
Set oSFTPServer = nothing
Sub ImportVFSData()
Dim i,j,iPos,arLine
'WScript.Echo "DEBUG: ImportVFSData i = " & i
'WScript.Echo "DEBUG: notes on i = " & UBound(g_arrFileLines)
For i = Lbound(g_arrFileLines) to UBound(g_arrFileLines)
'WScript.Echo "DEBUG: ImportVFSData i = " & i
'WScript.Echo "DEBUG: g_arrFileLines i = " & g_arrFileLines(i)
arLine = Split(g_arrFileLines(i),",")
strVirtualP = arLine(0)
strPhysicalP = arLine(1)
WScript.Echo "Creating Virtual Folder: " & strVirtualP
WScript.Echo "Using Path: " & strPhysicalP
On Error Resume Next
Err.Clear
Call oSite.CreateVirtualFolder(strVirtualP, strPhysicalP)
If Err.Number<>0 then
If InStr(1,Err.Description,"MX Error: 27",1) > 0 Then
oSite.RemoveFolder(strVirtualP)
Call oSite.CreateVirtualFolder(strVirtualP, strPhysicalP)
Else
WScript.Echo "-*-ERROR: " & Err.Description
WScript.Echo "-*-ERROR: Failed to create Virtual folder: " & strVirtualP
WScript.Echo "Check virtual and physical folder." & Err.Description
End if
End if
Next
'.Echo "DEBUG: ImportVFSData Final i = " & i
End Sub
'==============================================================================
'
' ReadVFSData
'
' Read the data from the text file and create an
'
'==============================================================================
Sub ReadVFSData()
Dim i: i = 0
'WScript.Echo "DEBUG: readVFSData i =" & i
Dim oFSO, oFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile( strTextFile, 1 )
Do Until oFile.AtEndOfStream
Redim Preserve g_arrFileLines(i)
'WScript.Echo "DEBUG: readVFSData i =" & i
g_arrFileLines(i) = oFile.ReadLine
'WScript.Echo "DEBUG: g_arrFileLines i =" & g_arrFileLines(i)
i = i + 1
Loop
'WScript.Echo "DEBUG: readVFSData i =" & i
oFile.Close
End Sub
'==============================================================================
'
' ProcessArgs
'
' Parse the command-line arguments. Results are set in global variables
' (strHost, strLogin, strPassword, strTextFile, strSite, strPort ).
'
'==============================================================================
public function ProcessArgs
Dim iCount
Dim oArgs
on error resume next
' Default our arguments. Some are required.
strHost = ""
strLogin = ""
strPassword = ""
strPort = "1100"
strSite = ""
strTextFile=""
' Get the command-line arguments
'
Set oArgs = WScript.Arguments
if oArgs.Count > 0 then
' We have command-line arguments. Loop through them.
iCount = 0
ProcessArgs = 0
do while iCount < oArgs.Count
select case oArgs.Item(iCount)
'
' Server name argument
'
case "-s"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strHost = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' What port to connect to for EFT server. Default to 1100
'
case "-port"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strPort = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' admin login name argument
'
case "-u"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strLogin = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' admin password argument
'
case "-p"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strPassword = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' Which site to look into. Defaults into 1.
'
case "-site"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strSite = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' CSVFile name argument
'
case "-f"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strTextFile = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' Help option
'
case "-?"
Syntax
ProcessArgs = -1
exit function
'
' Invalid argument
'
case else
' Display the syntax and return an error
wscript.echo "### ERROR: UNKNOWN ARGUMENT " & oArgs.Item(iCount) & vbCrLf
Syntax
ProcessArgs = -1
Exit function
end select
loop
Else
'
' There were no command-line arguments, display the syntax
' and return an error.
'
Syntax
ProcessArgs = -1
End if
Set oArgs = Nothing
If ( strHost = "" OR strLogin = "" or strSite = "" or strPassword = "" or strTextFile = "" ) Then
WScript.Echo "### ERROR : MISSING PARAMETERS" & vbCrLf & "-------------------" & vbCrLf & _
"strHost = " & strHost & vbCrLf & _
"strPort = " & strPort & vbCrLf & _
"Login = " & strLogin & vbCrLf & _
"Password= " & strPassword & vbCrLf & _
"strSite = " & strSite & vbCrLf & _
"strTextFile = " & strTextFile & vbCrLf
Syntax
ProcessArgs = -1
End If
End function ' ProcessArgs
'==============================================================================
' Syntax
' Show the command-line syntax
'==============================================================================
public function Syntax
wscript.echo "Purpose: Import Virtual Folders from a text file." & vbCrLf & _
"Usage: " & wscript.scriptname & " <arguments>" & vbCrLf & _
"Required Arguments:" & vbCrLf & _
" -s EFT Server" & vbCrLf & _
" -u Admin username for EFT Server" & vbCrLf & _
" -p Admin password" & vbCrLf & _
" -site Site name on the server we are manipulating. Defaults to first site" & vbCrLf & _
" -f Path of text file to retrieve data " & vbCrLf & _
vbCrLf & _
"Optional Arguments: " & vbCrLf & _
" -? This help" & vbCrLf & _
" -port Admin port on EFT server. Defaults to 1100" & vbCrLf & _
"Example: " & wscript.scriptname & " -s localhost -port 1100 -u admin -p secret -site SiteName -f c:\migrate.txt"
end function ' Syntax
'==============================================================================
' This method connectst to the specified EFT server and attempts to
' log in using the supplied information.
'==============================================================================
Sub ConnectAndLogIn()
Dim WshShell
' Let's check to be sure we can connect to the specified EFT Server:
WScript.Echo "<CONNECTING TO SERVER>"
WScript.Echo Chr(9) & "Connecting to " & strLogin & "@" & strHost & ":1100 [Site " & strSite & "]"
Set oSFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
' NOTE we assume default ADMIN port of 1100 -- please chang this if you have
' manually configured your EFT to be different.
On Error Resume Next
oSFTPServer.Connect strHost, CLng(strPort), strLogin, strPassword
If Err.Number <> 0 Then
WScript.Echo Chr(9) & "Error connecting to '" & strHost & ":" & 1100 & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Echo Chr(9) & "Attempting to restart service..."
err.Clear
Set WshShell = WScript.CreateObject("WScript.Shell")
call WshShell.Run("net start ""eft server""", 1, true)
Set WshShell = nothing
WScript.Echo Chr(9) & "Waiting for 5 seconds for the service to initiate..."
WScript.Sleep 5000
WScript.Echo Chr(9) & "Connecting to " & strLogin & "@" & strHost & ":1100 [Site " & strSite & "]"
oSFTPServer.Connect strHost, CLng(strPort), strLogin, strPassword
If Err.Number <> 0 Then
WScript.Echo Chr(9) & "Error connecting to '" & strHost & ":" & 1100 & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quit 253
Else
WScript.Echo Chr(9) & "Connected to " & strHost
end if
End If
On Error GoTo 0 ' resume error trapping
set oSites=oSFTPServer.Sites
Dim iCount
For iCount=0 to oSites.count - 1
Set oSite = oSites.Item(iCount)
if LCase(Trim(oSite.Name)) = LCase(Trim(strSite)) then
exit for
End if
Next
WScript.Echo Chr(9) & "Connected to site '" & oSite.Name & "'" & vbCrLf
End Sub 'End ConnectAndLogin

543
vbs/4ImportPermissions.vbs Normal file
View File

@@ -0,0 +1,543 @@
'
' FILE: EFTImport.vbs
' CREATED: 10 JAN 2008 GTH/ PPK
' MODIFIED: 7 JUL 2011 ALA
' PURPOSE: To import EFT VFS permissions from text file
Option Explicit
Dim oArgs
Dim strHost, strLogin, strPassword, strTextFile, strSite, strPort
Dim oSFTPServer, oSites, oSite, oPerm
Dim aSiteGroups, aSiteUsers, strGroupList, strUserList, strUsersAndGroups
Dim g_arrFileLines()
Class CPermission
Private m_sPermissionGroup
Private m_sPermissionString
Private m_sInheritedFrom
'File permissions
Private m_sFileUpload
Private m_sFileDownload
Private m_sFileAppend
Private m_sFileDelete
Private m_sFileRename
Private m_sDirList
'Folder permissions
Private m_sDirShowInList
Private m_sDirCreate
Private m_sDirDelete
'Contents
Private m_sDirShowReadOnly
Private m_sDirShowHidden
Public Property Get PermissionGroup()
PermissionGroup = m_sPermissionGroup
End Property
Public Property Let PermissionGroup(value)
m_sPermissionGroup = value
End Property
Public Property Get PermissionString()
PermissionString = m_sPermissionString
End Property
Public Property Let PermissionString(value)
m_sPermissionString = value
End Property
Public Property Get InheritedFrom()
InheritedFrom = m_sInheritedFrom
End Property
Public Property Let InheritedFrom(value)
m_sInheritedFrom = value
End Property
'File permissions
Public Property Get FileUpload()
FileUpload = m_sFileUpload
End Property
Public Property Let FileUpload(value)
m_sFileUpload = value
End Property
Public Property Get FileDownload()
FileDownload = m_sFileDownload
End Property
Public Property Let FileDownload(value)
m_sFileDownload=value
End Property
Public Property Get FileAppend()
FileAppend = m_sFileAppend
End Property
Public Property Let FileAppend(value)
m_sFileAppend=value
End Property
Public Property Get FileRename()
FileRename = m_sFileRename
End Property
Public Property Let FileRename(value)
m_sFileRename=value
End Property
Public Property Get DirList()
DirList = m_sDirList
End Property
Public Property Let DirList(value)
m_sDirList=value
End Property
Public Property Get FileDelete()
FileDelete = m_sFileDelete
End Property
Public Property Let FileDelete(value)
m_sFileDelete=value
End Property
'Folder permissions
Public Property Get DirShowinList()
DirShowinList = m_sDirShowinList
End Property
Public Property Let DirShowinList(value)
m_sDirShowinList=value
End Property
Public Property Get DirCreate()
DirCreate = m_sDirCreate
End Property
Public Property Let DirCreate(value)
m_sDirCreate=value
End Property
Public Property Get DirDelete()
DirDelete = m_sDirDelete
End Property
Public Property Let DirDelete(value)
m_sDirDelete=value
End Property
'Content permissions
Public Property Get DirShowHidden()
DirShowHidden = m_sDirShowHidden
End Property
Public Property Let DirShowHidden(value)
m_sDirShowHidden=value
End Property
Public Property Get DirShowReadonly()
DirShowReadonly = m_sDirShowReadonly
End Property
Public Property Let DirShowReadonly(value)
m_sDirShowReadonly=value
End Property
End Class
'==============================================================================
'
' Main
'
'==============================================================================
'Comment this next line if you want to use arguments passed to the script
If (ProcessArgs=-1) then wscript.quit
'Un-comment if you want to hardcode the variable info
REM strHost = "localhost"
REM strLogin = "test"
REM strPassword= "test"
REM strTextFile = "output.txt"
REM strSite= "MySite"
REM strPort="1100"
WScript.Echo "Runtime Parameters:" & vbCrLf & "-------------------" & vbCrLf & _
"strHost = " & strHost & vbCrLf & _
"strPort = " & strPort & vbCrLf & _
"Login = " & strLogin & vbCrLf & _
"Password= " & strPassword & vbCrLf & _
"strSite = " & strSite & vbCrLf & _
"strTextFile = " & strTextFile & vbCrLf
Call ConnectAndLogin()
Call ReadVFSData()
Call RetrieveUsersAndGroups()
Call ImportVFSData()
'==============================================================================
' This method connectst to the specified EFT server and attempts to
' log in using the supplied information.
'==============================================================================
Sub ConnectAndLogIn()
Dim WshShell
' Let's check to be sure we can connect to the specified EFT Server:
WScript.Echo "<CONNECTING TO SERVER>"
WScript.Echo Chr(9) & "Connecting to " & strLogin & "@" & strHost & ":1100 [Site " & strSite & "]"
Set oSFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
' NOTE we assume default ADMIN port of 1100 -- please chang this if you have
' manually configured your EFT to be different.
On Error Resume Next
oSFTPServer.Connect strHost, CLng(strPort), strLogin, strPassword
If Err.Number <> 0 Then
WScript.Echo Chr(9) & "Error connecting to '" & strHost & ":" & 1100 & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Echo Chr(9) & "Attempting to restart service..."
err.Clear
Set WshShell = WScript.CreateObject("WScript.Shell")
call WshShell.Run("net start ""globalscape eft server""", 1, true)
Set WshShell = nothing
WScript.Echo Chr(9) & "Waiting for 5 seconds for the service to initiate..."
WScript.Sleep 5000
WScript.Echo Chr(9) & "Connecting to " & strLogin & "@" & strHost & ":1100 [Site " & strSite & "]"
oSFTPServer.Connect strHost, CLng(strPort), strLogin, strPassword
If Err.Number <> 0 Then
WScript.Echo Chr(9) & "Error connecting to '" & strHost & ":" & 1100 & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quit 253
Else
WScript.Echo Chr(9) & "Connected to " & strHost
end if
End If
On Error GoTo 0 ' resume error trapping
set oSites=oSFTPServer.Sites
Dim iCount
For iCount=0 to oSites.count - 1
Set oSite = oSites.Item(iCount)
if LCase(Trim(oSite.Name)) = LCase(Trim(strSite)) then
exit for
End if
Next
WScript.Echo Chr(9) & "Connected to site '" & oSite.Name & "'" & vbCrLf
End Sub
'==============================================================================
'
' ProcessArgs
'
' Parse the command-line arguments. Results are set in global variables
' (strHost, strLogin, strPassword, strTextFile, strSite, strPort ).
'
'==============================================================================
public function ProcessArgs
Dim iCount
Dim oArgs
on error resume next
' Default our arguments. Some are required.
strHost = ""
strLogin = ""
strPassword = ""
strPort = "1100"
strSite = ""
strTextFile=""
' Get the command-line arguments
'
Set oArgs = WScript.Arguments
if oArgs.Count > 0 then
' We have command-line arguments. Loop through them.
iCount = 0
ProcessArgs = 0
do while iCount < oArgs.Count
select case oArgs.Item(iCount)
'
' Server name argument
'
case "-s"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strHost = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' What port to connect to for EFT server. Default to 1100
'
case "-port"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strPort = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' admin login name argument
'
case "-u"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strLogin = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' admin password argument
'
case "-p"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strPassword = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' Which site to look into. Defaults into 1.
'
case "-site"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strSite = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' CSVFile name argument
'
case "-f"
if( iCount + 1 >= oArgs.Count ) then
Syntax
ProcessArgs = -1
exit do
end if
strTextFile = oArgs.Item(iCount+1)
iCount = iCount + 2
'
' Help option
'
case "-?"
Syntax
ProcessArgs = -1
exit function
'
' Invalid argument
'
case else
' Display the syntax and return an error
wscript.echo "### ERROR: UNKNOWN ARGUMENT " & oArgs.Item(iCount) & vbCrLf
Syntax
ProcessArgs = -1
Exit function
end select
loop
Else
'
' There were no command-line arguments, display the syntax
' and return an error.
'
Syntax
ProcessArgs = -1
End if
Set oArgs = Nothing
If ( strHost = "" OR strLogin = "" or strSite = "" or strPassword = "" or strTextFile = "" ) Then
WScript.Echo "### ERROR : MISSING PARAMETERS" & vbCrLf & "-------------------" & vbCrLf & _
"strHost = " & strHost & vbCrLf & _
"strPort = " & strPort & vbCrLf & _
"Login = " & strLogin & vbCrLf & _
"Password= " & strPassword & vbCrLf & _
"strSite = " & strSite & vbCrLf & _
"strTextFile = " & strTextFile & vbCrLf
Syntax
ProcessArgs = -1
End If
End function ' ProcessArgs
'Parse the permission string, e.g. UDADRSCDLHO etc., and create an object of CPermission class.
'This is to make the easier handling of permissions.
Public Function ParsePermissionString(sPermissionGroup, sPermissionString, sInheritedFrom)
Set oPerm = New CPermission
oPerm.PermissionGroup = sPermissionGroup
oPerm.InheritedFrom = sInheritedFrom
oPerm.PermissionString = UCase(Trim(sPermissionString))
sPermissionString = UCase(Trim(sPermissionString))
'File Permissions
oPerm.FileUpload = IIf( Mid(sPermissionString,1,1) = "U", True, False) 'File Upload
oPerm.FileDownload = IIf( Mid(sPermissionString,2,1) = "D", True, False) 'File Download
oPerm.FileAppend = IIf( Mid(sPermissionString,3,1) = "A", True, False) 'File Append
oPerm.FileDelete = IIf( Mid(sPermissionString,4,1) = "D", True, False) 'File Delete
oPerm.FileRename = IIf( Mid(sPermissionString,5,1) = "R", True, False) 'File Rename
oPerm.DirShowinList = IIf( Mid(sPermissionString,6,1) = "S", True, False) 'Dir Show in list
oPerm.DirCreate = IIf( Mid(sPermissionString,7,1) = "C", True, False) 'Dir Create
oPerm.DirDelete = IIf( Mid(sPermissionString,8,1) = "D", True, False) 'Dir Delete
oPerm.DirList = IIf( Mid(sPermissionString,9,1) = "L", True, False) 'File List
oPerm.DirShowHidden = IIf( Mid(sPermissionString,10,1)= "H", True, False) 'content Show hidden
oPerm.DirShowReadOnly = IIf( Mid(sPermissionString,11,1)= "O", True, False) 'Cotent Show Readonly
'Return the CPermission object
Set ParsePermissionString=oPerm
End Function
'Updates the folder permission using SFTPCOMInterface's "SetPermissions" method
Function UpdateFolderPermissions(oPerm, sFolderName)
On Error resume next
Dim oFolderPerm
'Getting permissions for the folder and also verifying that it can get the Group object
Set oFolderPerm = oSite.GetBlankPermission(sFolderName, oPerm.PermissionGroup)
if oFolderPerm then
oFolderPerm.FileUpload = oPerm.FileUpload
oFolderPerm.FileDownload = oPerm.FileDownload
oFolderPerm.FileDelete = oPerm.FileDelete
oFolderPerm.FileRename = oPerm.FileRename
oFolderPerm.FileAppend = oPerm.FileAppend
oFolderPerm.DirCreate = oPerm.DirCreate
oFolderPerm.DirDelete = oPerm.DirDelete
oFolderPerm.DirList = oPerm.DirList
oFolderPerm.DirShowInList = oPerm.DirShowInList
oFolderPerm.DirShowHidden = oPerm.DirShowHidden
oFolderPerm.DirShowReadOnly = oPerm.DirShowReadOnly
Call oSite.SetPermission(oFolderPerm, false)
oSFTPServer.ApplyChanges
UpdateFolderPermissions = true
else
Wscript.Echo "ERROR: Permissions import failed for folder: " & sFolderName & "."
Wscript.Echo "ERROR: Verify that folder and group '" & oPerm.PermissionGroup & "' exists in new site."
end if
Set oPerm = Nothing
End Function
'Obtain list of permission groups and create single string for validating later (ala: 7/7/2011)
Sub RetrieveUsersAndGroups()
Dim SiteGrp
Dim SiteUser
aSiteGroups = oSite.GetPermissionGroups
aSiteUsers = oSite.GetUsers()
strGroupList = ""
strUserList = ""
For Each SiteGrp in aSiteGroups
strGroupList = strGroupList & SiteGrp & vbCrLf
Next
For Each SiteUser in aSiteUsers
strUserList = strUserList & SiteUser & vbCrLf
Next
strUsersAndGroups = strGroupList & strUserList
'WScript.Echo "DEBUG: strUsersAndGroups = " & strUsersAndGroups
End Sub
Sub ImportVFSData()
Dim i,j,iPos,arLine,iPosg
Dim strFolder,strGroupName,strPermissions,strInheritFromFolder, strVirtulPath, strRealPath
WScript.Echo "INFO: Importing VFS data started ...."& VBcrlf
For i = Lbound(g_arrFileLines) to UBound(g_arrFileLines)-1
arLine = Split(g_arrFileLines(i),",")
strFolder = arLine(0)
'WScript.Echo "DEBUG: strFolder = " & strFolder
strGroupName = arLine(1)
'WScript.Echo "DEBUG: strGroupName = " & strGroupName
strPermissions = arLine(2)
'WScript.Echo "DEBUG: strPermissions = " & strPermissions
strInheritFromFolder = arLine(3)
'WScript.Echo "DEBUG: strInheritFromFolder = " & strInheritFromFolder
'Verify that the group is valid (ala: 7/7/2011)
iPosg = InStr(1, strUsersAndGroups, strGroupName, 1)
'WScript.Echo "DEBUG: iPosg = " & iPosg
If ( iPosg > 0) Then
iPosg = 0
'fixed echo string. folder and group are now enumerated.
WScript.Echo "INFO: Importing VFS data for folder '" & strFolder & "' for Group '" & strGroupName & "'"
iPos = InStr(1, strFolder, " - Virtual", 1 )
If ( iPos > 0 ) Then
WScript.Echo "INFO: -->Stripping VIRTUAL portion of folder name" & strFolder
strVirtulPath = Left( strFolder, iPos -1 ) & "/"
iPos = InStr(1, strFolder, "(", 1 )
if( iPos > 0 ) Then
strRealPath = Mid(strFolder,iPos+1, len(strFolder)- (iPos + 2))
'Now we have virtual name and real path ..Try to create virtual folder on site
'If it fails, just move on to the next step which is setting permissions. We're assuming it's failing because the virtual folder already exists.
On Error Resume Next
call oSite.CreateVirtualFolder(strVirtulPath, strRealPath)
end if
strFolder = strVirtulPath 'assign correct folder name to update permissions
End If
if(strGroupName <> "") Then ' if no permission, means we are working with virtual folder which has inherited permissions, so we only need to create the folder.
Call ParsePermissionString(strGroupName,strPermissions,strInheritFromFolder)
Call UpdateFolderPermissions(oPerm,strFolder)
End if
End if
WScript.Sleep(30)
Next
WScript.Echo "INFO: VFS Data import complete."& VBcrlf
End Sub
Sub ReadVFSData()
Dim i: i = 0
Dim oFSO, oFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(strTextFile, 1 )
Do Until oFile.AtEndOfStream
Redim Preserve g_arrFileLines(i)
g_arrFileLines(i) = oFile.ReadLine
i = i + 1
Loop
oFile.Close
End Sub
'Checks whether the folder has subfolder or not.
'If the folder has "" appended to it then it contains the sub folder
function hasSubFolders(ByVal sFolderName)
if sFolderName <> "" then
if Right(sFolderName, 1) = """" then
hasSubFolders = true
end if
end if
End function
'User-defined IIf function to perform ternary operation i.e. expression? true_value : false_value
Function IIf(bCondition, sTrueValue, sFalseValue)
if bCondition Then
If IsObject(sTrueValue) Then
Set IIf = sTrueValue
Else
IIf = sTrueValue
End If
Else
If IsObject(sFalseValue) Then
Set IIf = sFalseValue
Else
IIf = sFalseValue
End If
End If
End Function
'==============================================================================
' Syntax
' Show the command-line syntax
'==============================================================================
public function Syntax
wscript.echo "Purpose: Import VFS tree permissions from a text file " & vbCrLf & _
"Usage: " & wscript.scriptname & " <arguments>" & vbCrLf & _
"Required Arguments:" & vbCrLf & _
" -s EFT Server" & vbCrLf & _
" -u Admin username for EFT Server" & vbCrLf & _
" -p Admin password" & vbCrLf & _
" -site Site name on the server we are manipulating. Defaults to first site" & vbCrLf & _
" -f Path of text file to retrieve data " & vbCrLf & _
vbCrLf & _
"Optional Arguments: " & vbCrLf & _
" -? This help" & vbCrLf & _
" -port Admin port on EFT server. Defaults to 1100" & vbCrLf & _
"Example: " & wscript.scriptname & " -s localhost -port 1100 -u admin -p secret -site SiteName -f c:\migrate.txt"
end function ' Syntax

BIN
vbs/64.vbs Normal file

Binary file not shown.

BIN
vbs/72.vbs Normal file

Binary file not shown.

68
vbs/AddIPAccessRules.vbs Normal file
View File

@@ -0,0 +1,68 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
siteName = "GS2"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
'To create an entry use the line below
Dim isAllowEntry : isAllowEntry = True
For index = 1 To 4
For index2 = 1 To 255
selectedSite.AddIPAccessRule "192.168." & index & "." & index2, isAllowEntry, 0
Next
Next
'Remove IPAccessRule at position
'For index = 1 To 9408
'selectedSite.RemoveIPAccessRule(1)
'Wscript.echo "Removing IP Access Rule: " & index
'Next
'Old functions:
'allowedIPs = SFTPServer.GetAllowedMasks
'For each ip in allowedIPs
' WScript.Echo "Allowed: " + ip
'Next
'deniedIPs = SFTPServer.GetDeniedMasks
'For each ip in deniedIPs
' WScript.Echo "Denied: " + ip
'Next
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,40 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
strEmailList = SFTPServer.SMTPAddressBook
For j = 0 to 1000
If strEmailList <> "" Then
strEmailList = strEmailList + "; "
End If
strEmailList = strEmailList + Cstr(j) +"<" + Cstr(j) + "@SomeServer.com>"
Next
SFTPServer.SMTPAddressBook = strEmailList
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

53
vbs/Create20Users.vbs Normal file
View File

@@ -0,0 +1,53 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
siteName = "gs"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
SFTPServer.RefreshSettings
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
For j = 0 To 19
Wscript.echo j
selectedSite.CreateUserEx Cstr(j),Cstr(j),0,Cstr(j),Cstr(j),True,False,"Default settings"
Next
SFTPServer.AutoSave = TRUE
SFTPServer.ApplyChanges
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

87
vbs/CreateNewAdmin.vbs Normal file
View File

@@ -0,0 +1,87 @@
'
' FILE: CreateNewAdmin.vbs
' AUTHOR: Brian Arriaga
' CREATED: 2 June 2016
' MODIFIED: 2 June 2016
' ORIGINALLY CREATED FOR: EFT Server 6.5-7.3
' PURPOSE: This script can create a new admin user or group within EFT Server by using the CreateAdmin method.
' This script was created as a workaround to add Universal Groups and Domain Local Groups as admins into EFT Server.
' In EFT Server 7.2.x and prior, these groups are outside of visible scope for the admin portion of AD viewer.
' To use this script, modify the connection details and the AdminAccountType, isGroup, NewAdminPassword,
'
' NOTE: The creation and modification of COM API scripts is not within the standard scope of Support.
' All COM API scripts are supplied as a courtesy "AS IS" with no implied or explicit guarantee of function.
' GlobalSCAPE is not responsible for any damage to system or data as a result of using supplied COM API scripts.
' Further information and usage instruction on COM API methods can be found online within the help file: http://help.globalscape.com/help/
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
'Modify the below connection details to reflect your own environment.
txtServer = "localhost"
txtPort = "1110"
txtAdminUserName = "a"
txtAdminPassword = "a"
'Modify the below 4 entries to configure the admin account/settings you desire.
'AdminAccountType:
' EFTAccount = 0,
' LocalComputerAccount = 1,
' ADAccount = 2,
AdminAccountType = 2
'group:
' True = Admin being added is a group
' False = Admin being added is not a group
isGroup = True
'NewAdminPassword
' Enter the desired Name for the new adminUser
' If AD group is being used (AdminAccountType=2) make sure to specify the domain in Domain\Group format.
NewAdmin = ""
'NewAdminPassword
' Enter the desired password for the new adminUser
' If group is being used, can be set to anything
NewAdminPassword= "P@ssWord!"
Call ConnectToServer()
Call CreateNewAdmin()
SFTPServer.Close
Set SFTPServer = nothing
'==========================================
'This sub connects to the server
'=========================================
Sub ConnectToServer()
SFTPServer.Connect txtServer, txtPort, txtAdminUserName, txtAdminPassword
If Err.Number = 0 Then
WScript.Echo "Connected to EFT Server: " & txtServer
End If
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
End If
End Sub
'==========================================
'This sub create a new Admin User or Group into EFT Server using the "CreateAdmin" method in format CreateAdmin(Admin Name, Admin Pass, Admin Type, Admin is Group)
'=========================================
Sub CreateNewAdmin()
Set adminUser = SFTPServer.CreateAdmin(NewAdmin, NewAdminPassword, AdminAccountType, isGroup)
WScript.Echo "Admin login " + adminUser.Login + " created."
End Sub

34
vbs/CreateSSHKey.vbs Normal file
View File

@@ -0,0 +1,34 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1100"
txtAdminUserName = "Administrator"
txtPassword = "Tester!1"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
SFTPServer.CreateSSHKey 1024, "passphrase", "C:\Private", "C:\Public.pub", False, 0, ""
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

23
vbs/CreateUsers.vbs Normal file
View File

@@ -0,0 +1,23 @@
ServerAddress = "192.168.102.28"
ServerUsername = "eftadmin"
ServerPassword = "a"
ExcelFile = "R:\jhulme\COM Scripts\usersGlobalscape.xlsx"
Set SFTPServer = CreateObject("SFTPCOMInterface.CIServer")
SFTPServer.Connect ServerAddress,1100,ServerUsername,ServerPassword
Set sites=SFTPServer.Sites
Set site = sites.Item(0)
SFTPServer.RefreshSettings
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(ExcelFile)
objExcel.Visible = True
i = 1
Do Until objExcel.Cells(i, 1).Value = ""
site.CreateUserEx objExcel.Cells(i, 1).Value, objExcel.Cells(i, 2).Value, 0, objExcel.Cells(i, 4).Value, objExcel.Cells(i, 5).Value,True,True,objExcel.Cells(i, 6).Value
i = i + 1
Loop
objExcel.Quit
SFTPServer.AutoSave=True
SFTPServer.ApplyChanges

124
vbs/Create_user_ex.vbs Normal file
View File

@@ -0,0 +1,124 @@
'
' FILE: CreateUserEX2.vbs
' AUTHOR: Brian Arriaga
' CREATED: 17 MAR 2015
' MODIFIED: 17 MAR 2015
' ORIGINALLY CREATED FOR: EFT Server 6.5-7.0.3
' PURPOSE: This script creates a specified user using the CreateUserEX2 method.
'
' NOTE: The creation and modification of COM API scripts is not within the standard scope of Support.
' All COM API scripts are supplied as a courtesy "AS IS" with no implied or explicit guarantee of function.
' GlobalSCAPE is not responsible for any damage to system or data as a result of using supplied COM API scripts.
' Further information and usage instruction on COM API methods can be found online within the help file: http://help.globalscape.com/help/
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
'Modify the below connection details to reflect your own environment.
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtAdminPassword = "a"
txtSiteName = "GS"
' This is the username that will be created
txtLogin = "TestUser15"
' This specifies the password of the user.
txtPassword = "Password_321!"
' This specifies the full name of the user (account details).
txtFullName = "Test User"
' This specifies the email of the user (account details).
txtEmail = "abaciu@iiroc.ca"
' This specifies whether or not a folder will be created for the user. If "true", a user home folder will be created with the Login name, example: /Usr/UserA.
'If false, it will not create a folder for the user and it will instead inherit the folder from the template
txtCreateHomeFolder = "false"
'This specifies whether or not the user will have full permissions to the home folder.
txtFullPermissionsForHomeFolder = "true"
Dim theSite
Call ConnectToServerEx()
Call FindSite()
Call RunCreateUserEX2()
SFTPServer.Close
Set SFTPServer = nothing
'==========================================
'This sub connects to the server with AD authentication
'=========================================
Sub ConnectToServerEx()
SFTPServer.ConnectEx txtServer, txtPort, 1, "", ""
WScript.Echo "Connected to EFT Server: " & txtServer
End Sub
'==========================================
'This sub connects to the server
'=========================================
Sub ConnectToServer()
SFTPServer.Connect txtServer, txtPort, txtAdminUserName, txtAdminPassword
WScript.Echo "Connected to EFT Server: " & txtServer
End Sub
'==========================================
'This sub finds the specified site
'=========================================
Sub FindSite()
set Sites=SFTPServer.Sites
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
if LCase(Trim(theSite.Name)) = LCase(Trim(txtSiteName)) then
exit for
End if
Next
WScript.Echo "Connected to site: " & theSite.Name
End Sub
'==========================================
'This sub Initializes the CINewUserData property, sets the variables and then creates a user account using the CreateUserEX2() method.
'=========================================
Sub RunCreateUserEX2()
Set NewUserData = WScript.CreateObject("SFTPCOMInterface.CINewUserData")
NewUserData.Login = txtLogin
NewUserData.FullName = txtfullName
NewUserData.Email = txtemail
NewUserData.Password = txtpassword
NewUserData.CreateHomeFolder = txtCreateHomeFolder
NewUserData.FullPermissionsForHomeFolder= txtFullPermissionsForHomeFolder
WScript.Echo ""
WScript.Echo "Creating user with Login: " & NewUserData.Login
WScript.Echo "Creating user with Password: " & NewUserData.Password
WScript.Echo "Creating user with Full Name (account detail): " & NewUserData.FullName
WScript.Echo "Creating user with Email (account detail): " & NewUserData.Email
' The below lines will output whether or not a home folder will be created for the user
if (NewUserData.CreateHomeFolder = false) Then
WScript.Echo "The user will inherit the Default Settings Template Home folder"
else
WScript.Echo "A folder /" & NewUserData.Login & " will be created in the Settings Template Root Folder"
end if
' The below line will output whether or not the user will receive full permission to their home folder.
if (NewUserData.FullPermissionsForHomeFolder = false) Then
WScript.Echo "The user will not receive full permission to their home folder"
else
WScript.Echo "The user will receive full permission to their home folder"
end if
theSite.CreateUserEX2(NewUserData)
End Sub

View File

@@ -0,0 +1,124 @@
'
' FILE: CreateUserEX2.vbs
' AUTHOR: Brian Arriaga
' CREATED: 17 MAR 2015
' MODIFIED: 17 MAR 2015
' ORIGINALLY CREATED FOR: EFT Server 6.5-7.0.3
' PURPOSE: This script creates a specified user using the CreateUserEX2 method.
'
' NOTE: The creation and modification of COM API scripts is not within the standard scope of Support.
' All COM API scripts are supplied as a courtesy "AS IS" with no implied or explicit guarantee of function.
' GlobalSCAPE is not responsible for any damage to system or data as a result of using supplied COM API scripts.
' Further information and usage instruction on COM API methods can be found online within the help file: http://help.globalscape.com/help/
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
'Modify the below connection details to reflect your own environment.
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtAdminPassword = "a"
txtSiteName = "GS"
' This is the username that will be created
txtLogin = "TestUser15"
' This specifies the password of the user.
txtPassword = "Password_321!"
' This specifies the full name of the user (account details).
txtFullName = "Test User"
' This specifies the email of the user (account details).
txtEmail = "abaciu@iiroc.ca"
' This specifies whether or not a folder will be created for the user. If "true", a user home folder will be created with the Login name, example: /Usr/UserA.
'If false, it will not create a folder for the user and it will instead inherit the folder from the template
txtCreateHomeFolder = "false"
'This specifies whether or not the user will have full permissions to the home folder.
txtFullPermissionsForHomeFolder = "true"
Dim theSite
Call ConnectToServerEx()
Call FindSite()
Call RunCreateUserEX2()
SFTPServer.Close
Set SFTPServer = nothing
'==========================================
'This sub connects to the server with AD authentication
'=========================================
Sub ConnectToServerEx()
SFTPServer.ConnectEx txtServer, txtPort, 1, "", ""
WScript.Echo "Connected to EFT Server: " & txtServer
End Sub
'==========================================
'This sub connects to the server
'=========================================
Sub ConnectToServer()
SFTPServer.Connect txtServer, txtPort, txtAdminUserName, txtAdminPassword
WScript.Echo "Connected to EFT Server: " & txtServer
End Sub
'==========================================
'This sub finds the specified site
'=========================================
Sub FindSite()
set Sites=SFTPServer.Sites
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
if LCase(Trim(theSite.Name)) = LCase(Trim(txtSiteName)) then
exit for
End if
Next
WScript.Echo "Connected to site: " & theSite.Name
End Sub
'==========================================
'This sub Initializes the CINewUserData property, sets the variables and then creates a user account using the CreateUserEX2() method.
'=========================================
Sub RunCreateUserEX2()
Set NewUserData = WScript.CreateObject("SFTPCOMInterface.CINewUserData")
NewUserData.Login = txtLogin
NewUserData.FullName = txtfullName
NewUserData.Email = txtemail
NewUserData.Password = txtpassword
NewUserData.CreateHomeFolder = txtCreateHomeFolder
NewUserData.FullPermissionsForHomeFolder= txtFullPermissionsForHomeFolder
WScript.Echo ""
WScript.Echo "Creating user with Login: " & NewUserData.Login
WScript.Echo "Creating user with Password: " & NewUserData.Password
WScript.Echo "Creating user with Full Name (account detail): " & NewUserData.FullName
WScript.Echo "Creating user with Email (account detail): " & NewUserData.Email
' The below lines will output whether or not a home folder will be created for the user
if (NewUserData.CreateHomeFolder = false) Then
WScript.Echo "The user will inherit the Default Settings Template Home folder"
else
WScript.Echo "A folder /" & NewUserData.Login & " will be created in the Settings Template Root Folder"
end if
' The below line will output whether or not the user will receive full permission to their home folder.
if (NewUserData.FullPermissionsForHomeFolder = false) Then
WScript.Echo "The user will not receive full permission to their home folder"
else
WScript.Echo "The user will receive full permission to their home folder"
end if
theSite.CreateUserEX2(NewUserData)
End Sub

View File

@@ -0,0 +1,119 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
siteName = "GS"
set siteToRemove = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set siteToRemove = site
Exit For
End If
Next
'EventType:
'OnTimer = 4097,
'OnLogRotate = 4098,
'OnServiceStopped = 4099,
'OnServiceStarted = 4100,
'MonitorFolder = 4101,
'OnMonitorFolderFailed = 4102,
'OnSiteStarted = 8193,
'OnSiteStopped = 8194,
'OnIPAddedToBanList = 8195,
'OnClientConnected = 12289,
'OnClientConnectionFailed = 12290,
'OnClientDisconnected = 12291,
'OnClientDisabled = 16385,
'OnClientQuotaExceeded = 16386,
'OnClientLoggedOut = 16387,
'OnClientLoggedIn = 16388,
'OnClientLoginFailed = 16389,
'OnClientPasswordChanged = 16390,
'OnClientCreated = 16391,
'OnClientLocked = 16392,
'OnFileDeleted = 20481,
'OnFileUpload = 20482,
'BeforeFileDownload = 20483,
'OnFileDownload = 20484,
'OnFileRenamed = 20485,
'OnFolderCreated = 20486,
'OnFolderDeleted = 20487,
'OnUploadFailed = 20489,
'OnDownloadFailed = 20490,
'OnChangeFolder = 20491,
'OnFileMoved = 20492,
'OnVerifiedUploadSuccess = 20493,
'OnVerifiedUploadFailure = 20494,
'OnVerifiedDownloadSuccess = 20495,
'OnVerifiedDownloadFailure = 20496,
'AS2InboundTransactionSucceeded = 24577,
'AS2InboundTransactionFailed = 24578,
'AS2OutboundTransactionSucceeded = 24579,
'AS2OutboundTransactionFailed = 24580,
If Not siteToRemove Is Nothing Then
Set rules = site.EventRules(4101)
Set objParams = WScript.CreateObject("SFTPCOMInterface.CIFolderMonitorEventRuleParams")
objParams.Name = "TestFolderMon13"
objParams.Enabled = true
objParams.Description = "This is a test event rule"
objParams.Path = "C:\wd\monitor"
'Recurrence:
' Recurrence_Continually = 0,
' Recurrence_Daily = 1,
' Recurrence_Weekly = 2,
' Recurrence_Monthly = 3,
' Recurrence_Yearly = 4,
' Recurrence_Once = 5,
' Recurrence_Calendar = 6,
Set eventRule = rules.Add(rules.Count(), objParams)
'Add "If File name matches "*.txt" or "*.exe"" condition:
dim cond
set cond = eventRule.AddIfStatement(0, 5005, 16, Array("*.txt", "*.exe"), -1)
Set mail = WScript.CreateObject("SFTPCOMInterface.CIMailActionParams")
mail.Body = "Test email"
mail.Subject = "Test"
mail.TOAddresses = "youremail@youdomain.com"
cond.ifSection.Add 0, mail
End If
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

50
vbs/Generate_Complex.vbs Normal file
View File

@@ -0,0 +1,50 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
userName = "test"
siteName = "GS"
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
password = selectedSite.CreateComplexPassword()
wscript.echo(password)
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

60
vbs/IPAccessExport.vbs Normal file
View File

@@ -0,0 +1,60 @@
Const ForAppending = 8, AutobanIPRule = 0, ManualIPRule = 1
Const txtMyOutputFileName = "TESTOut.csv" 'Output file CSV File can be opened with MS Excel
Dim SFTPServer, CRLF, txtServer, txtPort, txtAdminUserName, txtPassword, SiteName, myFSO, WriteStuff, selectedSite, i, Key, Key2
Set SFTPServer = CreateObject("SFTPCOMInterface.CIServer")
CRLF = Chr(13) & Chr(10) 'Use the built-in vbCrLf constant instead!
'***************************************************
'***Modify the following to match your EFT Server***
'***************************************************
txtServer = "192.168.102.28" 'input server ip or localhost
txtPort = "1100" 'input port used
txtAdminUserName = "insight" 'input server admin credentials - username
txtPassword = "a" 'input server admin credentials - password
SiteName = LCase("MySite") 'input sitename in the ""
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then WScript.Quit 0
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile(txtMyOutputFileName, ForAppending, True)
Set selectedSite = Nothing
'Move through sites to find the one you're looking for
For i = 0 To SFTPServer.Sites.Count - 1
With SFTPServer.Sites.Item(i)
If LCase(.Name) = SiteName Then
count = 1
For Each Key In .GetIPAccessRules
Select Case Key.Type
Case ManualIPRule
WriteStuff.WriteLine Join(Array(Key.Address, Key.Allow, count)
End Select
Next
Else 'LCase(SFTPServer.Sites(i).Name) <> SiteName
'WriteStuff.WriteLine "Manual Added," & key1.Address & "," & key1.added & ",,,,"
End If 'Why write "Manual Added, ..." to the .csv file here?
End With 'The Else branch is executed when the current site isn't
Next 'the one you're looking for, so why have an Else branch?
WriteStuff.Close
Set WriteStuff = Nothing
Set myFSO = Nothing
SFTPServer.Close
Set SFTPServer = Nothing
MsgBox "Banned IPs can be found in the file """ & txtMyOutputFileName & """", vbInformation
Function Connect(serverOrIpAddress, port, username, password)
On Error Resume Next
SFTPServer.Connect serverOrIpAddress, port, username, password
Connect = (Err.Number = 0)
If Not Connect Then
MsgBox "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & _
Err.Description & " [" & CStr(Err.Number) & "]", vbInformation, "Error"
End If
End Function

7850
vbs/IPAccess_Import.vbs Normal file

File diff suppressed because it is too large Load Diff

73
vbs/IPBanExport.vbs Normal file
View File

@@ -0,0 +1,73 @@
Const ForAppending = 8, AutobanIPRule = 0, ManualIPRule = 1
Const txtMyOutputFileName = "C:\path\TESTOut.csv" 'Output file CSV File can be opened with MS Excel
Dim SFTPServer, CRLF, txtServer, txtPort, txtAdminUserName, txtPassword, SiteName, myFSO, WriteStuff, selectedSite, i, Key, Key2
Set SFTPServer = CreateObject("SFTPCOMInterface.CIServer")
CRLF = Chr(13) & Chr(10) 'Use the built-in vbCrLf constant instead!
'***************************************************
'***Modify the following to match your EFT Server***
'***************************************************
txtServer = "localhost" 'input server ip or localhost
txtPort = "1100" 'input port used
txtAdminUserName = "test" 'input server admin credentials - username
txtPassword = "test" 'input server admin credentials - password
SiteName = LCase("MySite") 'input sitename in the ""
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then WScript.Quit 0
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile(txtMyOutputFileName, ForAppending, True)
'Header row for CSV file
'Type: AutoBan or Manually Added to List
'Address: IP that is in the list
'Banned: Dated added to banlist
'Permanent: True for permanent addition, False for expiring address
'Expires: Date that non-permanent address in Auto Banlist will drop from list.
'Reason: Reason IP was added to AutoBan list.
WriteStuff.WriteLine "Type,Address,Banned,Permanent,Expires,Reason"
Set selectedSite = Nothing
'Move through sites to find the one you're looking for
For i = 0 To SFTPServer.Sites.Count - 1
With SFTPServer.Sites.Item(i)
If LCase(.Name) = SiteName Then
For Each Key In .GetIPAccessRules
Select Case Key.Type
Case AutobanIPRule
For Each Key2 In Key.BannedIPs
WriteStuff.WriteLine Join(Array("AutoBanned", Key2.Address, CStr(Key2.Banned), CStr(Key2.Permanently), CStr(Key2.Expires), Key2.Reason), ",")
Next
Case ManualIPRule
If Not Key.Allow Then WriteStuff.WriteLine Join(Array("Manually Added", Key.Address, Key.Added, "", "", ""), ",")
End Select
Next
Else 'LCase(SFTPServer.Sites(i).Name) <> SiteName
'WriteStuff.WriteLine "Manual Added," & key1.Address & "," & key1.added & ",,,,"
End If 'Why write "Manual Added, ..." to the .csv file here?
End With 'The Else branch is executed when the current site isn't
Next 'the one you're looking for, so why have an Else branch?
WriteStuff.Close
Set WriteStuff = Nothing
Set myFSO = Nothing
SFTPServer.Close
Set SFTPServer = Nothing
MsgBox "Banned IPs can be found in the file """ & txtMyOutputFileName & """", vbInformation
Function Connect(serverOrIpAddress, port, username, password)
On Error Resume Next
SFTPServer.Connect serverOrIpAddress, port, username, password
Connect = (Err.Number = 0)
If Not Connect Then
MsgBox "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & _
Err.Description & " [" & CStr(Err.Number) & "]", vbInformation, "Error"
End If
End Function

46
vbs/IsFolderVirtual.vbs Normal file
View File

@@ -0,0 +1,46 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set Sites=SFTPServer.Sites
set oSite = Sites.Item(0)
WSCript.Echo oSite.Name
dim folders
'folders = oSite.GetFolderList("/")
if True = oSite.IsFolderVirtual("/wd") then
WSCript.Echo "/wd is virtual."
end if
if True = oSite.IsFolderVirtual("/Usr") then
WSCript.Echo "/Usr is virtual."
end if
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,56 @@
'
' FILE: ListUserInfo.vbs
' CREATED: 6-8-2012 (dransom@globalscape.com)
' UPDATED: 6-5-2014 (jhulme@globalscape.com)
' VERSION: 1.1 *added Settings template membership | Test against 6.5.x
' PURPOSE: Modified script that creates CSV file for users
' Tested against EFT Server Versions 6.3.x / 6.4.x / 6.5.x
' Provides the following information:
' Username, Description, Email,Account Creation, Disk Quota, Used space, Home Directory, Settings template membership, Last Connection Time
' **This script is provided AS IS to our customers as a courtesy no support is provided in modifying or debugging this script.
'
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
'Modify the following variables to match your environment
txtServer = "localhost"
txtPort = "1100"
txtUserName = "eftadmin"
txtPassword = "a"
txtSiteName = "GS"
txtMyOutputFileName = "EFT-Users.csv"
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
'open output file
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile(txtMyOutputFileName, 8, True)
'write data to a file
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
if LCase(Trim(theSite.Name)) = LCase(Trim(txtSiteName)) then
WriteStuff.WriteLine("Users for " & theSite.Name & ":")
WriteStuff.WriteLine("Username,Description,Email,Account Creation, Disk Quota, Used space, Home Directory, Settings Template, Last Connection Time, Enabled")
arUsers = theSite.GetUsers()
For j = LBound(arUsers) to UBound(arUsers)
set userSettings = theSite.GetUserSettings(arUsers(j))
WriteStuff.WriteLine(arUsers(j) & ", " & userSettings.GetDescription & ", " & userSettings.Email & ", " & userSettings.AccountCreationTime & ", " & userSettings.GetMaxSpace & ", " & userSettings.GetUsedSpace & ", " & userSettings.GetHomeDirString & ", " & theSite.GetUserSettingsLevel(arUsers(j)) & ", " & userSettings.LastConnectionTime & ", " & userSettings.GetEnableAccount)
Next
end if
Next
'Close all variables
WriteStuff.Close
SFTPServer.Close
Set theSite = nothing
Set SFTPServer = nothing
SET WriteStuff = NOTHING
SET myFSO = NOTHING

View File

@@ -0,0 +1,34 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
strEmailList = ""
SFTPServer.SMTPAddressBook = strEmailList
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,71 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
welcomeMsg = "The script you are running is used to return the date and time which a user's password is going to expire."
msgTitle = "Globalscape EFT Server"
serverMessage = "Enter EFT Server IP..."
portMessage = "Enter EFT Server Port..."
adminMessage = "Enter EFT Admin username..."
passMessage = "Enter EFT Admin password..."
siteMessage = "Enter the site name where the user is located..."
userMessage = "Enter the Username for which you would like to retrieve the expiration date and time..."
'Display welcome message
Call MsgBox (welcomeMsg, , msgTitle)
'Input Prompts
txtServer = InputBox (serverMessage, msgTitle)
txtPort = InputBox (portMessage, msgTitle)
txtAdminUserName = InputBox(adminMessage, msgTitle)
txtPassword = InputBox(passMessage, msgTitle)
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
userName = InputBox (userMessage, msgTitle)
siteName = InputBox (siteMessage, msgTitle)
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
set userSettings = selectedSite.GetUserSettings(userName)
'getting pass expiration date
If userSettings.IsPasswordAgeLimited(pDate) Then
dtAccPssExp = Cstr(pDate)
Wscript.Echo "User " +userName + "'s Password Expires on " + dtAccPssExp
Else
Wscript.Echo "User " + userName + "'s Password does not expire"
End If
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,69 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
welcomeMsg = "The script you are running is used to return the date and time for which all user's passwords expire for a particular site."
msgTitle = "Globalscape EFT Server"
serverMessage = "Enter EFT Server IP..."
portMessage = "Enter EFT Server Port..."
adminMessage = "Enter EFT Admin username..."
passMessage = "Enter EFT Admin password..."
siteMessage = "Enter the site name..."
txtMyOutputFileName = "EFT-PasswordExpirations.csv"
'Display welcome message
Call MsgBox (welcomeMsg, , msgTitle)
'Input Prompts
txtServer = InputBox (serverMessage, msgTitle)
txtPort = InputBox (portMessage, msgTitle)
txtAdminUserName = InputBox(adminMessage, msgTitle)
txtPassword = InputBox(passMessage, msgTitle)
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
siteName = InputBox (siteMessage, msgTitle)
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile(txtMyOutputFileName, 8, True)
set theSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
if LCase(Trim(theSite.Name)) = LCase(Trim(siteName)) then
WriteStuff.WriteLine("Users password expiration for " & theSite.Name & ":")
WriteStuff.WriteLine("Username,Password Expiration date")
arUsers = theSite.GetUsers()
For j = LBound(arUsers) to UBound(arUsers)
set userSettings = theSite.GetUserSettings(arUsers(j))
If userSettings.IsPasswordAgeLimited(pDate) Then
dtAccPssExp = Cstr(pDate)
Else
dtAccPssExp = "Does not expire"
End If
WriteStuff.WriteLine(arUsers(j) & ", " & dtAccPssExp)
Next
end if
Next
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

52
vbs/Return Reg State.vbs Normal file
View File

@@ -0,0 +1,52 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
welcomeMsg = "The script you are running is used to retrieve registration status"
msgTitle = "Globalscape EFT Server"
serverMessage = "Enter EFT Server IP..."
portMessage = "Enter EFT Server Port..."
adminMessage = "Enter EFT Admin username..."
passMessage = "Enter EFT Admin password..."
moduleMessage = "Enter Integer for Module You want to Check"
txtMyOutputFileName = "RegistrationStatus.csv"
'Display welcome message
Call MsgBox (welcomeMsg, , msgTitle)
'Input Prompts
txtServer = InputBox (serverMessage, msgTitle)
txtPort = InputBox (portMessage, msgTitle)
txtAdminUserName = InputBox(adminMessage, msgTitle)
txtPassword = InputBox(passMessage, msgTitle)
txtModuleInt = InputBox(moduleMessage, msgTitle)
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile(txtMyOutputFileName, 8, True)
dim RegState
RegState = SFTPServer.ModuleRegistrationState(txtModuleInt)
MsgBox RegState
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

31
vbs/SSHSSL-passphrase.vbs Normal file
View File

@@ -0,0 +1,31 @@
'
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
txtServer = "localhost"
txtPort = "1100"
txtUserName = "test"
txtPassword = "test"
' On Error Resume Next
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
SFTPhrase = theSite.SFTPKeyPassphrase
SSLPassphrase = theSite.GetPassPhrase()
Wscript.Echo theSite.Name & "SFTP Passphrase " & SFTPhrase
Wscript.Echo theSite.Name & "SSL Passphrase " & SSLPassphrase
Next
Set theSite = nothing
Set SFTPServer = nothing
SET WriteStuff = NOTHING
SET myFSO = NOTHING

101
vbs/SetGroupPermissions.vbs Normal file
View File

@@ -0,0 +1,101 @@
'
' FILE: ExportUsersAndGroupMembership.vbs
' AUTHOR: Brian Arriaga
' CREATED: 9 JAN 2015
' MODIFIED: 9 JAN 2015
' ORIGINALLY CREATED FOR: EFT Server 6.5-7.0.3
' PURPOSE: This script loops through all Users of a specified site and performs the GetPermissionGroupsOfUser() COM API method along with
' objLogFile.WriteLine() to record the data in "username,group" format to an output file
' The output text file can be used with ImportUsersAndGroupMembership.vbs to import the user+group memberships.
' Can be used to backup group memberships in scenarios were Group membership settings are being lost.
'
' NOTE: The creation and modification of COM API scripts is not within the standard scope of Support.
' All COM API scripts are supplied as a courtesy "AS IS" with no implied or explicit guarantee of function.
' GlobalSCAPE is not responsible for any damage to system or data as a result of using supplied COM API scripts.
' Further information and usage instruction on COM API methods can be found online within the help file: http://help.globalscape.com/help/
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
'Modify the below connection details to reflect your own environment.
txtServer = "localhost"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtAdminPassword = "a"
txtSiteName = "GS"
'Folder to apply group/user permissions to
txtVFSName = "/usr/grouptesting"
'Group to add to folder
txtGroup = "testGroup"
'The below values specify each permission and whether or not the client has it
boolDirCreate = True
boolDirDelete = False
boolDirList = True
boolDirShowHidden = False
boolDirShowInList = True
boolDirShowReadOnly = False
boolFileAppend = True
boolFileDelete = False
boolFileDownload = True
boolFileRename = False
boolFileUpload = True
Dim theSite
g_strBuffer =""
Call ConnectToServer()
Call FindSite()
Call ListUsersAndGroups()
'==========================================
'This sub connects to the server
'=========================================
Sub ConnectToServer()
SFTPServer.Connect txtServer, txtPort, txtAdminUserName, txtAdminPassword
End Sub
'==========================================
'This sub finds the specified site
'=========================================
Sub FindSite()
set Sites=SFTPServer.Sites
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
if LCase(Trim(theSite.Name)) = LCase(Trim(txtSiteName)) then
exit for
End if
Next
End Sub
'==========================================
'This Sub adds specified group/user to specified VFS folder
'=========================================
Sub ListUsersAndGroups()
set oPerm = theSite.GetBlankPermission(txtVFSName, txtGroup)
oPerm.DirCreate = boolDirCreate
oPerm.DirDelete = boolDirDelete
oPerm.DirList = boolDirList
oPerm.DirShowHidden = boolDirShowHidden
oPerm.DirShowInList = boolDirShowInList
oPerm.DirShowReadOnly = boolDirShowReadOnly
oPerm.FileAppend = boolFileAppend
oPerm.FileDelete = boolFileDelete
oPerm.FileDownload = boolFileDownload
oPerm.FileRename = boolFileRename
oPerm.FileUpload = boolFileUpload
theSite.SetPermission(oPerm)
End Sub
SFTPServer.Close
Set SFTPServer = nothing

View File

@@ -0,0 +1,56 @@
'
' FILE: SetUserHomeFolders.vbs
' Modified: 6-04-2014 (dransom@globalscape.com)
' PURPOSE: Modified script that will set a user's home folder.
' Required parameters: SetUserHomeFolder.vbs <username> <VFS Home Folder>
' Example: SetUserHomeFolder.vbs dransom "/usr/dransom"
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
'Modify the following variables to match your environment
txtServer = "localhost"
txtPort = "1100"
txtUserName = "test"
txtPassword = "test"
txtSiteName = "MySite"
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
txtEFTUser = WScript.Arguments.Item(0)
txtHomeFolder = WScript.Arguments.Item(1)
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
if LCase(Trim(theSite.Name)) = LCase(Trim(txtSiteName)) then
set userSettings = theSite.GetUserSettings(txtEFTUser)
userSettings.setHomeDirIsRoot(1)
userSettings.SetHomeDir(1)
userSettings.SetHomeDirString(txtHomeFolder)
Set oFolderPerm = theSite.GetBlankPermission(txtHomeFolder, txtEFTUser)
oFolderPerm.FileUpload = TRUE
oFolderPerm.FileDownload = TRUE
oFolderPerm.FileDelete = TRUE
oFolderPerm.FileRename = TRUE
oFolderPerm.FileAppend = TRUE
oFolderPerm.DirCreate = TRUE
oFolderPerm.DirDelete = TRUE
oFolderPerm.DirList = TRUE
oFolderPerm.DirShowInList = TRUE
oFolderPerm.DirShowHidden = TRUE
oFolderPerm.DirShowReadOnly = TRUE
Call theSite.SetPermission(oFolderPerm, false)
end if
Next
'Close all variables
SFTPServer.Close
Set theSite = nothing
Set SFTPServer = nothing

View File

@@ -0,0 +1,53 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1111"
txtAdminUserName = "eftadmin"
txtPassword = "a"
siteName = "GS"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
arUsers = selectedSite.GetUsers()
For j = LBound(arUsers) to UBound(arUsers)
set userSettings = selectedSite.GetUserSettings(arUsers(j))
userSettings.SetForcePasswordResetOnNextLogin(false)
next
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

160
vbs/VFSCheck.vbs Normal file
View File

@@ -0,0 +1,160 @@
'This script is provided AS IS. Back up Server configuration before attempting to run.
'FILENAME: VFSCheck.vbs
'DATE: 31 JAN 2012
'USE: This will list all the folders of a site and display their corresponding physical paths.
'Notes: There is some logic for error checking, but I never got it to work correctly
' There is additional logic that will delete folders from VFS if they do not have a matching Physical path.
'**** run cmd "cscript (script location)****
'Modify the section "CONSTANTS/PARAMETERS
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
'Get File Object
Set objFSO = CreateObject("Scripting.FileSystemObject") 'Output file Object
Set objFSO2 = CreateObject("Scripting.FileSystemObject") 'Check foler existince object
Set objFSO3 = CreateObject("Scripting.FileSystemObject") 'Error Log
'Create/overwrite log file
Set objLogFile = objFSO.CreateTextFile("virtual_folders.txt", True)
'Set objErrorLogFile = objFSO3.CreateTextFile("virtual_folders_errors.log", True)
'On Error Resume Next 'Added Error Capture instructions for some steps beyond this point.
'CONSTANTS/PARAMETERS:
txtServer = "localhost"
txtPort = "1100"
txtAdminUserName = "test"
txtPassword = "test"
txtSiteName = "MySite"
'***WARNING BACKUP CONFIG FILES BEFORE MODIFYING THE NEXT LINE!!
delFlag="False" 'Set to True to actually delete the VFS entry from EFT. ***WARNING BACKUP CONFIG FILES BEFORE DOING THIS!!
objLogFile.WriteLine("VFS Path, Physical Path, Folder Status")
'objErrorLogFile.WriteLine("Folder, Error, Hex, Source, Description")
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set Sites=SFTPServer.Sites
SitesTotal = Sites.count
For iCount=0 to Sites.count - 1
Set Site = Sites.Item(iCount)
if LCase(Trim(Site.Name)) = LCase(Trim(txtSiteName)) then
exit for
End if
Next
'The following step was used for debugging.
'Msgbox Site.GetRootFolder()
'This step kicks off the whole process. I used "" as the root since the recursion logic adds the / to the path.
GetNextFolder "", Site
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function GetNextFolder (CurrFolder,objSite)
CurrFolder = CurrFolder & "/"
folderList = objSite.GetFolderList(CurrFolder)
if Err.Number <> 0 Then
objLogFile.WriteLine(CurrFolder & ", " & ", ERROR-FOLDER NOT FOUND IN VFS")
DisplayErrorInfo CurrFolder
else
arVFolders = Split(folderlist, CRLF)
recurseFlag=0
For Each fl in arVFolders
WScript.Echo "Exporting info for folder: " & CurrFolder & fl
'if the folder name has " at the end of it there are additional folders and we need to recurse to next level
if instr(fl,chr(34)) > 0 then
'strip " from the folder path
fl = Left(fl,len(fl)-1)
'set flag to recurse
recurseFlag=1
End if
'strip of the EFT Virtual informaiton
f2 = fl
fl = StripVirtualPortion(fl)
'WScript.Echo "Exporting info for folder: " & CurrFolder & fl
'Get the physical path
StrPhysical = objSite.GetPhysicalPath(CurrFolder & fl)
IF objFSO2.FolderExists(strPhysical) THEN
folderStat = "The folder exists"
ELSE
folderStat = "Sorry this folder does not exist"
'If Delete Flag is set remove VFS Entries where Physical folder does not exist
if delFlag = "True" then
objSite.RemoveFolder(CurrFolder & fl)
folderStat = folderStat & " and has been removed from VFS"
recurseFlag = 0
end if
END IF
'output infomaion to logfile
objLogFile.WriteLine(CurrFolder & fl & ", " & StrPhysical & ", " & folderStat)
'if the recurseFlag is set, call GetNextFolder again.
if recurseFlag > 0 then
GetNextFolder CurrFolder & fl,objSite
End if
Next
'if Err.Number <> 0 Then
' objLogFile.WriteLine(CurrFolder & fl & ", " & ", ERROR-FOLDER NOT FOUND IN VFS")
' DisplayErrorInfo (CurrFolder & fl)
' folderStat = "ERROR-FOLDER NOT FOUND IN VFS"
' else
' IF objFSO2.FolderExists(strPhysical) THEN
' folderStat = "The folder exists"
' ELSE
' folderStat = "Sorry this folder does not exist"
' 'If Delete Flag is set remove VFS Entries where Physical folder does not exist
' if delFlag = "True" then
' objSite.RemoveFolder(CurrFolder & fl)
' end if
' END IF
' 'output infomaion to logfile
' End IF 'error2
end if 'No Error
End Function
Function StripVirtualPortion(ByVal sPath)
Dim iPos , sVirtualFolderPath,bIsVirtual
iPos = InStr(1, sPath, " - Virtual", 1 )
If ( iPos > 0 ) Then
'WScript.Echo "-->Stripping VIRTUAL portion of folder name"
sVirtualFolderPath = sPath
sPath = Left( sPath, iPos -1 )
End If
StripVirtualPortion = sPath
End Function
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function
Sub DisplayErrorInfo (CurrFolder)
objErrorLogFile.WriteLine(CurrFolder & ", " & Err & ", " & Hex(Err) & ", " & Err.Source & ", " & Err.Description)
WScript.Echo "Folder : " & CurrFolder
WScript.Echo "Error: : " & Err
WScript.Echo "Error (hex) : &H" & Hex(Err)
WScript.Echo "Source : " & Err.Source
WScript.Echo "Description : " & Err.Description
Err.Clear
End Sub

17
vbs/a.vbs Normal file
View File

@@ -0,0 +1,17 @@
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
' Define source file name.
sourceFile = "C:\Users\jbranan\Desktop\source\Report File.xml"
' Define target file name.
destinationFile = "C:\Users\jbranan\Desktop\destination\Report File.xml"
'opy source to target.
FSO.CopyFile sourceFile, destinationFile
'Function UnicodeFileCopy(src As String, dst As String) As String
' On Error Resume Next
' FileCopy src, dst
' UnicodeFileCopy = Err.Description
'End Function
'Sub Main
' Call UnicodeFileCopy"C:\Users\jbranan\Desktop\source\Report File.xml", "C:\Users\jbranan\Desktop'\destination\Report File.xml"
'End Sub

47
vbs/change_email.vbs Normal file
View File

@@ -0,0 +1,47 @@
'
' FILE: ListUserInfo.vbs
' CREATED: 6-8-2012 (dransom@globalscape.com)
' UPDATED: 6-5-2014 (jhulme@globalscape.com)
' VERSION: 1.1 *added Settings template membership | Test against 6.5.x
' VERSION: 1.2 *added Added enabled/disabled
' PURPOSE: Modified script that creates CSV file for users
' Tested against EFT Server Versions 6.3.x / 6.4.x / 6.5.x
' Provides the following information:
' Username, Description, Email,Account Creation, Disk Quota, Used space, Home Directory, Settings template membership, Last Connection Time
' **This script is provided AS IS to our customers as a courtesy no support is provided in modifying or debugging this script.
'
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
'Modify the following variables to match your environment
txtServer = "localhost"
txtPort = "1100"
txtUserName = "eftadmin"
txtPassword = "a"
txtSiteName = "GS"
userName = "test"
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
'chnage email
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
if LCase(Trim(theSite.Name)) = LCase(Trim(txtSiteName)) then
set userSettings = theSite.GetUserSettings(userName)
userSettings.Email = "jhulme@globalscape.com"
end if
Next
'Close all variables
SFTPServer.Close
Set theSite = nothing
Set SFTPServer = nothing
SET WriteStuff = NOTHING
SET myFSO = NOTHING

54
vbs/changepassword.vbs Normal file
View File

@@ -0,0 +1,54 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.39"
txtPort = "1111"
txtAdminUserName = "eftadmin"
txtPassword = "a"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
userName = "test"
siteName = "GS"
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
'selectedSite.ChangeUserPassword userName, "abcd", 0
selectedSite.ChangeUserPassword userName, "test1", 0
'$1$abcdefg$M72mUVrUAZrOg1C7Nl1qM.
set userSettings = selectedSite.GetUserSettings(userName)
'userSettings.MaxInactivePeriod = 30
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,54 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
'Input boxes **do not modify**
msgTitle = "Globalscape EFT Server"
siteMessage = "Enter the site name:"
groupMessage = "Enter the name of the new group"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
siteName = InputBox (siteMessage, msgTitle)
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
'physical or virtual?
txtGroup = InputBox (groupMessage, msgTitle)
selectedSite.CreatePermissionGroup(txtGroup)
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,75 @@
'
' FILE: CreateUserEX2.vbs
' AUTHOR: Brian Arriaga
' CREATED: 17 MAR 2015
' MODIFIED: 17 MAR 2015
' ORIGINALLY CREATED FOR: EFT Server 6.5-7.0.3
' PURPOSE: This script creates a specified user using the CreateUserEX2 method.
'
' NOTE: The creation and modification of COM API scripts is not within the standard scope of Support.
' All COM API scripts are supplied as a courtesy "AS IS" with no implied or explicit guarantee of function.
' GlobalSCAPE is not responsible for any damage to system or data as a result of using supplied COM API scripts.
' Further information and usage instruction on COM API methods can be found online within the help file: http://help.globalscape.com/help/
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
'Modify the below connection details to reflect your own environment.
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtAdminPassword = "a"
txtSiteName = "GS"
createdFolder = "/Usr/created"
Dim theSite
Call ConnectToServerEx()
Call FindSite()
Call CreatePhysical()
SFTPServer.Close
Set SFTPServer = nothing
'==========================================
'This sub connects to the server with AD authentication
'=========================================
Sub ConnectToServerEx()
SFTPServer.ConnectEx txtServer, txtPort, 1, "", ""
WScript.Echo "Connected to EFT Server: " & txtServer
End Sub
'==========================================
'This sub connects to the server
'=========================================
Sub ConnectToServer()
SFTPServer.Connect txtServer, txtPort, txtAdminUserName, txtAdminPassword
WScript.Echo "Connected to EFT Server: " & txtServer
End Sub
'==========================================
'This sub finds the specified site
'=========================================
Sub FindSite()
set Sites=SFTPServer.Sites
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
if LCase(Trim(theSite.Name)) = LCase(Trim(txtSiteName)) then
exit for
End if
Next
WScript.Echo "Connected to site: " & theSite.Name
End Sub
'==========================================
'This sub Initializes the CINewUserData property, sets the variables and then creates a user account using the CreateUserEX2() method.
'=========================================
Sub CreatePhysical()
theSite.CreatePHysicalFolder(createdFolder)
End Sub

64
vbs/createVFSFolder.vbs Normal file
View File

@@ -0,0 +1,64 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
siteName = "GS"
'Input boxes **do not modify**
msgTitle = "Globalscape EFT Server"
isPhysMessage = "Is the folder physical or virtual? (Type p for physical and v for virtual"
physFolderMessage = "Enter the full path of the physical folder...."
aliasMessage = "Enter the full path of the alias..."
physRefMessage = "Enter the physical path reference for the virtual folder..."
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
'physical or virtual?
txtIsPhys = InputBox (isPhysMessage, msgTitle)
if txtIsPhys = "p" then
txtPhysPath = InputBox (physFolderMessage, msgTitle)
selectedSite.CreatePhysicalFolder(txtPhysPath)
end if
if txtIsPhys = "v" then
txtAliasPath = InputBox (aliasMessage, msgTitle)
txtPhysRef = InputBox (physRefMessage, msgTitle)
Call selectedSite.CreateVirtualFolder(txtAliasPath, txtPhysRef)
end if
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,63 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
welcomeMsg = "The script you are running is used to create a new settings tempalte for a specified site"
msgTitle = "Globalscape EFT Server"
serverMessage = "Enter EFT Server IP..."
portMessage = "Enter EFT Server Port..."
adminMessage = "Enter EFT Admin username..."
passMessage = "Enter EFT Admin password..."
siteMessage = "Enter the site name where the user is located..."
templateMessage = "Enter New Template Name"
'Display welcome message
Call MsgBox (welcomeMsg, , msgTitle)
'Input Prompts
txtServer = InputBox (serverMessage, msgTitle)
txtPort = InputBox (portMessage, msgTitle)
txtAdminUserName = InputBox(adminMessage, msgTitle)
txtPassword = InputBox(passMessage, msgTitle)
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
siteName = InputBox (siteMessage, msgTitle)
templateName = InputBox (templateMessage, msgTitle)
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
selectedSite.CreateSettingsLevel(templateName)
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,51 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.28"
txtPort = "1100"
txtAdminUserName = "eftadmin"
txtPassword = "a"
boolEncrypt = true
folderPath = "/somefolder"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
userName = "test"
siteName = "GS"
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
'Encrypt or unencrypt folder
selectedSite.EncryptFolder "/BAPI", boolEncrypt
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

19
vbs/excel.vbs Normal file
View File

@@ -0,0 +1,19 @@
Dim objXL
Dim objWB
Dim objWS
Set objXL = CreateObject("Excel.Application")
Set objWB = objXL.Workbooks.Open("C:\wd\scripts\blahblah.xls")
Set objWS = objWB.Worksheets("sheet1")
objWS.Rows(1).EntireRow.Delete
objWB.Save
objWB.Close
objXL.Quit
Set objXL = Nothing
Set objWB = Nothing
Set objWS = Nothing

33
vbs/get_date1.vbs Normal file
View File

@@ -0,0 +1,33 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.37"
txtPort = "1100"
txtUserName = "admin"
txtPassword = "Bran1739!"
txtSiteName = "MySite"
username = "a"
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
set theSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = txtSiteName Then
set theSite = site
Exit For
End If
Next
set userSettings = theSite.GetUserSettings(username)
MsgBox "Username: " &CStr(username)&" " & "Account creation time: " & CStr(userSettings.LastConnectionTime)
SFTPServer.Close
Set theSite = nothing
Set SFTPServer = nothing

View File

@@ -0,0 +1,42 @@
'
' FILE: get_date_user_last_connected.vbs
' CREATED: 10-26-2020 (jbranan@globalscape.com)
' UPDATED: 10-26-2020 (jhulme@globalscape.com)
' PURPOSE: Returns date/time a user last connected
' **This script is provided AS IS to our customers as a courtesy no support is provided in modifying or debugging this script.
'
' Set username variable with the username of the user you would like to view
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
'Modify the following variables to match your environment
txtServer = "localhost"
txtPort = "1100"
txtUserName = "username"
txtPassword = "password"
txtSiteName = "MySite"
username = "a"
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
set theSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = txtSiteName Then
set theSite = site
Exit For
End If
Next
set userSettings = theSite.GetUserSettings(username)
MsgBox "Username: " &CStr(username)&" " & "Last Connection Time: " & CStr(userSettings.LastConnectionTime)
'Close all variables
SFTPServer.Close
Set theSite = nothing
Set SFTPServer = nothing

34
vbs/passphrase to csv.vbs Normal file
View File

@@ -0,0 +1,34 @@
'
Dim fso
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set f = fso.OpenTextFile("C:\Users\fischerc\Desktop\output.csv", 2)
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
txtServer = "localhost"
txtPort = "1100"
txtUserName = "sig"
txtPassword = "Thund3r5truck!"
' On Error Resume Next
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
SFTPhrase = theSite.SFTPKeyPassphrase
SSLPassphrase = theSite.GetPassPhrase()
f.WriteLine theSite.Name & "," & "SFTP Passphrase," & SFTPhrase
f.WriteLine theSite.Name & "," & "SSL Passphrase," & SSLPassphrase
Next
Set theSite = nothing
Set SFTPServer = nothing
SET WriteStuff = NOTHING
SET myFSO = NOTHING
f.Close

31
vbs/passphrase.vbs Normal file
View File

@@ -0,0 +1,31 @@
'
'
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
txtServer = "localhost"
txtPort = "1100"
txtUserName = "test"
txtPassword = "test"
' On Error Resume Next
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
WScript.Quite(255)
Else
WScript.Echo "Connected to " & txtServer
End If
set Sites=SFTPServer.Sites
For i = 0 to SFTPServer.Sites.Count-1
set theSite=Sites.Item(i)
SFTPhrase = theSite.SFTPKeyPassphrase
SSLPassphrase = theSite.GetPassPhrase()
Wscript.Echo theSite.Name & "SFTP Passphrase " & SFTPhrase
Wscript.Echo theSite.Name & "SSL Passphrase " & SSLPassphrase
Next
Set theSite = nothing
Set SFTPServer = nothing
SET WriteStuff = NOTHING
SET myFSO = NOTHING

47
vbs/remapvirtual.vbs Normal file
View File

@@ -0,0 +1,47 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1111"
txtAdminUserName = "eftadmin"
txtPassword = "a"
siteName = "GS"
strAlias = "/virtual"
strNewPath = "C:\temp"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
selectedSite.RemapVirtualFolder strAlias, strNewPath
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,62 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.39"
txtPort = "1111"
txtAdminUserName = "eftadmin"
txtPassword = "a"
siteName = "GS"
txtMyOutputFileName = "ipAccessRules.csv"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
'open output file
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile(txtMyOutputFileName, 8, True)
'write data to a file
rules = SFTPServer.GetIPAccessRules()
For Each key In rules
If key.type = 1 Then
If key.allow = True Then
isAllowed = "Allowed"
else
isAllowed = "Denied"
End if
WriteStuff.WriteLine(key.address & ", " & isAllowed)
End if
Next
WScript.Echo "Done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,54 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "192.168.102.39"
txtPort = "1111"
txtAdminUserName = "eftadmin"
txtPassword = "a"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
userName = "new"
siteName = "GS"
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
set userSettings = selectedSite.GetUserSettings(userName)
dim passwordValue
set passwordValue = userSettings.GetResetPasswordSettings()
passWordDays = passwordValue.MaxPasswordAgeDays
wScript.echo(passWordDays)
'userSettings.MaxInactivePeriod = 30
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,52 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
welcomeMsg = "The script you are running is used to retrieve admin users that have administration permissions in EFT"
msgTitle = "Globalscape EFT Server"
serverMessage = "Enter EFT Server IP..."
portMessage = "Enter EFT Server Port..."
adminMessage = "Enter EFT Admin username..."
passMessage = "Enter EFT Admin password..."
txtMyOutputFileName = "Admin-Users.csv"
'Display welcome message
Call MsgBox (welcomeMsg, , msgTitle)
'Input Prompts
txtServer = InputBox (serverMessage, msgTitle)
txtPort = InputBox (portMessage, msgTitle)
txtAdminUserName = InputBox(adminMessage, msgTitle)
txtPassword = InputBox(passMessage, msgTitle)
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile(txtMyOutputFileName, 8, True)
For Each admin In SFTPServer.AdminAccounts
WriteStuff.WriteLine(admin.login)
Next
Wscript.echo "done"
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

47
vbs/setTemplate.vbs Normal file
View File

@@ -0,0 +1,47 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1111"
txtAdminUserName = "eftadmin"
txtPassword = "a"
userName = "test"
siteName = "GS"
newTemplate = "new"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
Call selectedSite.MoveUserToSettingsLevel(userName, newTemplate)
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

68
vbs/sethomedir.vbs Normal file
View File

@@ -0,0 +1,68 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
welcomeMsg = "The script you are running is used to return the date and time which a user's password is going to expire."
msgTitle = "Globalscape EFT Server"
serverMessage = "Enter EFT Server IP..."
portMessage = "Enter EFT Server Port..."
adminMessage = "Enter EFT Admin username..."
passMessage = "Enter EFT Admin password..."
siteMessage = "Enter the site name where the user is located..."
userMessage = "Enter the Username for which you would like to retrieve the expiration date and time..."
folderMessage = "Enter home folder"
'Display welcome message
Call MsgBox (welcomeMsg, , msgTitle)
'Input Prompts
txtServer = InputBox (serverMessage, msgTitle)
txtPort = InputBox (portMessage, msgTitle)
txtAdminUserName = InputBox(adminMessage, msgTitle)
txtPassword = InputBox(passMessage, msgTitle)
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
userName = InputBox (userMessage, msgTitle)
siteName = InputBox (siteMessage, msgTitle)
folderName = InputBox (folderMessage, msgTitle)
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
set userSettings = selectedSite.GetUserSettings(userName)
'set home directory
userSettings.SetHomeDirString(homeFolder)
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

View File

@@ -0,0 +1,53 @@
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
CRLF = (Chr(13)& Chr(10))
txtServer = "localhost"
txtPort = "1111"
txtAdminUserName = "eftadmin"
txtPassword = "a"
userName = "mike1"
siteName = "GS"
homeFolder = "/noexisty"
If Not Connect(txtServer, txtPort, txtAdminUserName, txtPassword) Then
WScript.Quit(0)
End If
set selectedSite = Nothing
set sites = SFTPServer.Sites()
For i = 0 To sites.Count -1
set site = sites.Item(i)
If site.Name = siteName Then
set selectedSite = site
Exit For
End If
Next
If Not selectedSite Is Nothing Then
set userSettings = selectedSite.GetUserSettings(userName)
'set home directory
userSettings.SetHomeDirString(homeFolder)
End If
SFTPServer.Close
Set SFTPServer = nothing
Function Connect (serverOrIpAddress, port, username, password)
On Error Resume Next
Err.Clear
SFTPServer.Connect serverOrIpAddress, port, username, password
If Err.Number <> 0 Then
WScript.Echo "Error connecting to '" & serverOrIpAddress & ":" & port & "' -- " & err.Description & " [" & CStr(err.Number) & "]", vbInformation, "Error"
Connect = False
Exit Function
End If
Connect = True
End Function

21
vbs/template.vbs Normal file
View File

@@ -0,0 +1,21 @@
dim template
dim oServer, oSites, oSite, oTemplate
set oServer = CreateObject ("SFTPCOMInterface.CIServer")
template = "new"
oServer.connect "localhost", 1111,"eftadmin","a"
set oSites = oServer.Sites()
for i = 0 to oSites.Count() -1
set oSite = oSites.Item (i)
if oSite.Name = "GS" Then
exit for
end if
next
set oTemplate = oSite.GetSettingsLevelSettings (template)
dim forced, isInherited
forced = oTemplate.GetForcePasswordResetOnInitialLogin(isInherited)
Wscript.Echo "template: " & template & "; ForcePasswordResetOnInitialLogin: " & forced & "; inherited: " & isInherited
oServer.close