cross platform libraries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • diffuser78@gmail.com

    #1

    cross platform libraries

    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(parame ters):
    OTHER CODE HERE

    Every help is appreciated.

  • Ravi Teja

    #2
    Re: cross platform libraries

    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.

    Comment

    • diffuser78@gmail.com

      #3
      Re: cross platform libraries

      Hi Ravi,

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


      Ravi Teja wrote:[color=blue]
      > 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.[/color]

      Comment

      • diffuser78@gmail.com

        #4
        Re: cross platform libraries

        I went to this webpage



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

        Every help is appreciate,


        Dennis Lee Bieber wrote:[color=blue]
        > On 4 May 2006 09:57:15 -0700, diffuser78@gmai l.com declaimed the
        > following in comp.lang.pytho n:
        >[color=green]
        > > 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
        > >[/color]
        > 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.e xe" on my system).
        > --
        > Wulfraed Dennis Lee Bieber KD6MOG
        > wlfraed@ix.netc om.com wulfraed@bestia ria.com
        > HTTP://wlfraed.home.netcom.com/
        > (Bestiaria Support Staff: web-asst@bestiaria. com)
        > HTTP://www.bestiaria.com/[/color]

        Comment

        • Max Erickson

          #5
          Re: cross platform libraries

          diffuser78@gmai l.com wrote in
          news:1146836899 .678804.168000@ g10g2000cwb.goo glegroups.com:
          [color=blue]
          > I went to this webpage
          >
          > http://aspn.activestate.com/ASPN/Coo.../Recipe/360649
          >
          > Isn't it supposed to run on the network and close the connected
          > machine.[/color]

          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.
          [color=blue]
          > Every help is appreciate,
          >[/color]

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



          specifically, psshutdown.

          max

          Comment

          • diffuser78@gmail.com

            #6
            Re: cross platform libraries

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

            Every help is appreciated.


            Max Erickson wrote:[color=blue]
            > diffuser78@gmai l.com wrote in
            > news:1146836899 .678804.168000@ g10g2000cwb.goo glegroups.com:
            >[color=green]
            > > I went to this webpage
            > >
            > > http://aspn.activestate.com/ASPN/Coo.../Recipe/360649
            > >
            > > Isn't it supposed to run on the network and close the connected
            > > machine.[/color]
            >
            > 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.
            >[color=green]
            > > Every help is appreciate,
            > >[/color]
            >
            > 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[/color]

            Comment

            • Philippe Martin

              #7
              Re: cross platform libraries

              Through Wine maybe ?

              Philippe


              Dennis Lee Bieber wrote:
              [color=blue]
              > On 4 May 2006 09:57:15 -0700, diffuser78@gmai l.com declaimed the
              > following in comp.lang.pytho n:
              >[color=green]
              >> 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
              >>[/color]
              > 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.e xe" on my system).
              > --
              > Wulfraed Dennis Lee Bieber KD6MOG
              > wlfraed@ix.netc om.com wulfraed@bestia ria.com
              > HTTP://wlfraed.home.netcom.com/
              > (Bestiaria Support Staff: web-asst@bestiaria. com)
              > HTTP://www.bestiaria.com/[/color]

              Comment

              • Ravi Teja

                #8
                Re: cross platform libraries

                Not much to it. Just follow the SimpleXMLRPCSer ver 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.

                Comment

                Working...