Solved

finger command

Posted on 1998-08-03
6
405 Views
Last Modified: 2012-06-27
Is it possible to send a finger command via a Perl script?  What I'd like to do is send the command and then display the results in a web browser.
0
Comment
Question by:bsufs
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1208978
`finger $user`
0
 
LVL 5

Expert Comment

by:ecw
ID: 1208979
$res = `finger "$user"`;

0
 
LVL 2

Expert Comment

by:shchuka
ID: 1208980
If you want a really technical question, you can open the socket connection to the
intended host, send a query, receive a reply and display it.  This way you can customize the error messages.  Finger port is 79.
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 1

Accepted Solution

by:
tim_lbi earned 200 total points
ID: 1208981
You may use something like this:
open(F,"|/usr/bin/finger bla");
print STDOUT <F>;
close(F);

0
 
LVL 6

Expert Comment

by:alamo
ID: 1208982
Doesn't
   open(F,"|/usr/bin/finger bla");
open a pipe *to* finger (which is wrong), not a pipe from finger to capture its results?

Not to mention that
 print STDOUT <F>;
is a bad way to print the results of the finger to the browser, since the results could contain characters such as < > and & which have special meanings in html and thus need to be translated into the html equivalents, e.g.
 $res =~ s/</&lt;/g;
0
 
LVL 1

Expert Comment

by:tim_lbi
ID: 1208983
print STDOUT <F> was just an example.
while(<F>)
{ $_ =~ s/</&lt;/g; $_=~ s/>/&gt;/g; print "Line: $_"; }
You may do what you want with the output...
The part with 'pipe to finger' is a bit strange...What you write to F is STDIN on finger, and what you read from F is STDOUT of finger. The pipe is 2 way communication...

Tim
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question