Tags:
create new tag
, view all tags

Question

I need a means by which to dynamically include the output of a command (ie: "whois") in a TWiki page.

Is it possible to do this for any shell-level command?

For example, we have a list of domains we own - I'd like to provide a WHOIS output (filtered) on another page when selected.

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Missing functionality

-- ForrestAldrich - 19 Jul 2005

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

i think there is a plugin that will allow you do run arbitary shell commands (although this is incredibly insecure).

I think you are best off writing a simple little plugin that will get the call the application that you need...

-- SvenDowideit - 19 Jul 2005

I'm wanting to include the output of the "whois" command on certain domains. Probably parsed, then pretty-printed in TWiki (after I get it working). I don't know perl, but I suppose it's feasible a call to Net::Whois or something might be useful therein.

-- ForrestAldrich - 20 Jul 2005

If there is a web site that provides the output then NetgrepPlugin might work for you.

-- MartinCleaver - 20 Jul 2005

I know of no website providing free WHOIS queries. Our registrar is joker.com, and I'd like to parse different fields (Expiration, etc) and tabulate those into a formatted table. The one I have is done manually.

-- ForrestAldrich - 20 Jul 2005

Two options:

1. Write an standalone cgi script that returns the whois info, and %INCLUDE{}% that into your TWiki topic

2. Write a small Plugin, or call a handleWhois function in the DefaultPlugin's commonTagsHandler. Untested code:

$_[0] =~ s/%WHOIS{(.*?)}%/handleWhois($1)/ge;= 

The handleWhois funtions filters the parameter for security, calls whois and returns the result. Untested code:

sub handleWhois
{
    my( $theParams ) = @_;
    my $param = TWiki::Func::extractNameValuePair( $theParams );
    $param =~ s/[^[a-zA-Z0-9\.]]//g;
    my $result = `whois $param`;
    # filter result if needed
    return $result;
}

You could post a WhoisPlugin in the Plugins web if you create the Plugin smile

-- PeterThoeny - 21 Jul 2005

 
Topic revision: r6 - 2005-07-21 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.