Commit 12b655de authored by Arturo Hernandez's avatar Arturo Hernandez

working win version

parent 6ec19271
......@@ -131,3 +131,10 @@ dmypy.json
cert/
certs/
launch.exe
cleaner.exe
AGETIC_MST_installer.exe
#must load winpython from somewhere else
python-3.6.8/
\ No newline at end of file
......@@ -100,30 +100,40 @@ class ReadCardHandler(tornado.web.RequestHandler):
except OMNIKEYException as e:
LOGGER.info("Error: {}".format(e))
self.write({"error": str(e)})
else:
return
try:
atr = toHexString(card.get_ATR())
LOGGER.info('ATR: {}'.format(atr))
except OMNIKEYException as e:
LOGGER.info("Error: {}".format(e))
self.write({"error": str(e)})
return
LOGGER.info('ATR: {}'.format(atr))
try:
uid = card.get_UID()
LOGGER.info('UUIDHex: {}'.format(toHexString(uid, 1)))
atr_match = []
atr_possible = []
found = parseATR.match_atr_differentiated(atr, "src/parseATR/smartcard_list.txt")
if found:
if atr in found:
for d in found[atr]:
atr_match.append(str(d))
del found[atr]
for a in found:
for d in found[a]:
atr_possible.append(str(d))
self.write({
'reader': str(card.reader),
'ATR': atr,
'ATR_match': atr_match,
'ATR_possible': atr_possible,
'UUIDHex': toHexString(uid, 1),
'message': 'OK'
})
except OMNIKEYException as e:
LOGGER.info("Error: {}".format(e))
self.write({"error": str(e)})
return
LOGGER.info('UUIDHex: {}'.format(toHexString(uid, 1)))
atr_match = []
atr_possible = []
found = parseATR.match_atr_differentiated(atr, "src/parseATR/smartcard_list.txt")
if found:
if atr in found:
for d in found[atr]:
atr_match.append(str(d))
del found[atr]
for a in found:
for d in found[a]:
atr_possible.append(str(d))
self.write({
'reader': str(card.reader),
'ATR': atr,
'ATR_match': atr_match,
'ATR_possible': atr_possible,
'UUIDHex': toHexString(uid, 1),
'message': 'OK'
})
class IndexHandler(tornado.web.RequestHandler):
def get(self, url):
LOGGER.info("via h")
......
......@@ -1348,13 +1348,13 @@ def match_atr_differentiated(atr, atr_file=None):
"/usr/local/share/pcsc/smartcard_list.txt"]
for atr_file in db_list:
try:
file = open(atr_file)
file = open(atr_file, encoding="utf_8")
print("Using:", atr_file)
break
except:
pass
else:
file = open(atr_file)
file = open(atr_file, encoding="utf_8")
# find a . * or [ in the ATR to know if we must use a RE or not
re_match = re.compile("[\\.\\*\\[]")
......
# Instalador Win64 para AGETIC - microservicio tarjetas
Aplicaciones:
* Python3.6 Portable (WinPython3.6.8.x86)
* tornado
* pyscard (1.9.9-cp36-cp36m-win32.whl)
Requisitos:
- launcher: [autoit3](https://www.autoitscript.com/site/)
- installer: [NSIS](http://nsis.sourceforge.net/Main_Page)
## Generar Instalador! (en windows)
1. Clonar el repositorio
```sh
git -c http.sslVerify=false clone --recurse-submodules --depth=1 https://gitlab.agetic.gob.bo/agetic/microservicio-tarjetas.git
cd microservicio-tarjetas
cd win
```
2. Ejecutar `build_launcher.cmd` el cual compila mediante Autoit el script ubicado en `_setup/launcher.au3`
3. Ejecutar `build_cleaner.cmd` el cual compila mediante Autoit el script ubicado en `_setup/cleaner.au3`
4. Ejecutar `build_installer.cmd` el cual compila mediante NSIS el script ubicado en `_setup/installer.nsi`
5. el instalador se genera en la misma carpeta `AGETIC_MST_installer.exe`
6. Distribuir!
## Instalacion de la aplicación:
1. Ejecutar `agetic_mst_installer.exe`
2. Leer y Aceptar la Licencia
3. Seleccionar la carpeta de destino. Por defecto `C:\Archivos de Programa\AGETIC\MST`
4. Proceda con la instalación. Esto puede demorar unos minutos.
5. El lanzador se debería iniciar al final de la instalación
6. El lanzador también se instala en la Carpeta `Inicio` del menú `Programas` (Para ejecutarse automáticamente el reiniciar el sistema operativo)
7. El lanzador se encuentra ejecutándose en la barra de Tareas.
> Se Recomienda instalar el certificado raiz, para la conexión SSL. Desde el lanzador en la barra de tareas: `Certificado Raiz` el archivo descargado se debe agregar a los entes certificadores del explorador a usar (distintos métodos).
## Desinstalando la aplicación:
1. Se recomienda detener el lanzador:
1. Del menú en la barra de tareas: seleccionar `Salir`
2. Ir a `Programas y Características` del sistema operativo
3. Desintalar `AGETIC - MST`
4. Siga las instrucciones.
1. En caso de ser necesario, reiniciar el computador.
# Instrucciones Avanzadas
Todas estas requieren la aplicación desinstalada del sistema (o simplemente que no esté ejecutándose)
## Actualizar el launcher!
1. Ejecutar `build_launch.cmd` el cual compila el lanzador `launch.exe` mediante Aut2Exe el script ubicado en `_setup/launch.au3`
3. Regenerar el instalador con `build_installer.cmd`
4. Distribuir!
## Actualizar la aplicación
1. En caso de requerir instalar nuevos paquetes de python:
1. Opción 1:
1. abrir la consola de python `win\python-3.6.8\scripts\cmd.bat`
2. Instalar los nuevos paquetes con `pip install paquete`
1. en caso de falla, buscar un archivo de distribución WHL equivalente (por ejemplo en appveyor) e instalar con `pip install <archivo-amd64>.whl`
3. se recomienda actualizar la lista de requisitos en `win\setup_requirements.txt` con el contenido de `pip freeze`
2. Opción 2:
1. Actualizar la lista de paquetes en `win\setup_requirements.txt`
2. Ejecutar `win\setup.bat`
2. Probar las modificaciones.
1. Puede ver la consola ejecutando `win\scripts\launchapp.bat`
2. O desde la consola `win\scripts\cmd.bat` ejecutar los comandos necesarios. Por ejemplo dirigirse a la carpeta `src` y `python main.py`
3. Una vez corregido y verificado, verifique el correcto funcionamiento desde el lanzador `launch.exe`
4. Recompile el instalador `build_installer.cmd`
5. Distribuir!
## Actualizar la distribuición de Python
1. Descargar la versión de Winpython más reciente (preferentemente la versión Zero sin QT para reducir el tamaño de descarga) y descomprimir en una carpeta temporal.
2. Desde su consola, listar los paquetes con `pip freeze` y desinstalar todos los paquetes que no son necesarios (actualmente el unico paquete necesario es `six`)
3. Copiar la carpeta `python-xxxx` y reemplazar por la actual en el directorio `win`
4. Copiar y modificar los scripts de inicio de `scripts\` `cmd.bat` `cmd_ps.bat` `env.bat` `python.bat` en su respectiva carpeta del directorio `win`
1. Es necesario modificar los scripts quitando la referencia de `env_for_icons.bat` y colocando sólamente `env.bat` al inicio de los scripts...
2. el script de `launchapp.bat` no debería ser necesario de modificar
5. Probar la version ejecutando `win\scripts\cmd.bat` y luego `python`
6. Ejecutar `setup.bat` para instalar los requisitos del sistema
1. Puede que sea necesario instalar y probar los paquetes a mano.
7. Probar toda la aplicación ejecutando `win\scripts\launchapp.bat`
8. Recompile el instalador `build_installer.cmd`
9. Distribuir!
> Existen algunas carpetas adicionales de winpython que se pueden eliminar. como `Tcl` `Doc` `Demo` Verifique que realmente no sean necesarias antes de eliminarlas
>
> Se recomienda dejar las herramientas de instalación de paquetes `pip` `easy_install` `wheel` para futuras instalaciones...
\ No newline at end of file
#RequireAdmin
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
Local $nombre = "AGETIC Microservicio de Tarjetas RFID"
Local $sFilePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $nombre, "InstallLocation")
If @error Then
Exit
EndIf
$resyes = MsgBox(4,"", "Ruta es "& $sFilePath & @crlf & "Desea limpiar el registro?")
;TODO: hacer algo mas?
If $resyes Then
;Finalizar limpieando registro.... (minimo requerido para reinstalar)
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $nombre)
EndIf
\ No newline at end of file
# AGETIC sedem django portable pyhon installer
#!include x64.nsh
!include LogicLib.nsh
!include Sections.nsh
Unicode true
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Spanish.nlf"
SetCompressor /SOLID lzma
BrandingText "AGETIC 2020"
!define APPNAME "Microservicio de Tarjetas RFID"
!define COMPANYNAME "AGETIC"
!define DESCRIPTION "Servicio para comunicacion con lectores OMNI KEY HID 5022"
# These three must be integers
!define VERSIONMAJOR 1
!define VERSIONMINOR 0
!define VERSIONBUILD 0
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "https://gitlab.agetic.gob.bo/agetic/microservicio_tarjetas" # "Support Information" link
!define UPDATEURL "https://gitlab.agetic.gob.bo/agetic/microservicio_tarjetas" # "Product Updates" link
!define ABOUTURL "https://gitlab.agetic.gob.bo/agetic/microservicio_tarjetas" # "Publisher" link
# This is the size (in kB) of all the files copied into "Program Files"
!define INSTALLSIZE 7233
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
InstallDir "$PROGRAMFILES\${COMPANYNAME}\MST"
# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
LicenseData "config\LICENSE.rtf"
# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
Icon "config\favicon.ico"
outFile "AGETIC_MST_installer.exe"
!define MAINEXE32 "launch.exe"
#!define MAINEXE32_NOSSL "id_zf1_launch32.exe"
#Insttype "/CUSTOMSTRING=Seleccione"
#Insttype "Version HTTPS (TLS1.2)"
#Insttype "Version HTTP"
# Just three pages - license agreement, install location, and installation
Page license
#Page components
Page directory
Page instfiles
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Se requiere permisos de Administrador!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
!macro ChechInstalled
!define UID ${__LINE__}
Push $0 ; unistaller
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString"
StrCmp $R0 "" done_${UID}
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${APPNAME} Ya se encuentra instalado. $\n$\n Presione 'Aceptar' para remover la version anterior." IDOK uninst_${UID}
Abort
uninst_${UID}:
ClearErrors
ExecWait '$R0 _?=$INSTDIR'
IfErrors no_remove_uninstaller_${UID} done_${UID}
no_remove_uninstaller_${UID}:
MessageBox MB_OK|MB_ICONSTOP \
"No se pudo desinstalar '${APPNAME}' Cierre la aplicación antes de volver a intentarlo."
Abort
done_${UID}:
;recheck?
Pop $0
!macroend
#Section "Archivos Comunes (Requerido)"
# SectionIn RO
Section "install"
ClearErrors
# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
#setOutPath $TEMP
#File "sedem_mst.zip"
# Files added here should be removed by the uninstaller (see section "uninstall")
SetOutPath $INSTDIR
#nsisunz::Unzip "$TEMP\sedem_mst.zip" "$INSTDIR"
File /r "..\src"
File /r "..\cert"
File /r /x "_setup" /x "AGETIC_MST_installer.exe" "..\win"
File "..\cleaner.exe"
File "..\${MAINEXE32}"
# Start Menu
#createDirectory "$SMSTARTUP\${APPNAME}"
createShortCut "$SMSTARTUP\${APPNAME}.lnk" "$INSTDIR\${MAINEXE32}"
#start now!
#Exec "$INSTDIR\${MAINEXE}" #as admin
Exec '"$WINDIR\explorer.exe" "$INSTDIR\${MAINEXE32}"' #as user
# Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe"
# Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} - ${APPNAME} - ${DESCRIPTION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\win\config\favicon.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
# There is no option for modifying or repairing the install
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
SectionEnd
Function .onInit
setShellVarContext all
!insertmacro VerifyUserIsAdmin
!insertmacro ChechInstalled
#StrCpy $1 ${SEC_HTTPS}
FunctionEnd
; Function .onSelChange
; !insertmacro StartRadioButtons $1
; !insertmacro RadioButton ${SEC_HTTPS}
; #!insertmacro RadioButton ${SEC_HTTP}
; !insertmacro EndRadioButtons
; FunctionEnd
# Uninstaller
Function un.onInit
SetShellVarContext all
#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL|MB_ICONQUESTION "Desea desinstalar ${APPNAME}?" IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
FunctionEnd
Section "uninstall"
# Remove Start Menu launcher
Delete "$SMSTARTUP\${APPNAME}.lnk"
# Try to remove the Start Menu folder - this will only happen if it is empty
# rmDir "$SMPROGRAMS\${COMPANYNAME}"
ClearErrors
# Remove files
Delete "$INSTDIR\${MAINEXE32}"
#Delete "$INSTDIR\${MAINEXE32_NOSSL}"
IfErrors 0 clean_main
MessageBox MB_OK|MB_ICONSTOP "El programa se encuentra ejecutandose. Detengalo manualmente o tendra que reiniciar para completar la desinstalacion."
Delete /REBOOTOK "$INSTDIR\${MAINEXE32}" #Retry
clean_main:
# Try to remove the install directory
ClearErrors
RMDir /r "$INSTDIR\src"
RMDir /r "$INSTDIR\cert"
RMDir /r "$INSTDIR\win"
IfErrors 0 +2
MessageBox MB_OK|MB_ICONSTOP "Algunos archivos no pueden ser eliminados. reinicie para continuar"
RMDir /r /REBOOTOK "$INSTDIR\win"
IfRebootFlag 0 noreboot
MessageBox MB_YESNO "Se requiere reiniciar para completar la desinstalacion. $\n$\n Reiniciar ahora?" IDNO nrbutneed
Reboot
nrbutneed:
Abort
noreboot:
# Always delete uninstaller as the last action
Delete "$INSTDIR\uninstall.exe"
# Try to remove the install directory
RMDir /r $INSTDIR
# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
SectionEnd
\ No newline at end of file
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant.
#include <Process.au3>
Opt("TrayMenuMode", 1) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode.
_Singleton("LAUNCH_AGETIC_MST"); Run only once!
FileChangeDir(@ScriptDir); just in case
Global $pid = 0
Global $iEstado
Launcher()
Func ReRun()
If $pid > 0 Then
ConsoleWrite("reiniciando" & @CRLF)
;FileSetTime(@ScriptDir & "\app\manage.py", "")
;Return
_ProcessCloseEx($pid)
$pid = 0
EndIf
$pid = Run("win\scripts\launchapp.bat", "", @SW_HIDE)
TrayItemSetState ($iEstado, 1)
ConsoleWrite("iniciado pid:" & $pid & @CRLF)
EndFunc
Func Launcher()
ConsoleWrite("Iniciando Launcher" & @CRLF & @CRLF)
ReRun()
#Region ### START Koda GUI section ### Form=
$SplashScreenGui = GUICreate("AGETIC MST Splash", 368, 152, -1,-1,$WS_POPUP)
WinSetTrans($SplashScreenGui, "", 170)
$Pic1 = GUICtrlCreatePic("src\www\logoAgetic_c.gif", 0, 0, 368, 152)
GUISetState(@SW_SHOW,$SplashScreenGui)
Sleep(3000)
GUISetState(@SW_HIDE,$SplashScreenGui)
#EndRegion ### END Koda GUI section ###
Local $iServicio = TrayCreateMenu("Servicio") ; Create a tray menu sub menu with two sub items.
Local $iEstado = TrayCreateItem("Estado", $iServicio, -1, 1)
Local $iVisitar = TrayCreateItem("Visitar", $iServicio)
Local $iReiniciar = TrayCreateItem("Reiniciar", $iServicio)
TrayCreateItem("") ; Create a separator line.
Local $iCertificado = TrayCreateItem("Certificado Raiz")
Local $idAbout = TrayCreateItem("Acerca de")
TrayCreateItem("") ; Create a separator line.
Local $idExit = TrayCreateItem("Salir")
TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.
While 1
Switch TrayGetMsg()
Case $idAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable.
MsgBox($MB_SYSTEMMODAL, "AGETIC", "Lanzador AGETIC microservicio tarjetas." & @CRLF & @CRLF & _
"Version: " & @AutoItVersion & @CRLF & _
"Path: " & @ScriptDir) ; Find the folder of a full path.
TrayItemSetState ($idAbout, 4)
Case $iVisitar
ShellExecute("https://127.0.0.1:8000/")
TrayItemSetState($iVisitar, 4)
Case $iCertificado
; Display a save dialog to select a file.
Local $sFileSaveDialog = FileSaveDialog("Guardar certificado...", "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "Certificado (*.crt)", 16, "certificado.crt")
If @error Then
ContinueLoop
EndIf
ConsoleWrite("copiando a: " & $sFileSaveDialog & @CRLF)
If FileCopy(@ScriptDir & "\config\root-ca.crt", $sFileSaveDialog, 9) == 0 Then
MsgBox($MB_SYSTEMMODAL, "AGETIC", "No se pudo copiar el certificado.")
EndIf
TrayItemSetState ($iCertificado, 4)
Case $iEstado
If $pid > 0 Then
$reg = _ProcessGetName($pid)
MsgBox($MB_SYSTEMMODAL, "AGETIC", "El servicio esta corriendo :" & $pid & @CRLF & $reg)
TrayItemSetState ($iEstado, 1)
Else
$reg = "(no name)"
MsgBox($MB_SYSTEMMODAL, "AGETIC", "El servicio esta detenido :" & $pid & @CRLF & $reg)
TrayItemSetState ($iEstado, 4)
EndIf
Case $iReiniciar
ReRun()
MsgBox($MB_SYSTEMMODAL, "SEDEM", "El servicio se esta reiniciando.")
TrayItemSetState ($iReiniciar, 4)
Case $idExit ; Exit the loop.
If $pid > 0 Then
_ProcessCloseEx ($pid)
$pid = 0
EndIf
ExitLoop
EndSwitch
WEnd
EndFunc ;==>Launcher
Func _ProcessCloseEx($sPID)
If IsString($sPID) Then $sPID = ProcessExists($sPID)
If Not $sPID Then Return SetError(1, 0, 0)
Return Run(@ComSpec & " /c taskkill /F /PID " & $sPID & " /T", @SystemDir, @SW_HIDE)
EndFunc
\ No newline at end of file
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant.
#include <Process.au3>
Opt("TrayMenuMode", 1) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode.
_Singleton("LAUNCH_SEDEM_MST"); Run only once!
FileChangeDir(@ScriptDir); just in case
Global $pid = 0
Global $iEstado
Launcher()
Func ReRun()
If $pid > 0 Then
ConsoleWrite("reiniciando" & @CRLF)
;FileSetTime(@ScriptDir & "\app\manage.py", "")
;Return
_ProcessCloseEx($pid)
$pid = 0
EndIf
$pid = Run("py-dist32\scripts\launchapp.bat", "", @SW_HIDE)
TrayItemSetState ($iEstado, 1)
ConsoleWrite("iniciado pid:" & $pid & @CRLF)
EndFunc
Func Launcher()
ConsoleWrite("Iniciando Launcher" & @CRLF & @CRLF)
ReRun()
#Region ### START Koda GUI section ### Form=
$SplashScreenGui = GUICreate("SEDEM MST Splash", 368, 152, -1,-1,$WS_POPUP)
WinSetTrans($SplashScreenGui, "", 170)
$Pic1 = GUICtrlCreatePic("config\logoAgetic_c.gif", 0, 0, 368, 152)
GUISetState(@SW_SHOW,$SplashScreenGui)
Sleep(3000)
GUISetState(@SW_HIDE,$SplashScreenGui)
#EndRegion ### END Koda GUI section ###
Local $iServicio = TrayCreateMenu("Servicio") ; Create a tray menu sub menu with two sub items.
Local $iEstado = TrayCreateItem("Estado", $iServicio, -1, 1)
Local $iVisitar = TrayCreateItem("Visitar", $iServicio)
Local $iReiniciar = TrayCreateItem("Reiniciar", $iServicio)
TrayCreateItem("") ; Create a separator line.
Local $iCertificado = TrayCreateItem("Certificado Raiz")
Local $idAbout = TrayCreateItem("Acerca de")
TrayCreateItem("") ; Create a separator line.
Local $idExit = TrayCreateItem("Salir")
TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.
While 1
Switch TrayGetMsg()
Case $idAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable.
MsgBox($MB_SYSTEMMODAL, "SEDEM", "Lanzador SEDEM microservicio tarjetas." & @CRLF & @CRLF & _
"Version: " & @AutoItVersion & @CRLF & _
"Path: " & @ScriptDir) ; Find the folder of a full path.
TrayItemSetState ($idAbout, 4)
Case $iVisitar
ShellExecute("https://127.0.0.1:8000/api/read-card")
TrayItemSetState($iVisitar, 4)
Case $iCertificado
; Display a save dialog to select a file.
Local $sFileSaveDialog = FileSaveDialog("Guardar certificado...", "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "Certificado (*.crt)", 16, "certificado.crt")
If @error Then
ContinueLoop
EndIf
ConsoleWrite("copiando a: " & $sFileSaveDialog & @CRLF)
If FileCopy(@ScriptDir & "\config\root-ca.crt", $sFileSaveDialog, 9) == 0 Then
MsgBox($MB_SYSTEMMODAL, "SEDEM", "No se pudo copiar el certificado.")
EndIf
TrayItemSetState ($iCertificado, 4)
Case $iEstado
If $pid > 0 Then
$reg = _ProcessGetName($pid)
MsgBox($MB_SYSTEMMODAL, "SEDEM", "El servicio esta corriendo :" & $pid & @CRLF & $reg)
TrayItemSetState ($iEstado, 1)
Else
$reg = "(no name)"
MsgBox($MB_SYSTEMMODAL, "SEDEM", "El servicio esta detenido :" & $pid & @CRLF & $reg)
TrayItemSetState ($iEstado, 4)
EndIf
Case $iReiniciar
ReRun()
MsgBox($MB_SYSTEMMODAL, "SEDEM", "El servicio se esta reiniciando.")
TrayItemSetState ($iReiniciar, 4)
Case $idExit ; Exit the loop.
If $pid > 0 Then
_ProcessCloseEx ($pid)
$pid = 0
EndIf
ExitLoop
EndSwitch
WEnd
EndFunc ;==>Launcher
Func _ProcessCloseEx($sPID)
If IsString($sPID) Then $sPID = ProcessExists($sPID)
If Not $sPID Then Return SetError(1, 0, 0)
Return Run(@ComSpec & " /c taskkill /F /PID " & $sPID & " /T", @SystemDir, @SW_HIDE)
EndFunc
\ No newline at end of file
cd %~dp0
"C:\Program Files (x86)\AutoIt3\Aut2Exe\Aut2Exe.exe" /in _setup\cleaner.au3 /out ..\cleaner.exe /icon "C:\Program Files (x86)\AutoIt3\Aut2Exe\Icons\SETUP03.ICO"
pause
\ No newline at end of file
cd %~dp0
"C:\Program Files (x86)\NSIS\makensis" /NOCD _setup\installer.nsi
pause
\ No newline at end of file
cd %~dp0
"C:\Program Files (x86)\AutoIt3\Aut2Exe\Aut2Exe.exe" /in _setup\launch.au3 /out ..\launch.exe /icon config\favicon.ico
pause
\ No newline at end of file
This diff is collapsed.
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: sha256WithRSAEncryption
Issuer: DC=test, DC=agetic, O=agetic.gob.bo, OU=test AGETIC Root CA, CN=test AGETIC Root CA
Validity
Not Before: Jun 29 14:40:46 2018 GMT
Not After : Jun 28 14:40:46 2028 GMT
Subject: DC=test, DC=agetic, O=agetic.gob.bo, OU=test AGETIC Root CA, CN=test AGETIC Root CA
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:d7:e2:1f:d1:4c:9c:c7:30:c6:27:5c:87:d8:69:
2e:2a:b0:6a:e1:fd:fa:a6:cd:f2:f6:7a:47:40:e5:
19:4a:fc:90:4f:05:2b:6d:1c:3b:1c:cd:08:94:a8:
9e:df:d7:c1:1b:f5:ea:86:11:36:1c:52:f9:50:32:
0c:01:d2:78:6a:c2:3a:20:55:53:d7:01:e6:38:3b:
df:96:d4:61:ee:03:16:ab:e2:22:af:0c:ea:a4:50:
b7:87:0f:0b:6b:29:b3:d9:f2:21:ff:e7:38:c4:37:
19:19:5c:8d:92:d1:3b:8c:1f:91:3b:9d:93:39:0d:
ba:a3:97:7e:de:25:2e:f5:a2:a8:d3:e2:40:b1:9b:
54:8d:24:6a:22:f1:d6:aa:b4:94:ac:19:42:58:68:
7c:89:e9:96:dd:3a:c3:de:48:14:a3:0f:9b:56:28:
89:bf:51:18:e6:43:ac:6f:03:ba:ee:c0:8f:a2:00:
2f:22:41:3d:cc:c4:57:a7:33:7d:1a:29:9e:41:aa:
70:66:12:c2:42:01:53:06:b6:1d:94:79:93:85:c9:
b7:87:f0:49:72:d7:9a:77:2c:12:f1:c8:73:99:32:
d5:62:ee:39:f0:c5:fb:6a:3d:59:04:3d:c0:a5:10:
88:af:ef:06:5b:0b:af:3a:c8:69:43:16:5a:0e:60:
c2:95
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Subject Key Identifier:
60:08:33:C7:3D:BC:7A:84:A0:28:71:1A:2D:AC:DF:EA:35:4A:52:35
X509v3 Authority Key Identifier:
keyid:60:08:33:C7:3D:BC:7A:84:A0:28:71:1A:2D:AC:DF:EA:35:4A:52:35
Signature Algorithm: sha256WithRSAEncryption
05:34:0f:f8:eb:64:58:16:69:22:2a:c5:8f:7d:43:1c:e4:f2:
b9:03:3c:6a:9f:7f:ad:5f:86:97:b1:7c:df:99:b1:03:9a:76:
d3:75:af:65:f7:1c:83:59:d2:ec:aa:86:53:c6:4a:8a:5e:9c:
35:6e:9f:35:aa:f7:b9:22:9a:1f:df:c8:6e:4a:92:ab:b2:d8:
0e:4b:8e:59:22:f5:2c:65:ab:04:aa:7a:22:ef:ee:3d:3a:68:
a8:c8:f4:f1:5a:f6:90:87:9a:45:86:8b:2f:f0:69:61:9c:4f:
3f:1e:89:0e:64:56:aa:66:e4:41:be:d1:0f:71:9e:bb:17:08:
84:33:2f:08:c7:cd:00:00:a4:15:6b:06:3d:f9:d4:16:41:a4:
27:00:94:76:0e:fa:bc:a1:4c:52:5e:ed:70:38:34:e4:1a:4d:
56:80:ac:ce:08:b7:7c:85:35:c9:d8:02:cb:b1:63:36:b0:84:
9d:bb:23:86:05:8b:5a:03:63:4d:22:8d:44:74:39:33:1d:7a:
63:94:69:09:9d:2d:75:e6:b0:6c:79:28:54:77:c9:37:41:69:
af:de:f3:fb:75:be:cd:88:d0:22:7a:0c:ff:f9:25:d8:56:0f:
c4:38:81:b5:92:57:da:18:fe:78:40:dd:f9:c7:27:fd:51:92:
02:76:42:aa