cross platform libraries

D

diffuser78

I am using python on a linux terminal.

I want to shutdown a remote windows box. I found a script which does
something like this. My question is can we use windows libraries in
linux as follows ....

import win32api
import win32con
import win32netcon
import win32security
import win32wnet

def shutdown(parameters):
OTHER CODE HERE

Every help is appreciated.
 
R

Ravi Teja

No! That's not the way things work. Such code needs to run locally (in
this case, Windows). You can run this program as a daemon on Windows
with some nice simple remote interface (Eg: xmlrpc) and send a message
to trigger the shutdown.
 
D

Dennis Lee Bieber

I am using python on a linux terminal.

I want to shutdown a remote windows box. I found a script which does
something like this. My question is can we use windows libraries in
linux as follows ....

import win32api
import win32con
import win32netcon
import win32security
import win32wnet
That set... HIGHLY UNLIKELY... They all rely upon having the M$
kernel DLLs available...

Now, if the remote box is running a telnet server, you might be able
to telnet over (logging in as the boxes admin account) and initiate a
shutdown from it... (I seem to have a "shutdown.exe" on my system).
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
D

diffuser78

Hi Ravi,

Do you have any idea how to perform such triigers ?
Every help is appreciated.
 
M

Max Erickson

(e-mail address removed) wrote in

I went to this webpage

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/360649

Isn't it supposed to run on the network and close the connected
machine.

That code uses the windows libraries on the machine it is run on to
generate a request to the networked machine to shutdown. The code
executes locally and sends the request over the network.
Every help is appreciate,

If you have some way of remotely running programs on the windows
machine(ssh, telnet, etc.), you might try pstools:

http://www.sysinternals.com/Utilities/PsTools.html

specifically, psshutdown.

max
 
D

diffuser78

Can we have some program in Linux which shuts down the windows computer
remotely.

Every help is appreciated.
 
D

Dennis Lee Bieber

I went to this webpage

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/360649

Isn't it supposed to run on the network and close the connected
machine.
Based on the use of that r"\\" prefix when putting together the
hostname, it runs using Window NT compatible "domain" notation (that's
the same notation used by Windows to "map network drive" but is NOT an
internet hostname)

Given the libraries it uses, it only runs on Windows, and only
controls other Windows machines.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
P

Philippe Martin

Through Wine maybe ?

Philippe

That set... HIGHLY UNLIKELY... They all rely upon having the M$
kernel DLLs available...

Now, if the remote box is running a telnet server, you might be able
to telnet over (logging in as the boxes admin account) and initiate a
shutdown from it... (I seem to have a "shutdown.exe" on my system).
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
R

Ravi Teja

Not much to it. Just follow the SimpleXMLRPCServer example from Python
docs and register your shutdown function. Call it using xmlrpclib
remotely.

Actually, I prefer the telnet method below. Simple and straight forward.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,206
Latest member
EpifaniaMc

Latest Threads

Top