avrama Posted May 4, 2018 Share Posted May 4, 2018 Hi all, I'm working on a customer connector in CyberArk. I want that connector to connect to a server. But when i try to connect to the target machine, i want the script to gather the PAM credentials of the account i use to get connected to target machine. However, the script is not replicating the PAM credentials and even i couldn't enter the credentials in the field areas. Any help on this would be appriciated. Thanks. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 4, 2018 Moderators Share Posted May 4, 2018 @avrama welcome to the forum. We can't do much when you don't post your script - you're asking us to first guess at what you're doing and then troubleshoot for you. How about posting what you have and helping us help you "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
avrama Posted May 8, 2018 Author Share Posted May 8, 2018 PSMABCDispatcher.pdf Link to comment Share on other sites More sharing options...
avrama Posted May 8, 2018 Author Share Posted May 8, 2018 1 minute ago, avrama said: As per the script, when i use a certain PAM account to connect to a server. The connection component calls the scripts and it should grab the PAM credentials and pass on to the target machine login page. But, it isn't passing on the credentials nor i could enter the credentials. It freezes upon showing the dialogue box/login page and give me an error (PSMSR606E, PSMSR605E) which says "Error occurred while waiting for the dispatcher to communicate / Timeout occurred while waiting for a specific component to end. PSMABCDispatcher.pdf Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 8, 2018 Moderators Share Posted May 8, 2018 @avrama that pdf is a mess. Please use the code tags (<> in the tool bar) when you post code. That way you get a nicely formatted code box that people can actually read. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
avrama Posted May 8, 2018 Author Share Posted May 8, 2018 expandcollapse popup#include <IE.au3> #AutoIt3Wrapper_UseX64=n Opt("MustDeclareVars", 1) AutoItSetOption("WinTitleMatchMode", 2) ; EXACT_MATCH! ;============================================================ ; PSM AutoIt Dispatcher Skeleton ; ------------------------------ ; ; Use this skeleton to create your own ; connection components integrated with the PSM. ; Areas you may want to modify are marked ; with the string "CHANGE_ME". ; ; Created : April 2013 ; Cyber-Ark Software Ltd. ;============================================================ #include "PSMGenericClientWrapper.au3" ;======================================= ; Consts & Globals ;======================================= Global Const $DISPATCHER_NAME = "PSMABCDispatcher" ; CHANGE_ME Global Const $LOGIN_WEBPAGE = "web url" ; CHANGE_ME Global Const $CLIENT_EXECUTABLE = "c:\Program Files (x86)\Internet Explorer\iexplore.exe " & $LOGIN_WEBPAGE ; CHANGE_ME Global Const $ERROR_MESSAGE_TITLE = "PSM " & $DISPATCHER_NAME & " Dispatcher error message" Global Const $LOG_MESSAGE_PREFIX = $DISPATCHER_NAME & " Dispatcher - " Global $TargetUsername Global $TargetPassword Global $TargetAddress Global $ConnectionClientPID = 0 Global $oIE ;======================================= ; Code ;======================================= Exit Main() ;======================================= ; Main ;======================================= Func Main() ; Init PSM Dispatcher utils wrapper ToolTip ("Initializing...") if (PSMGenericClient_Init() <> $PSM_ERROR_SUCCESS) Then Error(PSMGenericClient_PSMGetLastErrorString()) EndIf LogWrite("successfully initialized Dispatcher Utils Wrapper") ; Get the dispatcher parameters FetchSessionProperties() LogWrite("starting client application") ToolTip ("Starting " & $DISPATCHER_NAME & "...") $oIE = _IECreate($LOGIN_WEBPAGE, 0, 0) ; Remove the zeros if not hardening HardenIE() _IEAction($oIE, "visible") ; Get the IE Handle ID dim $hndl = _IEPropertyGet($oIE, "hwnd") $ConnectionClientPID = WinGetProcess($hndl) ;$ConnectionClientPID = Run($CLIENT_EXECUTABLE) if ($ConnectionClientPID == 0) Then Error(StringFormat("Failed to execute process [%s]", $CLIENT_EXECUTABLE, @error)) EndIf ; Send PID to PSM as early as possible so recording/monitoring can begin LogWrite("sending PID to PSM") if (PSMGenericClient_SendPID($ConnectionClientPID) <> $PSM_ERROR_SUCCESS) Then Error(PSMGenericClient_PSMGetLastErrorString()) EndIf ;_IELinkClickByText($oIE, "Continue to this website (not recommended).") ; ------------------ ; Handle login here! ; CHANGE_ME ; ------------------ Local $o_form = _IEFormGetObjByName ($oIE, "logonForm") ;Local $o_Form = _IEFormGetCollection ($oIE, 0) Local $o_user = _IEFormElementGetObjByName ($o_form, "j_username") Local $o_password = _IEFormElementGetObjByName ($o_form, "j_password") Local $o_signin = _IEFormElementGetObjByName ($o_form, "Login") ; Set field values and submit the form _IEFormElementSetValue ($o_user, $TargetUsername) _IEFormElementSetValue ($o_password, $TargetPassword) _IEAction ($o_signin, "click") ; Terminate PSM Dispatcher utils wrapper LogWrite("Terminating Dispatcher Utils Wrapper") PSMGenericClient_Term() Return $PSM_ERROR_SUCCESS EndFunc ;================================== ; Functions ;================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: Error ; Description ...: An exception handler - displays an error message and terminates the dispatcher ; Parameters ....: $ErrorMessage - Error message to display ; $Code - [Optional] Exit error code ; =============================================================================================================================== Func Error($ErrorMessage, $Code = -1) ; If the dispatcher utils DLL was already initialized, write an error log message and terminate the wrapper if (PSMGenericClient_IsInitialized()) Then LogWrite($ErrorMessage, True) PSMGenericClient_Term() EndIf Local $MessageFlags = BitOr(0, 16, 262144) ; 0=OK button, 16=Stop-sign icon, 262144=MsgBox has top-most attribute set MsgBox($MessageFlags, $ERROR_MESSAGE_TITLE, $ErrorMessage) ; If the connection component was already invoked, terminate it if ($ConnectionClientPID <> 0) Then ProcessClose($ConnectionClientPID) $ConnectionClientPID = 0 EndIf Exit $Code EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: LogWrite ; Description ...: Write a PSMWinSCPDispatcher log message to standard PSM log file ; Parameters ....: $sMessage - [IN] The message to write ; $LogLevel - [Optional] [IN] Defined if the message should be handled as an error message or as a trace messge ; Return values .: $PSM_ERROR_SUCCESS - Success, otherwise error - Use PSMGenericClient_PSMGetLastErrorString for details. ; =============================================================================================================================== Func LogWrite($sMessage, $LogLevel = $LOG_LEVEL_TRACE) Return PSMGenericClient_LogWrite($LOG_MESSAGE_PREFIX & $sMessage, $LogLevel) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: PSMGenericClient_GetSessionProperty ; Description ...: Fetches properties required for the session ; Parameters ....: None ; Return values .: None ; =============================================================================================================================== Func FetchSessionProperties() ; CHANGE_ME if (PSMGenericClient_GetSessionProperty("Username", $TargetUsername) <> $PSM_ERROR_SUCCESS) Then Error(PSMGenericClient_PSMGetLastErrorString()) EndIf if (PSMGenericClient_GetSessionProperty("Password", $TargetPassword) <> $PSM_ERROR_SUCCESS) Then Error(PSMGenericClient_PSMGetLastErrorString()) EndIf if (PSMGenericClient_GetSessionProperty("Address", $TargetAddress) <> $PSM_ERROR_SUCCESS) Then Error(PSMGenericClient_PSMGetLastErrorString()) EndIf EndFunc Func SetIEProperty($sProperty, $nValue) dim $oIE if(_IEPropertySet($oIE, $sProperty, $nValue) <> 0) Then Error(StringFormat("WebFormDispatcher: Failed to set IE property [%s] to [%s] (Extra details: %d, %d)", $sProperty, $nValue, @error, @extended)) EndIf EndFunc Func HardenIE() SetIEProperty("fullscreen", 1) SetIEProperty("theatermode", 1) SetIEProperty("toolbar", 0) SetIEProperty("menubar", 0) SetIEProperty("Addressbar", 0) EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now