|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
||||||||
|
||||||||
|
Process waitFor Exit Value
Getting exit value on this:
JAVA Code:
Check the lines that have the adCmd initialization. If I run this from the command line it works with following output: LOG Code:
Notepad then opens... The only thing I can think of is that on the command line it is waiting for me to enter my PIN number, while I do not have the option to do that in my Java app. Any ideas what that error code is, or how to fix the issue? Basically, how do you execute Windows commands in Java that require user input? thanks, SK Last edited by scryptKiddy : April 30th, 2008 at 03:07 PM. |
|
#2
|
||||
|
||||
|
Quote:
Get the input first, then pass the input to the process. ~
__________________
Yawmark class Sig{public static void main(String...args){\u0066or(int \u0020$:"vÌÈÊ\"¤¾Àʲ¬Æ\"v¤Î¤\"²¤¨¸¬Æ".to\u0043h\u0061rArray() )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>> +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}} |
|
#3
|
|||||
|
|||||
|
Thanks Yawmark, however, no luck
I took an easy approach and just added my own PIN to the end, in this case I took the adCmd and appended it from this: ... JAVA Code:
to this: The problem is that the smartcard pin is not an acceptable argument when executing of "runas /smartcard whatever...". I receive a prompt that requests my PIN after the first part executes. So if I typed: "runas /smartcard %WINDIR%\system32\notepad.exe 01234" on the command line it errors out saying "Invalid RunAS USAGE". The current logic is this: 1. execute runas with smartcard optoin 2. execute complete 3. smartcard option requests user input 4. smartcard option receives input 5. smartcard option unlocks privateKey from smartcard with input 6. private key validated with smartcard option, returns success 7. success allows runas to execute notepad.exe "as" the smartcard user So I need to somehow capture the "request for INPUT" that comes back from the /smartcard option, and THEN ask the user for their input...but how do I do that? It would almost be the same as if I executed a vb / perl / php script, that halfway through execution wanted user input. Hope that makes sense... SK |
|
#4
|
||||
|
||||
|
You can also capture the input/output streams of the Process, but it seems to me like you're actually going about this the hard (not easy) way. There are SmartCard I/O APIs available; you may want to check it out.
![]() ~ |
|
#5
|
|||
|
|||
|
Hey Yawmark, thanks for the reply,
Please do not follow the smartcard logic, my basic question I'm trying to answer is how to prompt user for input when the EXECUTABLE that Java is running (in this case it happens to be the runas command) wants it. Lets say I wanted to run a perl script from java, and the perl script prompted for user input, how would I do that? What if it was a batch file, what if it was a vb script file, or a Windows executable like above? ...see where I'm going? No API's or anything really needed, I just wanna know how to tell Java to listen for a "request for input" regardless of what language / program is requiring it and allow user to input something, and send it back. But it doesn't seem to me that the Runtime.exec method allows for interactive (capturing input from user) DURING execution.... and it should, just wish I knew how thoughts? SK |
|
#6
|
||||
|