I am trying to pass a password into a Windows executable (simulating user input). Whenever I try to do that I get "no console available for secure input". The executable is an ORACLE executable called cdxdbi.
I am trying to call it like this:
CDXDBI.exe < params
where params is a file containing the password. Without the paramters the executable brings up a cmd terminal prompting for the password (twice).
How can I inject parameters into the terminal? I do not have more information on the exe, unfortunately. Anyone had the same issue and can provide a solution?
Best regards,
Sebastian
Assuming the following
CDXDBI is a console based application
The password prompt is the first and second line reads of stdin
Something like this might work
(
echo Password
echo Password
)| CDXDBI.exe
Otherwise, you will have to use one an external tool like mentioned in the comments.
Related
I am getting error when calling OS command for Peoplecode using EXEC function.
The call is like this
CommitWork();
&ShellCommand = "/path/mytest.sh param1 param2";
&ReturnCode = Exec(&ShellCommand, %Exec_Synchronous + %FilePath_Absolute);
The &ShellCommand is built using the path, executable and parameters
to be passed as shown above. That command works fine when executed
independently.
I keep getting error 255. Is there anything about the syntax? Does anybody have a tested or working example or any suggestion?
Thank you guys for responding. The command was running fine from shell scripts but not from Peoplesoft. It turned out that the current folder on the application server was not correct. So I added a CD command as the first line in the shell script to change current folder to the correct folder. That worked.
Thanks again.
the syntax looks correct.
I use similar code to call bat files.
Exec("C:\windows\system32\cmd.exe /c C:\Test\mybat.bat param1 param2", %Exec_Synchronous+%FilePath_Absolute);
Have you tried with an absolute path instead of a relative path?
error code 255 seems to be an out of range error code.
see http://tldp.org/LDP/abs/html/exitcodes.html
I would check the assumptions that you're making.
Is the same username running the shell script, your username vs the app server username?
Is the environment set up the same way for the app server username vs your username?
file permissions
I am running few scripts in powershell and cmd through windows scheduler. I have to provide my credentials and access keys in both the cmd and powershell scripts.
Is there anyway where I can provide my credentials through parameters like in Continous integration Tools? or any other way?
ex:
SET Username=Usrnme
Set Password=pswd //shouldn't be visible
curl.exe --basic --u usrnme:pswd -X get "https:www.google.com" -k
I don't want everybody who has access to the system to view the username and password.
Please suggest.
Here are your options:
Put the user name and password in a file and read it into batch script variables using for /f command
If you not using "simple filesharing" (= home edition versions of windows) you can set security so only one specific user has access to a password file or leave it in batch script and make that file's security so only one specific user has access.
Any text you are passing on a curl command line it is visible to any process while your curl.exe process is running. Another task can list running tasks eg from command prompt wmic process where ^(name^="curl.exe"^) get commandline would show it. I don't know how to obscure that.
You can use the Powershell Credential Manager to safely store the password on local computer. Then you can add the parameter to the script that represents credential target. See the example here
In the cmd prompt, is there a command I can run to display the password of the currently logged in user?
My usage scenario is this. I have an arbitrary bat script that runs 3 programs sequentially:
REM do some work
foo.exe
REM do some more work
Half way through foo.exe, it prompts for the current user's password before continuing. This defeats the purpose of scripting, which is automation because after kicking off the script, I must check back half way to enter the password.
Solution 1:
Hard code the password into script and pipe it.
REM do some work
echo hard.coded.password | foo.exe
REM do some more work
This approach has 2 problems right away:
Putting pwd in a bat file is insecure.
Others can't run the script because each has a different pwd.
So ideally, I'd like to do:
REM do some work
command-that-prints-current-user-pwd-to-output | foo.exe
REM do some more work
This way, password is not hard coded in the script, therefore making it more safe and shareable.
Thanks
No you can't. Only the user knows the password. Windows doesn't.
Passwords are one way hashed and the hash is stored not the password. Being one way it can't be reversed. When you enter a password it is hashed and the hashes compared.
I'm I new to batch file creation, I am trying to open a application and log in. To check what parameter the application accepts I used:
start "C:\Program Files\Bitvise SSH Client" BvSsh.exe -h
As part of the return the following are accepted(along with others):
-host=""
-user=""
-password=""
-loginOnStartup
I am not sure how to utilise these to actually login to the program? How would the batch file be structured?
Something like this:
#ECHO OFF
C:\Program Files\Bitvise SSH Client\BvSsh.exe -user="<enter the username>" -password="<enter password>"
But usually it's not a good idea to store passwords as plain text in bat files...
I don't know the program you are using. Possibly you'll have to add -loginOnStartup at the end of the line. Also I don't know whether the parameter host is optional or not. However, just add the parameters if needed:
#ECHO OFF
C:\Program Files\Bitvise SSH Client\BvSsh.exe -host="<enter host here>" -user="<enter the username>" -password="<enter password>" -loginOnStartup
I am trying to open notepad on remote machine using WMIC command
C:\Users\raj.kamal>WMIC /node:192.168.0.104 process call create 'cmd.exe /c notepad.exe'
ERROR:
Description = Access is denied.
I am already logged on to remote machine but I don't why this error is coming.
When I try to pass username and password using WMIC Command, it throws "Invalid Global switch" error.
WMIC /username:Raj /Password:"Dummy D" /node:192.168.0.104 process call create 'cmd.exe /c notepad.exe'
Can anyone suggest how to handle this error?
I think insteas of /username should be /user. Then use:
If password is literally "Dummy D" including surrounding double quotes:
WMIC /user:Raj /Password:"Dummy D" /node:192.168.0.104 process call ...
If password is literally Dummy D without surrounding double quotes but with a space:
WMIC /user:Raj /Password:Dummy^ D /node:192.168.0.104 process call ...
To be honest, I don't know how to spell a password containing a space character (ASCII 0x20) as a command line parameter - neither in CLI nor in a batch script.
Although I don't like the word impossible, this is the case...
More in excellent Christopher84's comments on passwords and spaces. Summarizing: "As a general rule, do not try to put spaces into passwords! Same goes for usernames, computernames and other unique, human readable identifiers".
You can't run programs with a GUI on remote machines.
From Help
The Create WMI class method creates a new process. A fully-qualified path must be specified in cases where the program to be launched is not in the search path of Winmgmt.exe. If the newly created process attempts to interact with objects on the target system without the appropriate access privileges, it is terminated without notification to this method.
For security reasons the Win32_Process.Create method cannot be used to start an interactive process remotely.