Executing a file remotely

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hank

    Executing a file remotely

    Hi,

    I was wondering how I would execute a file remotely? For example,
    test.exe resides on machine A, my python script is running on Machine
    B. I would like to execute "test.exe -parameters" on machine A from a
    script running on machine B.

    Does anyone know how to do this easily in python?

    Thanks a lot.
    Hank
  • Ben Finney

    #2
    Re: Executing a file remotely

    On 11 Feb 2004 15:20:41 -0800, Hank wrote:[color=blue]
    > I was wondering how I would execute a file remotely?[/color]

    That depends on how you'd execute any command on a remote machine. On
    Unix systems, the preferred way these days is to use ssh:

    bignose@desktop $ ssh bignose@remotes erver 'command -with -args'

    Assuming the 'ssh' command is available on the local machine, you could
    execute the above command within the Python script using os.system():

    <http://www.python.org/doc/1.5.2p2/lib/os-process.html>

    --
    \ "I washed a sock. Then I put it in the dryer. When I took it |
    `\ out, it was gone." -- Steven Wright |
    _o__) |
    Ben Finney <http://bignose.squidly .org/>

    Comment

    • Cameron Laird

      #3
      Re: Executing a file remotely

      In article <slrnc2lf46.16j .bignose-hates-spam@rose.local domain.fake>,
      Ben Finney <bignose-hates-spam@and-benfinney-does-too.id.au> wrote:[color=blue]
      >On 11 Feb 2004 15:20:41 -0800, Hank wrote:[color=green]
      >> I was wondering how I would execute a file remotely?[/color]
      >
      >That depends on how you'd execute any command on a remote machine. On
      >Unix systems, the preferred way these days is to use ssh:
      >
      > bignose@desktop $ ssh bignose@remotes erver 'command -with -args'
      >
      >Assuming the 'ssh' command is available on the local machine, you could
      >execute the above command within the Python script using os.system():
      >
      > <http://www.python.org/doc/1.5.2p2/lib/os-process.html>[/color]

      Comment

      • Ben Finney

        #4
        Re: Executing a file remotely

        On Thu, 12 Feb 2004 00:29:42 -0000, Cameron Laird wrote:[color=blue]
        > I believe soundwave56 is focused on Windows hosts. There, the correct
        > initial answer to, "how would I execute a file remotely?" is, through
        > a security breach.[/color]

        No, the correct answer (on any operating system) is "through a
        remote-execution facility". "Security breach" is dependent on the
        security policy in place; remote execution can be a perfectly
        permissible operation, or a serious breach of security, depending on
        the specific circumstances and what the security policy allows.
        [color=blue]
        > That's a serious answer. Operating systems are not *supposed* to
        > allow "outsiders" to execute processes.[/color]

        Utter rot. Operating systems are supposed to do what the person owning
        the hardware tells them to do.

        Whether "outsiders" are allowed to execute programs on the operating
        system is entirely dependent on how you define "outsiders" . Some
        operating systems are designed to treat remote users and local users
        identically; on such systems, "outsider" is not a function of "remote or
        local", but rather "permitted or not permitted".

        On other operating systems, multiple-user and networking is a bolt-on
        afterthought, and an unnecessary line is drawn between local and remote
        users. The availability of smooth, simple remote-execution facilities
        on such operating systems will likely be poor.

        --
        \ "When a well-packaged web of lies has been sold to the masses |
        `\ over generations, the truth will seem utterly preposterous and |
        _o__) its speaker a raving lunatic." -- Dresden James |
        Ben Finney <http://bignose.squidly .org/>

        Comment

        • Hank

          #5
          Re: Executing a file remotely

          This is strictly for automated software testing on windows. Test
          scripts on one machine, application under test on another machine.
          This is why i need to run files remotely.

          I couldn't find any specific python code that would do the job, so I
          just use PsExec from www.sysinternals.com. I wouldn't consider it as a
          security breach because it does require user name and password.

          Thanks
          Hank

          Ben Finney <bignose-hates-spam@and-benfinney-does-too.id.au> wrote in message news:<slrnc2lje m.16j.bignose-hates-spam@rose.local domain.fake>...[color=blue]
          > On Thu, 12 Feb 2004 00:29:42 -0000, Cameron Laird wrote:[color=green]
          > > I believe soundwave56 is focused on Windows hosts. There, the correct
          > > initial answer to, "how would I execute a file remotely?" is, through
          > > a security breach.[/color]
          >
          > No, the correct answer (on any operating system) is "through a
          > remote-execution facility". "Security breach" is dependent on the
          > security policy in place; remote execution can be a perfectly
          > permissible operation, or a serious breach of security, depending on
          > the specific circumstances and what the security policy allows.
          >[color=green]
          > > That's a serious answer. Operating systems are not *supposed* to
          > > allow "outsiders" to execute processes.[/color]
          >
          > Utter rot. Operating systems are supposed to do what the person owning
          > the hardware tells them to do.
          >
          > Whether "outsiders" are allowed to execute programs on the operating
          > system is entirely dependent on how you define "outsiders" . Some
          > operating systems are designed to treat remote users and local users
          > identically; on such systems, "outsider" is not a function of "remote or
          > local", but rather "permitted or not permitted".
          >
          > On other operating systems, multiple-user and networking is a bolt-on
          > afterthought, and an unnecessary line is drawn between local and remote
          > users. The availability of smooth, simple remote-execution facilities
          > on such operating systems will likely be poor.[/color]

          Comment

          • Jorgen Grahn

            #6
            Re: Executing a file remotely

            On 12 Feb 2004 14:46:54 -0800, Hank <soundwave56@ya hoo.ca> wrote:[color=blue]
            > This is strictly for automated software testing on windows. Test
            > scripts on one machine, application under test on another machine.
            > This is why i need to run files remotely.
            >
            > I couldn't find any specific python code that would do the job, so I
            > just use PsExec from www.sysinternals.com. I wouldn't consider it as a
            > security breach because it does require user name and password.[/color]

            In that case you'd be better off with a good port of ssh, which encrypts
            passwords and traffic (although it probably doesn't matter much if both
            machines are on a LAN where lots of Windows passwords already travel in the
            clear).

            /Jorgen

            --
            // Jorgen Grahn <jgrahn@ ''If All Men Were Brothers,
            \X/ algonet.se> Would You Let One Marry Your Sister?''

            Comment

            • Josiah Carlson

              #7
              Re: Executing a file remotely

              > In that case you'd be better off with a good port of ssh, which encrypts[color=blue]
              > passwords and traffic (although it probably doesn't matter much if both
              > machines are on a LAN where lots of Windows passwords already travel in the
              > clear).[/color]

              NTLM and NT hashes are not plaintext, even though there are well
              documented brute-force attacks against those hashes.

              On the other hand, many web pages (or POP3, IMAP, FTP, etc.) still
              prefer to authenticate users using plain or base64 encoded passwords,
              without ssl. This is a bigger security hole than NTLM or NT hashes by a
              long shot.

              - Josiah

              Comment

              Working...