Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ed03b793
authored
Dec 14, 2018
by
Belákovics Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added multi user support (thx to szebi)
parent
402cfbde
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
67 deletions
+74
-67
src/nsi/cloud.nsi
+51
-39
src/nsi/installer/cloud.py
+4
-2
src/nsi/installer/cloud_connect_from_windows.py
+19
-26
No files found.
src/nsi/cloud.nsi
View file @
ed03b793
;NSIS Modern User Interface
;Multilingual Cloud Installer Script
;Written by Csk Tams
;Written by Cs�k Tam�s and Bel�kovics �d�m
;--------------------------------
; MultiUser install setup
!define MULTIUSER_EXECUTIONLEVEL Highest
!define MULTIUSER_MUI
!define MULTIUSER_INSTALLMODE_COMMANDLINE
;--------------------------------
;Include Modules
!include "MultiUser.nsh"
!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "FileFunc.nsh"
...
...
@@ -18,15 +26,15 @@
!define AppUninstaller "Uninstall.exe"
!define IconName "cloud"
!define Show_output "True"
!define DefaulLocation "$
LOCALAPPDATA
\CIRCLE"
!define DefaulLocation "$
PROGRAMFILES
\CIRCLE"
!define LowestSupportedPythonVersion "6"
!define HighestSupportedPythonVersion "7"
!define LogInformationTime 2000
;String manipulations
!define Explode "!insertmacro Explode"
!define StrCase
"!insertmacro StrCase
"
!define StrTrimNewLines
"!insertmacro StrTrimNewLines
"
!define StrCase
2 "!insertmacro StrCase2
"
!define StrTrimNewLines
2 "!insertmacro StrTrimNewLines2
"
;--------------------------------
;General
!macro Explode Length Separator String
...
...
@@ -35,19 +43,19 @@
Call Explode
Pop '${Length}'
!macroend
!macro StrCase ResultVar String Case
!macro StrCase
2
ResultVar String Case
Push "${String}"
Push "${Case}"
Call StrCase
Call StrCase
2
Pop "${ResultVar}"
!macroend
!macro StrTrimNewLines ResultVar String
!macro StrTrimNewLines
2
ResultVar String
Push "${String}"
Call StrTrimNewLines
Call StrTrimNewLines
2
Pop "${ResultVar}"
!macroend
;Properly display all languages (Installer will not work on Windows 95, 98 or ME!)
Unicode true
;
Unicode true
;Name and file
Name "${Company} ${AppName}"
...
...
@@ -91,6 +99,7 @@
;Pages
!insertmacro MUI_PAGE_LICENSE "gpl-3.0.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
;Done fuction to launch install.bat
...
...
@@ -116,7 +125,7 @@
LangString NAME_Install ${LANG_HUNGARIAN} "Komponensek"
LangString NAME_Functions ${LANG_ENGLISH} "Functions"
LangString NAME_Functions ${LANG_HUNGARIAN} "Funkcik"
LangString NAME_Functions ${LANG_HUNGARIAN} "Funkci
�
k"
;CIRCLE Client (SecInstall)
;NAME
...
...
@@ -127,53 +136,53 @@
LangString DESC_SecInstall ${LANG_ENGLISH} "Install the core of the CIRCLE Client.$\r$\n\
Used for [RDP / SSH] type of connections.$\r$\n\
Automates all installed, third party connection tools."
LangString DESC_SecInstall ${LANG_HUNGARIAN} "A CIRCLE Kliens alapj
nak telept
se.$\r$\n\
[RDP / SSH] f
le kapcsolatokhoz haszn
lt.$\r$\n\
Automatiz
lja az installlt, harmadik fltl szrmaz szoftverek hasznlat
t."
LangString DESC_SecInstall ${LANG_HUNGARIAN} "A CIRCLE Kliens alapj
�nak telep�t�
se.$\r$\n\
[RDP / SSH] f
�le kapcsolatokhoz haszn�
lt.$\r$\n\
Automatiz
�lja az install�lt, harmadik f�lt�l sz�rmaz� szoftverek haszn�lat�
t."
;Python search (PythonLookup)
;NAME
LangString NAME_PythonLookup ${LANG_ENGLISH} "Search Python"
LangString NAME_PythonLookup ${LANG_HUNGARIAN} "Python keress"
LangString NAME_PythonLookup ${LANG_HUNGARIAN} "Python keres
�
s"
;DESC
LangString DESC_PythonLookup ${LANG_ENGLISH} "Use ONLY if necessary!$\r$\n\
Search the filesystem for Python installation. Usefull when Python was installed without accessing registry before.$\r$\n\
Installation will take more time."
LangString DESC_PythonLookup ${LANG_HUNGARIAN} "Csak sz
ksg eset
n!$\r$\n\
A f
jlrendszer keresse Python utn. Hasznos, ha a Python-t Registry nlkli opcival lett teleptve kor
bban.$\r$\n\
A telep
tst jelentsen lelass
tja."
LangString DESC_PythonLookup ${LANG_HUNGARIAN} "Csak sz
�ks�g eset�
n!$\r$\n\
A f
�jlrendszer keres�se Python ut�n. Hasznos, ha a Python-t Registry n�lk�li opci�val lett telep�tve kor�
bban.$\r$\n\
A telep
�t�st jelent�sen lelass�
tja."
;STATUS
LangString STATUS_PythonSearch ${LANG_ENGLISH} "Searching for Python. This could take some time. Looking at drive:"
LangString STATUS_PythonSearch ${LANG_HUNGARIAN} "Python keres
se a fjlrendszerben. Ez eltarthat egy darabig. Keres
s alapja:"
LangString STATUS_PythonSearch ${LANG_HUNGARIAN} "Python keres
�se a f�jlrendszerben. Ez eltarthat egy darabig. Keres�
s alapja:"
LangString STATUS_PythonFound ${LANG_ENGLISH} "Python found at "
LangString STATUS_PythonFound ${LANG_HUNGARIAN} "Python megtal
lva az albbi knyvt
rban: "
LangString STATUS_PythonFound ${LANG_HUNGARIAN} "Python megtal
�lva az al�bbi k�nyvt�
rban: "
LangString STATUS_PythonVersionSearch ${LANG_ENGLISH} "Determining Python version."
LangString STATUS_PythonVersionSearch ${LANG_HUNGARIAN} "Telep
tett Python verzi kidert
se."
LangString STATUS_PythonVersionSearch ${LANG_HUNGARIAN} "Telep
�tett Python verzi� kider�t�
se."
LangString STATUS_PythonVersionFound ${LANG_ENGLISH} "Installed Python version is:"
LangString STATUS_PythonVersionFound ${LANG_HUNGARIAN} "A telep
tett Python verzi
ja:"
LangString STATUS_PythonVersionFound ${LANG_HUNGARIAN} "A telep
�tett Python verzi�
ja:"
LangString STATUS_PythonArchitectSearch ${LANG_ENGLISH} "Deteremining installed Python mode (32bit or 64bit)."
LangString STATUS_PythonArchitectSearch ${LANG_HUNGARIAN} "Install
lt Python futtatsi mdjnak kidert
se (32bit vagy 64bit)."
LangString STATUS_PythonArchitectSearch ${LANG_HUNGARIAN} "Install
�lt Python futtat�si m�dj�nak kider�t�
se (32bit vagy 64bit)."
LangString STATUS_PythonArchitectFound ${LANG_ENGLISH} "Installed Python mode is:"
LangString STATUS_PythonArchitectFound ${LANG_HUNGARIAN} "A telep
tett Python m
dja:"
LangString STATUS_PythonArchitectFound ${LANG_HUNGARIAN} "A telep
�tett Python m�
dja:"
LangString STATUS_PythonNotSupported ${LANG_ENGLISH} "The installed Python version is not supported!$\r$\n\
To procede please uninstall Python first."
LangString STATUS_PythonNotSupported ${LANG_HUNGARIAN} "A feltelep
tett Python verzija nem t
mogatott!$\r$\n\
A sikeres telep
tshez el kell elbb tvol
tania a Python-t."
LangString STATUS_PythonNotSupported ${LANG_HUNGARIAN} "A feltelep
�tett Python verzi�ja nem t�
mogatott!$\r$\n\
A sikeres telep
�t�shez el kell el�bb t�vol�
tania a Python-t."
LangString STATUS_PythonNotFound ${LANG_ENGLISH} "Python not found in the filesystem!"
LangString STATUS_PythonNotFound ${LANG_HUNGARIAN}} "Nem tal
lhat Python a f
jlrendszerben!"
LangString STATUS_PythonNotFound ${LANG_HUNGARIAN}} "Nem tal
�lhat� Python a f�
jlrendszerben!"
LangString STATUS_PythonArchitectNotFound ${LANG_ENGLISH} "Could NOT determine the installed Python mode!$\r$\n\
To procede please uninstall Python first."
LangString STATUS_PythonArchitectNotFound ${LANG_HUNGARIAN} "Nem siker
lt kiderteni a felteleptett Python mdj
t!$\r$\n\
A sikeres telep
tshez el kell elbb tvol
tania a Python-t."
LangString STATUS_PythonArchitectNotFound ${LANG_HUNGARIAN} "Nem siker
�lt kider�teni a feltelep�tett Python m�dj�
t!$\r$\n\
A sikeres telep
�t�shez el kell el�bb t�vol�
tania a Python-t."
;NX Client (NXClient)
;NAME
...
...
@@ -183,12 +192,12 @@
;DESC
LangString DESC_NXClient ${LANG_ENGLISH} "Check whether you want to install a CIRCLE compatible NX Client by NoMachine.$\r$\n\
Used for [NX] type of connections."
LangString DESC_NXClient ${LANG_HUNGARIAN} "V
lassza ki, ha fel szeretn telepteni a NoMachine ltal gy
rtott NX Klienst.$\r$\n\
[NX] f
le kapcsolatokhoz haszn
lt."
LangString DESC_NXClient ${LANG_HUNGARIAN} "V
�lassza ki, ha fel szeretn� telep�teni a NoMachine �ltal gy�
rtott NX Klienst.$\r$\n\
[NX] f
�le kapcsolatokhoz haszn�
lt."
;Setup
LangString STATUS_ExecutingScript ${LANG_ENGLISH} "Executing setup script. Log files can be found at:"
LangString STATUS_ExecutingScript ${LANG_HUNGARIAN} "Install
cis script futtatsa. A folyamat napl
ja:"
LangString STATUS_ExecutingScript ${LANG_HUNGARIAN} "Install
�ci�s script futtat�sa. A folyamat napl�
ja:"
;--------------------------------
;Global variables
Var /GLOBAL python_location
...
...
@@ -227,7 +236,7 @@ SectionGroup /e '!$(NAME_Install)'
;Creating ShortCuts
CreateDirectory '$SMPROGRAMS\${Company}\${AppName}'
StrCmp $LANGUAGE ${LANG_HUNGARIAN} 0 +3
WriteINIStr "$SMPROGRAMS\${Company}\Ltogasd meg a ${AppUrlName}-t.url" "InternetShortcut" "URL" "${AppUrl}"
WriteINIStr "$SMPROGRAMS\${Company}\L
�
togasd meg a ${AppUrlName}-t.url" "InternetShortcut" "URL" "${AppUrl}"
Goto +2
WriteINIStr "$SMPROGRAMS\${Company}\Visit the ${AppUrlName}.url" "InternetShortcut" "URL" "${AppUrl}"
CreateShortCut '$SMPROGRAMS\${Company}\${AppName}\Uninstall ${AppName}.lnk' '$INSTDIR\${AppUninstaller}' "" '$INSTDIR\${AppUninstaller}' 0
...
...
@@ -265,6 +274,7 @@ Function .onInit
ClearErrors
${EndIf}
!insertmacro MUI_LANGDLL_DISPLAY
!insertmacro MULTIUSER_INIT
FunctionEnd
Function PythonSearch
StrCpy $python_location ""
...
...
@@ -285,7 +295,7 @@ Function PythonSearch
Pop $0
${If} $0 = 0
Pop $0
${StrTrimNewLines} $python_version $0
${StrTrimNewLines
2
} $python_version $0
loop:
${Explode} $0 $explodeChar $python_version
${For} $1 1 $0
...
...
@@ -315,7 +325,7 @@ Function PythonSearch
${EndIf}
Goto loopNext
CutPython:
${StrCase} $3 $2 "U"
${StrCase
2
} $3 $2 "U"
StrCmp $3 "PYTHON" loopNext
StrCpy $python_version $2
StrCpy $explodeChar '.'
...
...
@@ -335,7 +345,7 @@ Function PythonSearch
Pop $0
${If} $0 = 0
Pop $0
${StrTrimNewLines} $python_architect $0
${StrTrimNewLines
2
} $python_architect $0
DetailPrint '$(STATUS_PythonArchitectFound) $python_architectbit'
${Else}
StrCpy $found_python "false"
...
...
@@ -633,7 +643,7 @@ Function Explode
Push $explArrCount
FunctionEnd
Function StrCase
Function StrCase
2
/*After this point:
------------------------------------------
$0 = String (input)
...
...
@@ -805,7 +815,7 @@ Function StrCase
Pop $1
Exch $0
FunctionEnd
Function StrTrimNewLines
Function StrTrimNewLines
2
/*After this point:
------------------------------------------
$R0 = String (input)
...
...
@@ -868,8 +878,8 @@ Section "Uninstall"
${EndIf}
StrCmp $LANGUAGE ${LANG_HUNGARIAN} 0 +4
IfFileExists "$SMPROGRAMS\${Company}\Ltogasd meg a ${AppUrlName}-t.url" 0 +2
Delete "$SMPROGRAMS\${Company}\Ltogasd meg a ${AppUrlName}-t.url"
IfFileExists "$SMPROGRAMS\${Company}\L
�
togasd meg a ${AppUrlName}-t.url" 0 +2
Delete "$SMPROGRAMS\${Company}\L
�
togasd meg a ${AppUrlName}-t.url"
Goto +3
IfFileExists "$SMPROGRAMS\${Company}\Visit the ${AppUrlName}.url" 0 +2
Delete "$SMPROGRAMS\${Company}\Visit the ${AppUrlName}.url"
...
...
@@ -932,5 +942,6 @@ Function un.onInit
SetRegView 64
${EndIf}
!insertmacro MUI_UNGETLANGUAGE
!insertmacro MULTIUSER_UNINIT
FunctionEnd
\ No newline at end of file
src/nsi/installer/cloud.py
View file @
ed03b793
...
...
@@ -9,7 +9,9 @@ The Client job is to help the ease of use of the cloud system.
import
argparse
import
logging
import
platform
import
tempfile
from
time
import
gmtime
,
strftime
from
windowsclasses
import
ClientRegistry
...
...
@@ -49,8 +51,8 @@ def parse_arguments():
help
=
"Explicit location of the wanted logfile location and name"
,
type
=
unicode
,
default
=
(
"
%(directory)
s
\\
%(file)
s"
%
{
'directory'
:
ClientRegistry
.
directory
(),
'file'
:
'client.log'
}))
'directory'
:
tempfile
.
gettempdir
(),
'file'
:
'c
ircle_c
lient.log'
}))
args
=
parser
.
parse_args
()
return
args
...
...
src/nsi/installer/cloud_connect_from_windows.py
View file @
ed03b793
...
...
@@ -11,12 +11,13 @@ import binascii
import
glob
import
locale
import
logging
import
nxkey
import
os
import
subprocess
import
time
import
win32crypt
import
tempfile
import
nxkey
import
win32crypt
from
windowsclasses
import
ClientRegistry
...
...
@@ -76,36 +77,27 @@ def connect(vm):
subprocess
.
Popen
((
u'"
%
s"'
%
config_file
)
.
encode
(
locale
.
getpreferredencoding
()),
shell
=
True
)
elif
vm
.
protocol
==
"RDP"
:
logger
.
info
(
'RDP protocol received'
)
listdir
=
ClientRegistry
.
directory
()
+
"
\\
.rdp
\\
*.rdp"
found
=
False
logger
.
debug
(
'RDP protocol received'
)
full_address
=
"full address:s:
%
s:
%
s"
%
(
vm
.
host
,
vm
.
port
)
user
=
"username:s:
%
s"
%
vm
.
user
for
config_file
in
glob
.
glob
(
listdir
):
with
open
(
config_file
)
as
f
:
file
=
f
.
read
()
if
full_address
in
file
and
user
in
file
:
found
=
True
logger
.
info
(
'Config file found:
%
s'
,
config_file
)
break
if
not
found
:
logger
.
info
(
'No config file found, creating new one'
)
config_file
=
"
%
s
%
s
%
s"
%
((
ClientRegistry
.
directory
()
+
"
\\
.rdp
\\
"
),
str
(
int
(
time
.
time
()
*
1000
)),
".rdp"
)
password
=
binascii
.
hexlify
(
win32crypt
.
CryptProtectData
(
u"
%
s"
%
vm
.
password
,
u'psw'
,
None
,
None
,
None
,
0
))
config
=
RPD_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
f
=
open
(
config_file
,
'w'
)
f
.
write
(
config
)
f
.
close
()
logger
.
info
(
'Config file created:
%
s'
,
config_file
)
config_file
=
"
%
s
%
s"
%
(
tempfile
.
gettempdir
(),
"
\\
circle_"
+
vm
.
user
+
str
(
int
(
time
.
time
()
*
1000
))
+
".rdp"
)
logger
.
info
(
'Creating config file
%
s'
%
config_file
)
password
=
binascii
.
hexlify
(
win32crypt
.
CryptProtectData
(
u"
%
s"
%
vm
.
password
,
u'psw'
,
None
,
None
,
None
,
0
))
config
=
RPD_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
f
=
open
(
config_file
,
'w'
)
f
.
write
(
config
)
f
.
close
()
logger
.
debug
(
'Popen the config file:
%
s'
,
config_file
)
subprocess
.
Popen
((
u'"
%
s"'
%
config_file
)
.
encode
(
locale
.
getpreferredencoding
()),
shell
=
True
)
locale
.
getpreferredencoding
()),
shell
=
True
)
.
wait
()
os
.
remove
(
config_file
)
logger
.
info
(
'Client finished working'
)
NX_template
=
"""<!DOCTYPE NXClientSettings>
<NXClientSettings application="nxclient" version="1.3" >
<group name="General" >
...
...
@@ -125,4 +117,5 @@ NX_template = """<!DOCTYPE NXClientSettings>
RPD_template
=
"""username:s:
%(USERNAME)
s
full address:s:
%(HOST)
s:
%(PORT)
s
authentication level:i:0
password 51:b:
%(PASSWORD)
s"""
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment