At 05:41  12/3/01 +0900, Eung-ju Park wrote:
>Here is ugly hack for kill phoenix. :-)

;)

Well we actually used to have something similar but unfortunately we had to
remove it for security purposes. What we need is some way to make it so
that only "trusted" clients could shut it down. 

I have wanted to do something like the following for a while. In this case
anyone with the "seed" file could communicate. So your scripts would
communicate using the same key and you should be fine.

m_digest = MessageDigest.getInstance("SHA");
FileInputStream ins = new FileInputStream(filename);
int i = 0;
byte buffer[] = new byte[200];

while( (i=ins.read(buffer)) != -1 )
{
  m_digest.update(buffer,0,i);
}

m_digest.digest();

...

BufferedReader br = new BufferedReader(new InputStreamReader(new
DigestInputStream(m_socket.getInputStream(), m_digest) ) );
          
String data = br.readLine();

if( !data.equals( CHALLENGE ) )
{
  System.out.println("Bad Challenge by " + 
                     otherIp + " at " + (new Date()) );
  m_socket.close();
  return;
}

//otherwise continue with shutdown
m_serverApplication.stop();
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to