local interpreter remote machines

Discussion in 'Python' started by hokieghal99, Jan 5, 2004.

  1. hokieghal99

    hokieghal99 Guest

    This may not be possible, but I thought I'd ask anyway. Could I get the
    below code to run on a Python server where other machines would connect
    to it (say thru the Web) and get details of *their* system instead of
    the system details of the machine that the interpreter is running on?
    Any ideas?

    Thanks!!!

    import os
    import socket

    x = os.uname()
    y = socket.gethostbyaddr(x[1])
    print
    print "This is the connecting machine's os:", x[0]
    print "This is the connecting machine's os version:", x[2]
    print "This is the connecting machine's IP address:", y[2]
    print
     
    hokieghal99, Jan 5, 2004
    #1
    1. Advertising

  2. hokieghal99

    Paul Rubin Guest

    hokieghal99 <> writes:
    > This may not be possible, but I thought I'd ask anyway. Could I get
    > the below code to run on a Python server where other machines would
    > connect to it (say thru the Web) and get details of *their* system
    > instead of the system details of the machine that the interpreter is
    > running on? Any ideas?


    In general, what you're asking for is called OS fingerprinting. It's
    an active topic in security research. Figuring out a remote system's
    OS is the first step towards breaking into it, so there's a slow but
    growing effort among OS implementers to thwart attempts at
    fingerprinting.

    In simple cases, though, you can do stuff like connect to the remote
    IP address's port 80 and see if you can get any HTTP server headers to
    examine, and stuff like that.

    OS's also leave inadvertent fingerprints, like the "randomly
    generated" TCP sequence numbers which have detectable statistical
    patterns on some systems. If you can detect such a pattern, that
    often lets you identify the remote OS.
     
    Paul Rubin, Jan 5, 2004
    #2
    1. Advertising

  3. hokieghal99 wrote:

    > This may not be possible, but I thought I'd ask anyway. Could I get the
    > below code to run on a Python server where other machines would connect
    > to it (say thru the Web) and get details of *their* system instead of
    > the system details of the machine that the interpreter is running on?
    > Any ideas?


    If you also have Python running on the other machine,
    you can do this very easily with Pyro: http://pyro.sourceforge.net
    (no network programming necessary at all).

    Essentially you create an object on the remote machine that contains
    a method with the code you want to execute, and you call that object
    -using Pyro- as if it was located on your own computer.

    But this only works if you have a supported Python version running
    on the remote machine, and that you are allowed to connect to that
    machine over the network.

    You can even create some python code on your local machine, and
    actually submit that to the other machine, let it deal with it,
    and then get the results back.
    But only do this if you know that no unauthorised user can do this,
    because this is a security risk.

    --Irmen de Jong.
     
    Irmen de Jong, Jan 5, 2004
    #3
  4. hokieghal99

    hokiegal99 Guest

    Irmen de Jong wrote:
    > hokieghal99 wrote:
    >
    >> This may not be possible, but I thought I'd ask anyway. Could I get
    >> the below code to run on a Python server where other machines would
    >> connect to it (say thru the Web) and get details of *their* system
    >> instead of the system details of the machine that the interpreter is
    >> running on? Any ideas?

    >
    >
    > If you also have Python running on the other machine,
    > you can do this very easily with Pyro: http://pyro.sourceforge.net
    > (no network programming necessary at all).
    >
    > Essentially you create an object on the remote machine that contains
    > a method with the code you want to execute, and you call that object
    > -using Pyro- as if it was located on your own computer.
    >
    > But this only works if you have a supported Python version running
    > on the remote machine, and that you are allowed to connect to that
    > machine over the network.
    >
    > You can even create some python code on your local machine, and
    > actually submit that to the other machine, let it deal with it,
    > and then get the results back.
    > But only do this if you know that no unauthorised user can do this,
    > because this is a security risk.
    >
    > --Irmen de Jong.


    Thank you, this is exactly what I was looking for!
     
    hokiegal99, Jan 5, 2004
    #4
  5. hokiegal99 wrote:

    > Irmen de Jong wrote:
    > [...about Pyro...]
    > Thank you, this is exactly what I was looking for!


    While Pyro may be of help (I'm sure it will be ;-) you
    should not forget that there are many other ways to do
    what you want.
    For instance, you could also create a simple web server
    application on the remote machine that has a page on which
    those data about the remote machine are written.
    You can then get the data from the web page using the
    urllib module.

    For really good advice you will have to tell a lot
    more about what you want exactly (and how it should work)...

    Good luck!

    --Irmen
     
    Irmen de Jong, Jan 5, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vladimír Kolesnik

    Unable remote debugging on two Win XP machines

    Vladimír Kolesnik, Jul 29, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    403
    Vladimír Kolesnik
    Jul 29, 2004
  2. Shafter
    Replies:
    1
    Views:
    3,356
    bruce barker
    Jan 7, 2005
  3. yoda
    Replies:
    0
    Views:
    317
  4. George Flaherty
    Replies:
    1
    Views:
    379
  5. Replies:
    3
    Views:
    773
    Ziga Seilnacht
    Jan 3, 2007
Loading...

Share This Page