First commit
This commit is contained in:
commit
ef4ee4c38a
11 changed files with 496 additions and 0 deletions
6
.gitattributes
vendored
Normal file
6
.gitattributes
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
*.ps1 diff
|
||||||
|
*.cmd diff
|
||||||
|
*.ini diff
|
||||||
|
*.txt diff
|
||||||
|
*.svg diff
|
||||||
|
*.conf diff
|
111
assets/avatar.svg
Normal file
111
assets/avatar.svg
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="90"
|
||||||
|
height="90"
|
||||||
|
viewBox="0 0 90.000001 90.000001"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="avatar.svg"
|
||||||
|
inkscape:export-filename="/home/ephase/Documents/Projets/Code/powershell.PersonnalHelpdesk/res/avatar.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90">
|
||||||
|
<defs
|
||||||
|
id="defs4">
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient4175">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#17bbe1;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop4177" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#0f768f;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop4179" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient4175"
|
||||||
|
id="linearGradient4181"
|
||||||
|
x1="109.04489"
|
||||||
|
y1="954.77094"
|
||||||
|
x2="15.805369"
|
||||||
|
y2="1048.4626"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(0,-8)" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="3.959798"
|
||||||
|
inkscape:cx="46.539868"
|
||||||
|
inkscape:cy="50.599728"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
units="px"
|
||||||
|
borderlayer="true"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:snap-page="true"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
inkscape:bbox-paths="true"
|
||||||
|
inkscape:bbox-nodes="true"
|
||||||
|
inkscape:snap-bbox-edge-midpoints="true"
|
||||||
|
inkscape:snap-bbox-midpoints="true"
|
||||||
|
inkscape:window-width="1280"
|
||||||
|
inkscape:window-height="736"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="27"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:snap-global="false" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Calque 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-962.36216)">
|
||||||
|
<path
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#linearGradient4181);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:8.69999981;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.63492067;marker:none;enable-background:accumulate"
|
||||||
|
d="m 45.271484,970.44224 a 26.078413,26.078413 0 0 0 -26.080078,26.07816 26.078413,26.078413 0 0 0 26.080078,26.0781 26.078413,26.078413 0 0 0 26.078125,-26.0781 26.078413,26.078413 0 0 0 -26.078125,-26.07816 z m -11.1875,52.57426 c -14.92337,0 -27.7311761,8.7128 -33.6542965,21.3457 l 89.1406245,0 c -5.923727,-12.6329 -18.732879,-21.3457 -33.65625,-21.3457 l -21.830078,0 z"
|
||||||
|
id="rect3336"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#f09900;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.0999999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
|
||||||
|
d="m 45.029297,967.0731 0,0.002 c -8.974094,-0.0572 -17.958489,2.41603 -24.757812,7.54492 -6.33265,4.77687 -10.7201773,11.92006 -11.2558597,21.22848 -0.7220794,0.1376 -1.265625,0.768 -1.265625,1.5312 0,0.8646 0.6978627,1.5625 1.5625,1.5625 l 0.7792967,0 a 8.8893294,8.8893294 0 0 0 4.064453,5.8496 l 9.31836,14.7248 12.261718,0 c 0.2548,0.614 0.859817,1.0429 1.56836,1.0429 l 3.21289,0 c 0.939822,0 1.697266,-0.7555 1.697266,-1.6954 0,-0.9398 -0.757444,-1.6973 -1.697266,-1.6973 l -3.21289,0 c -0.747133,0 -1.371913,0.482 -1.59961,1.1504 l -11.570312,0 -7.982422,-12.6152 a 8.8893294,8.8893294 0 0 0 0.916016,0.2441 c 0.360348,0.7518 1.123191,1.2735 2.015625,1.2735 1.240569,0 2.238281,-0.9997 2.238281,-2.2403 l 0,-15.87881 c 0,-1.24057 -0.997712,-2.23828 -2.238281,-2.23828 -1.058662,0 -1.93581,0.72865 -2.171875,1.71289 a 8.8893294,8.8893294 0 0 0 -5.042969,3.14649 c 1.359035,-6.55124 4.923396,-11.59878 9.787109,-15.26758 6.302239,-4.75393 14.820077,-7.13646 23.359375,-7.08203 8.539299,0.0544 17.073626,2.54598 23.404297,7.35351 4.86251,3.69261 8.442762,8.71559 9.845703,15.16016 a 8.8893294,8.8893294 0 0 0 -5.177734,-3.31055 c -0.236065,-0.98424 -1.11126,-1.71289 -2.169922,-1.71289 -1.240569,0 -2.240234,0.99771 -2.240234,2.23828 l 0,15.87881 c 0,1.2406 0.999665,2.2403 2.240234,2.2403 0.892434,0 1.653324,-0.5217 2.013672,-1.2735 a 8.8893294,8.8893294 0 0 0 6.978515,-7.0039 l 0.779297,0 c 0.864638,0 1.560547,-0.6979 1.560547,-1.5625 0,-0.7061 -0.468019,-1.2925 -1.109375,-1.4863 -0.6167,-9.12704 -5.017811,-16.20638 -11.330078,-20.99994 -6.815534,-5.17574 -15.807155,-7.76312 -24.78125,-7.82031 z"
|
||||||
|
id="path4147"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<rect
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.20000005;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
|
||||||
|
id="rect4187"
|
||||||
|
width="90"
|
||||||
|
height="24.496199"
|
||||||
|
x="0"
|
||||||
|
y="1027.866" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 5.9 KiB |
148
buildscript.ps1
Normal file
148
buildscript.ps1
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
param([string]$appconf="", [string]$hotliners="")
|
||||||
|
#PS build script for PersonnalHelpDesk
|
||||||
|
#
|
||||||
|
#Version 0.1
|
||||||
|
|
||||||
|
$VERSION = "0.1"
|
||||||
|
$WORKING_DIR = Split-Path -path $($MyInvocation.MyCommand.Definition)
|
||||||
|
$BUILD_DIR = $WORKING_DIR + "\build"
|
||||||
|
$UTILS_DIR = $WORKING_DIR + "\utils"
|
||||||
|
$TMP_DIR = $WORKING_DIR + "\tmp"
|
||||||
|
$SRC_DIR = $WORKING_DIR + "\src"
|
||||||
|
$PS_EXEC_NAME = "launcher.exe"
|
||||||
|
$FINAL_EXEC_NAME = "helpdesk.exe"
|
||||||
|
|
||||||
|
$VNC_URL = "http://www.uvnc.com/component/jdownloads/finish/5-bins/295-ultravnc-1210-all-bin-zip/0.html"
|
||||||
|
$PS2EXE_URL = "https://gallery.technet.microsoft.com/PS2EXE-Convert-PowerShell-9e4e07f1/file/134627/1/"
|
||||||
|
$7Z_URL = "http://www.7-zip.org/a/7za920.zip"
|
||||||
|
$7ZSFX_URL = "http://7zsfx.info/files/7zsd_160_2712.7z"
|
||||||
|
|
||||||
|
function create_dir {
|
||||||
|
param([string]$dir)
|
||||||
|
if (Test-Path $dir){
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
New-Item $dir -type directory | Out-Null
|
||||||
|
return $true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function extract{
|
||||||
|
param(
|
||||||
|
[string]$dest_path,
|
||||||
|
[string]$zip_path
|
||||||
|
)
|
||||||
|
$shell = new-object -com Shell.Application
|
||||||
|
Try {
|
||||||
|
$shell.NameSpace($dest_path).CopyHere($zip_path) | Out-Null
|
||||||
|
Write-Host -ForegroundColor Green "done"
|
||||||
|
}
|
||||||
|
Catch {
|
||||||
|
Write-Host -ForegroundColor Red " Error "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function download_util{
|
||||||
|
param(
|
||||||
|
[string]$util,
|
||||||
|
[string]$source,
|
||||||
|
[string]$file_to_extract
|
||||||
|
)
|
||||||
|
create_dir "$UTILS_DIR\$VERSION\$util"
|
||||||
|
Write-Host -ForegroundColor white -NoNewline "Downloading $util please wait ... "
|
||||||
|
Try {
|
||||||
|
(New-Object System.Net.WebClient).DownloadFile($source,"$TMP_DIR\$util.zip")
|
||||||
|
}
|
||||||
|
Catch {
|
||||||
|
Write-Host -ForegroundColor Red " Error bad URL? "
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Write-Host -ForegroundColor Green -NoNewline "done"
|
||||||
|
if ($file_to_extract -ne "false"){
|
||||||
|
Write-Host -ForegroundColor white -NoNewLine " ... extracting : "
|
||||||
|
extract "$UTILS_DIR\$VERSION\$util\" "$TMP_DIR\$util.zip\$file_to_extract"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( -Not $appconf -Or -Not (Test-Path $appconf) ){
|
||||||
|
Write-Host -ForegroundColor White "Application configuration file $appconf not found, using default"
|
||||||
|
$appconf = "$SRC_DIR\res\conf\app.conf.ps1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( -Not $hotliners -Or -Not (Test-Path $hotliners) ){
|
||||||
|
Write-Host -ForegroundColor White "Application configuration file $hotliners not found, using default"
|
||||||
|
$hotliners = "$SRC_DIR\res\conf\hotliners.conf.ps1"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (-not (create_dir $BUILD_DIR)){
|
||||||
|
Remove-Item $BUILD_DIR\* -recurse
|
||||||
|
}
|
||||||
|
create_dir $UTILS_DIR | Out-Null
|
||||||
|
create_dir $TMP_DIR | Out-Null
|
||||||
|
if ( create_dir $UTILS_DIR\$VERSION ) {
|
||||||
|
#then download VNC + PS2EXE
|
||||||
|
download_util "vnc" $VNC_URL "win7\winvnc.exe"
|
||||||
|
download_util "ps2exe" $PS2EXE_URL "*"
|
||||||
|
download_util "7z" $7Z_URL "7za.exe"
|
||||||
|
(New-Object System.Net.WebClient).DownloadFile($7ZSFX_URL,"$TMP_DIR\7zsd.7z")
|
||||||
|
cmd -ArgumentList @("/c", "$UTILS_DIR/$VERSION/7z/7za.exe", "e", "$TMP_DIR\7zsd.7z", "7zsd.sfx","-o$UTILS_DIR/$VERSION/", "-y")
|
||||||
|
}
|
||||||
|
|
||||||
|
#applying personnal parameters
|
||||||
|
$patched_source = @()
|
||||||
|
Get-Content $SRC_DIR\helpdesk.ps1 | ForEach-Object {
|
||||||
|
switch ($_) {
|
||||||
|
{$_ -match "app.conf.ps1"} {
|
||||||
|
ForEach ($line in Get-Content $appconf) {
|
||||||
|
$patched_source += $line
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
{$_ -match "hotliners.conf.ps1"} {
|
||||||
|
ForEach ($line in Get-Content $hotliners){
|
||||||
|
$patched_source += $line
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
default{$patched_source += $_}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$patched_source | Set-Content $BUILD_DIR\helpdesk.ps1 -Encoding "UTF8"
|
||||||
|
# Build executable from our PS script
|
||||||
|
Invoke-Expression "$UTILS_DIR\$VERSION\ps2exe\ps2exe.ps1 $BUILD_DIR\helpdesk.ps1 $BUILD_DIR\$PS_EXEC_NAME -noconsole -nested"
|
||||||
|
Remove-Item $BUILD_DIR\$PS_EXEC_NAME.config
|
||||||
|
Set-Location $WORKING_DIR
|
||||||
|
|
||||||
|
# Copy all file to build Dir
|
||||||
|
create_dir $BUILD_DIR\res\ | Out-Null
|
||||||
|
Copy-Item $SRC_DIR\UltraVNC.ini $BUILD_DIR\res\
|
||||||
|
Copy-Item $SRC_DIR\res\* $BUILD_DIR\res\
|
||||||
|
Copy-Item $UTILS_DIR\$VERSION\vnc\winvnc.exe $BUILD_DIR\res\
|
||||||
|
|
||||||
|
create_dir $BUILD_DIR\res\conf\ | Out-Null
|
||||||
|
if ($appconf -ne "") {
|
||||||
|
$txtfile = Get-Content $appconf
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$txtfile = Get-Content $BUILD_DIR\res\conf\app.conf.ps1
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($hotliners -ne "") {
|
||||||
|
Copy-Item $hotliners $BUILD_DIR\res\conf\hotliners.conf.ps1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Copy-Item $SRC_DIR\res\conf\hotliners.conf.ps1 $BUILD_DIR\res\conf\hotliners.conf.ps1
|
||||||
|
}
|
||||||
|
|
||||||
|
#Zip all elements
|
||||||
|
Set-Location $BUILD_DIR
|
||||||
|
cmd -ArgumentList @("/c", "$UTILS_DIR/$VERSION/7z/7za.exe", "a", "installer.7z", "*")
|
||||||
|
|
||||||
|
#copy file for autoSFX archive.
|
||||||
|
Copy-Item $WORKING_DIR\src\config.txt $BUILD_DIR\
|
||||||
|
Copy-Item $UTILS_DIR\$VERSION\7zsd.sfx $BUILD_DIR\
|
||||||
|
|
||||||
|
#concatenate binary files for creating ou auto-SFX file
|
||||||
|
cmd -ArgumentList @("/c", "copy", "/b","7zsd.sfx", "+", "config.txt", "+", "installer.7z", $FINAL_EXEC_NAME)
|
||||||
|
#Remove-Item $BUILD_DIR -recurse
|
12
make.cmd
Normal file
12
make.cmd
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
@echo off
|
||||||
|
REM Make.cmd
|
||||||
|
REM --------
|
||||||
|
REM Helpdesk.exe build script for PernonnalHelpdesk
|
||||||
|
cd /d "%~dp0"
|
||||||
|
echo .
|
||||||
|
echo Launch build powershell script ...
|
||||||
|
powershell -ExecutionPolicy Bypass "%~dp0buildscript.ps1"
|
||||||
|
|
||||||
|
REM Exemple of build script with personnal parameters
|
||||||
|
REM powershell -ExecutionPolicy Bypass "%~dp0buildscript.ps1" -appconf ".\personnal_conf\app.conf.ps1" -hotliners ".\personnal_conf\hotliners.conf.ps1"
|
||||||
|
PAUSE
|
69
src/UltraVNC.ini
Normal file
69
src/UltraVNC.ini
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
[Permissions]
|
||||||
|
[admin]
|
||||||
|
FileTransferEnabled=1
|
||||||
|
FTUserImpersonation=1
|
||||||
|
BlankMonitorEnabled=1
|
||||||
|
BlankInputsOnly=0
|
||||||
|
DefaultScale=1
|
||||||
|
UseDSMPlugin=0
|
||||||
|
DSMPlugin=No Plugin Detected
|
||||||
|
primary=1
|
||||||
|
secondary=0
|
||||||
|
SocketConnect=0
|
||||||
|
HTTPConnect=0
|
||||||
|
AutoPortSelect=1
|
||||||
|
InputsEnabled=1
|
||||||
|
LocalInputsDisabled=0
|
||||||
|
IdleTimeout=0
|
||||||
|
EnableJapInput=0
|
||||||
|
QuerySetting=2
|
||||||
|
QueryTimeout=10
|
||||||
|
QueryAccept=0
|
||||||
|
LockSetting=0
|
||||||
|
RemoveWallpaper=1
|
||||||
|
RemoveEffects=0
|
||||||
|
RemoveFontSmoothing=0
|
||||||
|
RemoveAero=1
|
||||||
|
DebugMode=0
|
||||||
|
Avilog=0
|
||||||
|
path=C:\Users\tech\Desktop\win7
|
||||||
|
DebugLevel=10
|
||||||
|
AllowLoopback=1
|
||||||
|
LoopbackOnly=0
|
||||||
|
AllowShutdown=1
|
||||||
|
AllowProperties=1
|
||||||
|
AllowEditClients=1
|
||||||
|
FileTransferTimeout=30
|
||||||
|
KeepAliveInterval=5
|
||||||
|
IdleInputTimeout=0
|
||||||
|
DisableTrayIcon=0
|
||||||
|
rdpmode=0
|
||||||
|
MSLogonRequired=0
|
||||||
|
NewMSLogon=0
|
||||||
|
ConnectPriority=0
|
||||||
|
UseRegistry=0
|
||||||
|
kickrdp=0
|
||||||
|
service_commandline=
|
||||||
|
AuthRequired=1
|
||||||
|
AuthHosts=
|
||||||
|
PortNumber=5900
|
||||||
|
HTTPPortNumber=5800
|
||||||
|
QueryIfNoLogon=0
|
||||||
|
clearconsole=0
|
||||||
|
accept_reject_mesg=
|
||||||
|
[UltraVNC]
|
||||||
|
passwd=D1495AE77835039EA9
|
||||||
|
passwd2=47F0AE72FB5DE16CFC
|
||||||
|
[poll]
|
||||||
|
TurboMode=1
|
||||||
|
PollUnderCursor=0
|
||||||
|
PollForeground=0
|
||||||
|
PollFullScreen=1
|
||||||
|
OnlyPollConsole=0
|
||||||
|
OnlyPollOnEvent=0
|
||||||
|
EnableDriver=0
|
||||||
|
EnableHook=1
|
||||||
|
EnableVirtual=0
|
||||||
|
SingleWindow=0
|
||||||
|
SingleWindowName=
|
||||||
|
MaxCpu=40
|
6
src/config.txt
Normal file
6
src/config.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
;!@Install@!UTF-8!
|
||||||
|
Title="ACAQB Helpdesk V0.1A"
|
||||||
|
GUIMode="1"
|
||||||
|
BeginPrompt="Vous allez demander une prise de contrôle, voulez-vous continuer?"
|
||||||
|
ExecuteFile="launcher.exe"
|
||||||
|
;!@InstallEnd@!
|
123
src/helpdesk.ps1
Normal file
123
src/helpdesk.ps1
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
|
||||||
|
[reflection.assembly]::LoadWithPartialName( "System.Windows.Forms") | Out-Null
|
||||||
|
#$ErrorActionPreference = "SilentlyContinue"
|
||||||
|
$VERSION = "0.1"
|
||||||
|
|
||||||
|
. .\res\conf\app.conf.ps1
|
||||||
|
. .\res\conf\hotliners.conf.ps1
|
||||||
|
|
||||||
|
#Variables
|
||||||
|
$buttons = @()
|
||||||
|
$Global:vnc_process = @()
|
||||||
|
|
||||||
|
function start_vnc_session {
|
||||||
|
param([string]$port)
|
||||||
|
$Global:vnc_process = Start-Process res\$VNC_EXEC -ArgumentList ("-connect","$VNC_CLIENT_ADDR::$port","-run") -PassThru
|
||||||
|
$label.text = $MSG_VNC_STARTED
|
||||||
|
}
|
||||||
|
|
||||||
|
function disable_buttons {
|
||||||
|
$buttons | ForEach {
|
||||||
|
$_.Enabled = $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( -Not (Test-Path res\$VNC_EXEC)){
|
||||||
|
Write-Host -ForegroundColor Red "Error : VNC executable not found, exiting"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
$hotliners | Foreach {
|
||||||
|
$current_btn = New-Object Windows.Forms.Button
|
||||||
|
$current_btn.text = $_.name
|
||||||
|
$current_btn.Tag = @{port=$_.port} #Tag=@{Script=$script}
|
||||||
|
$current_btn.height = $DEFAULT_BTN_HEIGHT
|
||||||
|
$current_btn.Width = $DEFAULT_BTN_WIDTH
|
||||||
|
$current_btn.FlatStyle = "Flat"
|
||||||
|
if ($USE_AVATAR) {
|
||||||
|
$current_btn.TextAlign = $HOTLINER_BTN_TEXEALIGN
|
||||||
|
$current_btn.ForeColor = $HOTLINER_BTN_FORECOLOR
|
||||||
|
if ($_.img){
|
||||||
|
$file = Get-Item($_.img)
|
||||||
|
if (Test-Path $_.img ){
|
||||||
|
$file = Get-Item($_.img)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$file = Get-Item("res\avatar.png")
|
||||||
|
Write-Host -ForegroundColor Yellow "$($_.img) not found, using default image for $($_.name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$file = Get-Item("res\avatar.png")
|
||||||
|
}
|
||||||
|
Try {
|
||||||
|
$current_btn.BackgroundImage = [system.drawing.image]::FromFile($file)
|
||||||
|
}
|
||||||
|
Catch { Write-Host -ForegroundColor Red "Error : can't load $file, is this an image?" }
|
||||||
|
}
|
||||||
|
$current_btn.add_click({
|
||||||
|
start_vnc_session $this.Tag.port
|
||||||
|
disable_buttons
|
||||||
|
})
|
||||||
|
$buttons += $current_btn
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Application window definition
|
||||||
|
$window= New-Object Windows.Forms.Form
|
||||||
|
$window.text = $WINDOW_TITLE
|
||||||
|
$window.autosize = $true
|
||||||
|
$window.AutoSizeMode = "GrowAndShrink"
|
||||||
|
$window.FormBorderStyle = "FixedDialog"
|
||||||
|
$window.ControlBox = $false
|
||||||
|
$window.Padding = $DEFAULT_MARGIN
|
||||||
|
$window.StartPosition = "CenterScreen"
|
||||||
|
$window.icon = "res\icon.ico"
|
||||||
|
|
||||||
|
# ControlBox containing label and Buttons
|
||||||
|
$ctrlbox = New-Object Windows.Forms.GroupBox
|
||||||
|
$ctrlbox.Location = New-Object Drawing.Point $DEFAULT_MARGIN,$DEFAULT_MARGIN
|
||||||
|
$ctrlbox.AutoSize=$true
|
||||||
|
$ctrlbox.Width = $DEFAULT_WINDOW_WIDTH
|
||||||
|
$ctrlbox.Height = $DEFAULT_MARGIN
|
||||||
|
$window.controls.add($ctrlbox)
|
||||||
|
|
||||||
|
$xpos = $DEFAULT_MARGIN
|
||||||
|
$ypos = $DEFAULT_MARGIN * 2
|
||||||
|
$label = New-Object Windows.Forms.Label
|
||||||
|
$label.Height = 40
|
||||||
|
$label.Width = $DEFAULT_WINDOW_WIDTH - $DEFAULT_MARGIN * 2
|
||||||
|
$label.Location = New-Object Drawing.Point $xpos,$ypos
|
||||||
|
$label.text = $MSG_HOME
|
||||||
|
$ctrlbox.controls.add($label)
|
||||||
|
|
||||||
|
$ypos = $label.Bottom + $DEFAULT_MARGIN
|
||||||
|
$xpos = $DEFAULT_MARGIN
|
||||||
|
|
||||||
|
$buttons | ForEach {
|
||||||
|
$t = $xpos + $_.Width + $DEFAULT_MARGIN
|
||||||
|
if ($t -ge $DEFAULT_WINDOW_WIDTH) {
|
||||||
|
$ypos += ( $DEFAULT_BTN_HEIGHT + $DEFAULT_MARGIN )
|
||||||
|
$xpos = $DEFAULT_MARGIN
|
||||||
|
}
|
||||||
|
$_.Location = New-Object Drawing.Point $xpos,$ypos
|
||||||
|
$xpos += $_.Width + $DEFAULT_MARGIN
|
||||||
|
$ctrlbox.controls.add($_)
|
||||||
|
}
|
||||||
|
|
||||||
|
$btnClose = New-Object Windows.Forms.Button
|
||||||
|
$btnClose.text = "Quitter"
|
||||||
|
$btnClose.Top = $ctrlbox.Bottom + $DEFAULT_MARGIN
|
||||||
|
$btnClose.Left = $ctrlbox.Right - $btnClose.Width
|
||||||
|
$btnClose.BackColor = "#ffaa99"
|
||||||
|
$btnClose.FlatStyle = "Flat"
|
||||||
|
$window.controls.add($btnClose)
|
||||||
|
|
||||||
|
$btnClose.add_click({
|
||||||
|
if ($Global:vnc_process) {
|
||||||
|
$Global:vnc_process | Stop-Process
|
||||||
|
}
|
||||||
|
$window.hide()
|
||||||
|
})
|
||||||
|
$window.ShowDialog() | Out-Null
|
BIN
src/res/avatar.png
Normal file
BIN
src/res/avatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
17
src/res/conf/app.conf.ps1
Normal file
17
src/res/conf/app.conf.ps1
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
$VNC_EXEC = "winvnc.exe"
|
||||||
|
$VNC_CLIENT_ADDR = ""
|
||||||
|
|
||||||
|
#Textual information
|
||||||
|
$WINDOW_TITLE = "Robco Personnal Helpdesk v.$VERSION"
|
||||||
|
$MSG_VNC_STARTED = "Hotliner get the control, please leave keyboard and mouse"
|
||||||
|
$MSG_HOME = "Welcome to our helpdesk program, which technician do you have on phone?"
|
||||||
|
|
||||||
|
# Interface Constants
|
||||||
|
$DEFAULT_MARGIN = 10
|
||||||
|
$DEFAULT_WINDOW_WIDTH = 300
|
||||||
|
$DEFAULT_WINDOW_HEIGHT = 0
|
||||||
|
$DEFAULT_BTN_HEIGHT = 90
|
||||||
|
$DEFAULT_BTN_WIDTH = 90
|
||||||
|
$USE_AVATAR = 1
|
||||||
|
$HOTLINER_BTN_FORECOLOR = "#FFFFFF"
|
||||||
|
$HOTLINER_BTN_TEXEALIGN = "BottomCenter"
|
4
src/res/conf/hotliners.conf.ps1
Normal file
4
src/res/conf/hotliners.conf.ps1
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
$hotliners = (
|
||||||
|
@{name = "John Doe"; port = "5500"; img = ""},
|
||||||
|
@{name = "Marty Mc Fly"; port = "5501"; img = ""}
|
||||||
|
)
|
BIN
src/res/icon.ico
Normal file
BIN
src/res/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 KiB |
Reference in a new issue