Miss123 has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I am new to Perl, as it seems it may help me make a program I am needing. I'm not entirely sure if this is the best language to program this specific program. If not, give me a suggestion please. Anyway, I would like the program to do this: -Type in an IP address in a box. -Click the check button -And it checks if a certain program is running or installed on any computer with that IP Address. That is all. I need it as an administrative tool to test if someone is using certain hacks on a game. (Simple, popular, installed ones) Is this possible in Perl? Is it too hard for a beginner? I am using Windows Vista

Replies are listed 'Best First'.
Re: How do I make this?
by aaron_baugher (Curate) on Feb 26, 2012 at 19:15 UTC

    This isn't at all hard, but it may be impossible. There are two ways you can tell if a program is running on a remote system:

    1. Login to the system (a standard login on Unix, perhaps some kind of remote admin on Windows) and see what programs are running. Obviously this requires that you have (at least) login access to the system, which it doesn't sound like you have.

    2. If the program you're checking for listens for network connections on a particular port, you can connect to that port and talk to it, and see if it responds the way you expect. See Net::Telnet for one possible tool to use for this.

    If neither of those things is true, you can't do it. If I give you my IP address, you can't somehow scan it from the outside and see if I'm running Emacs, for example. But you could see if I'm running a web server on port 80 or a DNS server on port 53.

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.

Re: How do I make this?
by repellent (Priest) on Feb 26, 2012 at 20:23 UTC
    Hi Miss123, and welcome to PerlMonks! :-)

    Short answer: look at PsTools of Sysinternals. It is a dedicated tool for remote administrative tasks on Windows systems, and is probably closest to what you need. PsExec allows you to execute processes remotely, whereas PsList gives detailed information of already-running processes.

    Even with these tools, you may find the need to do some extra processing. Perl is a great glue language that can interact with PsTools so you can do more, like verifying and acting on the output results.

      Is this possible in Perl? ... I am using Windows Vista

    Yes, this is possible using Perl. I say this based on the general description of your requirements. Don't take my word for it, the best way is to jump in and try out Perl to get familiar. Since you're on Windows, you can try installing either of the two Perl flavors: Strawberry Perl or ActivePerl. But before you do that, please read on...

      Is it too hard for a beginner?

    Being new to Perl, you will definitely need to spend time learning the language, and to use modules to help with achieving your specific tasks. If in the future you see yourself needing to perform many more customized tasks (i.e. not provided by readily downloadable utility programs on the Internet), then by learning Perl you will reap immense benefits in the long term.
Re: How do I make this?
by marto (Cardinal) on Feb 26, 2012 at 18:48 UTC

    For clarification is the game in question one you've created yourself or are you simply trying to query what's installed/running on a remote computer which you don't have a login to?

Re: How do I make this?
by GrandFather (Saint) on Feb 26, 2012 at 21:06 UTC

    To augment repellent's reply a little:

    Is it too hard for a beginner?

    Yes! But you needn't stay a beginner forever. repellent gave you some excellent links for learning Perl, but don't expect to solve this particular problem overnight.

    However, if you make a start toward writing a script for this you can always come back to us and ask for help in making it work.

    True laziness is hard work
Re: How do I make this?
by JavaFan (Canon) on Feb 26, 2012 at 21:24 UTC
    I'm not entirely sure if this is the best language to program this specific program.
    You mention "best", but which measurement are you using? Best speed wise? (Nope, don't use Perl). Best memory usage? (Nope, don't use Perl). Runs on all the important platforms? (Nope, don't use Perl). Has the most coders available on the jobmarket? (Nope, don't use Perl) Has the best type checking at compile time? (Nope, don't use Perl) Uses as little "line noise" as possible? (Nope, don't use Perl) Went through a standardization process? (Nope, don't use Perl) Is never the butt of Internet jokes? (Nope, don't use Perl) Is used by all the cool kids? (Nope, don't use Perl) Comes with a GUI build in the language? (Nope, don't use Perl) Is a child of the 21st century? (Nope, don't use Perl) Doesn't show UNIX heritage? (Nope, don't use Perl) Has Unicode support that just works? (Nope, don't use Perl) Has threads build in, instead of bolted on? (Nope, don't use Perl) Everything is an object? (Nope, don't use Perl)

    Frankly, I cannot give you any reason why you should use Perl. But if Perl suits your mind set, by all means, use it.

      Now I wonder what language would fit your requirements.

      It most definitely isn't the-machine-that-goes-ping Java, still deeply rooted in the 1980's. Not speaking about the fact that quite a few requirements are either nonsensical or ill defined.
      "Best speed wise?" Which speed? Development or runtime? And keep in mind that in both cases it depends a lot on the task and the developer(s).
      "Runs on all the important platforms?" Important to whom? And what are actually the platforms Perl doesn't run on? Some smartphones?
      "Uses as little "line noise" as possible?" Yes, we all know that "ASSIGN FIVE TIMES AVERAGE_SALLARY TO MAXIMAL_MANAGERS_SALARY" is preferable.
      "Comes with a GUI build in the language?" Beg your pardon? I guess you do not mean a GUI for the developer, right? Because that's not the matter of a language, but rather its implementation, besides there are several GUIs for Perl development. On the other hand you can't mean GUI as a library to create graphical applications because ... frankly that's a matter of libraries and most, if not all, languages have several of those. Which a Java fan should be well aware of thanks to the mess of Java GUI libraries. So what is it you meant?
      "Everything is an object?" I never understood why would that be a good thing, but then ... there's no pleasing the OO purists.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

        Now I wonder what language would fit your requirements.
        This isn't about my requirements. This is about the OPs requirements, which where stated as "best", without giving any indication what "best" means.

        I never ever waste time wondering whether a language is "best for the task". Good enough will do. I my pick of a language for a specific task is likely to be a different one for someone else.