RE: Help needed -- Net::telnet gives errors
I am also working on a project that requires passing a password via the web, and obviously did not want to do so URL encoded with GET. My suggestions: A. Use CGI.pm's param() method to get your form data. I second Carl's question as to why you would manually parse the form data when you can get all of the form data into a hash by simply doing use CGI; my $query = new CGI; my %formvalues = $query->Vars; B. The way I went about the password issue without using GET, or even a POST with hidden fields (better but still not ideal), is to use CGI::Session to generate a unique session ID once the username and password are authenticated. Now I use the session ID in hidden fields where I can, URL encoded using GET where I have to, but the username and password are not being passed around insecurely. The CGI::Session docs are pretty decent on the examples, so you shouldn't have much trouble with it. You can also use the generated session ID as a cookie and fake statefulness that way. Your solution may require more effort because you are using a telnet session and authenticating that way, where I'm just authenticating against either .htaccess files or MySQL columns, so you've got another link in the chain there. But then again telnet passes username/password in plain ascii, so we're back to the security issue on that end of it. Have you considered initiating an SSH session rather than a telnet session? Just a thought... Scot R. inSite -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Carl Jolley Sent: Saturday, June 14, 2003 7:29 PM To: ashish srivastava Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Help needed -- Net::telnet gives errors On Sat, 14 Jun 2003, ashish srivastava wrote: > Hi Ibrahim > Thanks for ur help ! > I am able to connect to the UNIX server using Prompt=>'/[\w]$-/' (the login > being the user id with which the person has logged in eg. "tom-" ). But 1 > more prob. > i have an application in which this perl script is being called by an HTML > form (the usual Login screen ) and the login pwd is passed to the perl > script > > This is my code for the HTML form > == > > > Login Screen > > > User Log in Screen > > action="/cgi-bin/telp.pl" method="GET" > > > User id : > > > Password : > > Value="Submit" > > > > > > > > And this is the Perl code > > > use CGI; > use CGI::Carp qw(fatalsToBrowser); > use Net::Telnet(); > print "Content-type:text/html\n\n"; > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); > @pairs = split(/&/,$buffer); > print " @pairs \n"; > $j=0; > foreach $pair (@pairs) { > ($name, $value) = split(/=/, $pair); > $value =~ tr/+/ /; > #($dummy,$name)= split(/?/,$name); > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > $FORM{$name} = $value; > $info[$j]= $value; > $j++; > } > > > $t = new Net::Telnet (Timeout => 10, Prompt > =>'/-/i',input_log=>'D:\server\logs\inputlog.txt'); > $t->open("xxx..xxx.xxx") or die "Server not found \n"; > $t->login($usr, $pwd); > @lines = $t->cmd("ls -l"); > foreach $temp(@lines) > { > print "$temp"; > } > > ==> The problem is that when i clik submit in the login screen, it dosent > paas the usrname nad pswd to the perl prog. I dont understand why this is > happening. > Please help. > It's because you said the method was GET but you tried to retreive the value from the form as though the method was POST. When the method is GET the form values are passed via the $ENV{QUERY_STRING}. I strongly suggest that the GET method NOT be used when you are passing a password unless you only want to keep the password secret from those who don't know how to view/source on an HTML page. Also why are you "hand-parsing" the form input anyway when the CGI module has already done it for you? [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs BEGIN:VCARD VERSION:2.1 N:Robnett;Scot FN:Scot Robnett ORG:inSite Internet Solutions NOTE;ENCODING=QUOTED-PRINTABLE:Low cost web hosting, 50 MB disk space, easy and intuitive browser-based pag= e builder and control panel, 2000 product shopping cart, contact management,= site promotion, and free tech support:=0D=0A=0D=0A http://www.mawebcenters.= com/insite2000 TEL;WORK;VOICE:(815) 206-2907 TEL;CELL;VOICE:(815) 790-9687 ADR;WORK;ENCODING=QUOTED-PRINTABLE:;;Square West Center=0D=0A454 W. Jackson St.;Woodstock;IL;60098;United Sta
RE: Help needed -- Net::telnet gives errors
On Sat, 14 Jun 2003, ashish srivastava wrote: > Hi Ibrahim > Thanks for ur help ! > I am able to connect to the UNIX server using Prompt=>'/[\w]$-/' (the login > being the user id with which the person has logged in eg. "tom-" ). But 1 > more prob. > i have an application in which this perl script is being called by an HTML > form (the usual Login screen ) and the login pwd is passed to the perl > script > > This is my code for the HTML form > == > > > Login Screen > > > User Log in Screen > > action="/cgi-bin/telp.pl" method="GET" > > > User id : > > > Password : > > Value="Submit" > > > > > > > > And this is the Perl code > > > use CGI; > use CGI::Carp qw(fatalsToBrowser); > use Net::Telnet(); > print "Content-type:text/html\n\n"; > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); > @pairs = split(/&/,$buffer); > print " @pairs \n"; > $j=0; > foreach $pair (@pairs) { > ($name, $value) = split(/=/, $pair); > $value =~ tr/+/ /; > #($dummy,$name)= split(/?/,$name); > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > $FORM{$name} = $value; > $info[$j]= $value; > $j++; > } > > > $t = new Net::Telnet (Timeout => 10, Prompt > =>'/-/i',input_log=>'D:\server\logs\inputlog.txt'); > $t->open("xxx..xxx.xxx") or die "Server not found \n"; > $t->login($usr, $pwd); > @lines = $t->cmd("ls -l"); > foreach $temp(@lines) > { > print "$temp"; > } > > ==> The problem is that when i clik submit in the login screen, it dosent > paas the usrname nad pswd to the perl prog. I dont understand why this is > happening. > Please help. > It's because you said the method was GET but you tried to retreive the value from the form as though the method was POST. When the method is GET the form values are passed via the $ENV{QUERY_STRING}. I strongly suggest that the GET method NOT be used when you are passing a password unless you only want to keep the password secret from those who don't know how to view/source on an HTML page. Also why are you "hand-parsing" the form input anyway when the CGI module has already done it for you? [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Reverse of Chomp..(regarding not chomping)
On Fri, 13 Jun 2003, George Gallen wrote: > Possibly in some cases, yes. In my case no. While > yes by creating a second working array which is > chomped would be fine, except for the additional > memory needed to hold the second array. That also > assumes that the array contents won't change from > when it was chomped to when I need to join it back, > which in my case, will happen, so by not chomping > in the first place (if you mean by keeping a working > array and chomping that one). Otherwise it would take > more coding (for my application) to constantly ignore > the tailing \n on each element. > The terminal $ in a regex will match either the end of the string OR the \n at the end of a string. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
win32::api & CoCreateInstance
I am having trouble figuring out the input parameter list for the CoCreateInstance function. I am a Unix guru who is new to Windows programming. This is what I garnered from msdn: STDAPI CoCreateInstance( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv ); But this is greek to me, even with the further explanation provided by Microsoft at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedcom/html/cerefCoCreateInstance.asp How would I represent the input parameter list with the win32::api module? I looked at the win32::api docs, which were helpful, but I am still not sure that I am doing things right. Here is my code: use Win32::API; $CoCreateInstance = new Win32::API('ole32', 'CoCreateInstance', 'SPNSP', 'I'); if(not defined $CoCreateInstance) { die "Can't import API CoCreateInstance: $!\n"; } As you can see, 'SPNSP' is what I came up with. It is an intelligent guess on my part. Am I right? How can I learn more about these parameters? Thanks for any help. __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Windows NT Service
By default services can be controlled by anyone in the Administrators and Power Users groups. Alternatively you can modify the service's DACL (permissions) to allow a particular user. I am working on Win32::Daemon to support this. Original Message- From: Ayman M. Galal [mailto:[EMAIL PROTECTED] Sent: Saturday, June 14, 2003 12:25 AM To: [EMAIL PROTECTED]; perl users Subject: I need to knwo How i can make normal user (NOT administative privilage ) can make restart to Determine Service using Perl ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Tk:Columns Error on Win32 System
On Fri, 13 Jun 2003, Primanti, Joseph T wrote: > Rob, > > Yes, I have both the latest Tk::DKW and Tk::Contrib. I got the > same results on another machine that had 5.8.0 build 805. I > think it functions in 5.6.1 but has a bug in 5.8.0. I tried the > ptk list before this post but never got a reply. Thank you for > testing this for me. My program was nearly done but now this > throws a wrench into it. I was going to use HList but it > doesn't have sortable columns. I have got to be able to enable > -selectmode => 'extended' and change the column widths. I've had similar problems with this module ... Perhaps Tk::MListbox may be worth a try? -- best regards, randy kobes ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Windows NT Service
SysInternals' 'psservice' would be my guess. Usage: Usage: psservice [\\Computer [-u Username [-p Password]]] Example: psservice \\marklap -u wench -p dungeon stop messenger You can get it here: http://www.sysinternals.com/ntw2k/freeware/psservice.shtml -Original Message-From: Ayman M. Galal [mailto:[EMAIL PROTECTED]Sent: Saturday, June 14, 2003 12:25 AMTo: [EMAIL PROTECTED]; perl usersSubject: Windows NT Service Dear friends I need to knwo How i can make normal user (NOT administative privilage ) can make restart to Determine Service using Perl . I will be thanks for help. Eng: Ayman M. Galal System Engineer *** Free Microsoft support: Retry, Reboot, Reinstall. **
Re: Tk:Columns Error on Win32 System
- Original Message - From: "Primanti, Joseph T" <[EMAIL PROTECTED]> To: "'kalinabears'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, June 14, 2003 12:08 AM Subject: RE: Tk:Columns Error on Win32 System > Rob, > > Yes, I have both the latest Tk::DKW and Tk::Contrib. I got the same results > on another machine that had 5.8.0 build 805. I think it functions in 5.6.1 > but has a bug in 5.8.0. I tried the ptk list before this post but never got > a reply. Thank you for testing this for me. My program was nearly done but > now this throws a wrench into it. I was going to use HList but it doesn't > have sortable columns. I have got to be able to enable -selectmode => > 'extended' and change the column widths. > > This code works but I get the .al error trying to change a column width. > Using -selectmode doesn't error but it does not make any change. > > use Tk; > use Tk::Columns; > > $mw = MainWindow->new; > my $cols = $mw->Columns(-width => 640, > -height => 480, > -selectmode => "extended" #This is not functioning!!! > ); > $cols->columnlabels([qw(Column1 Column2 Column3)]); > #$cols->buttonwidth('Column1', 7); #This causes an error when un-remarked > $cols->pack(-side => 'top', > -fill => 'both' > ); > > $cols->insert('end', 'A1', 'A2', 'A3'); > $cols->insert('end', 'B1', 'B2', 'B3'); > $cols->insert('end', 'C1', 'C2', 'C3'); > > MainLoop; > > Here is the error: > > Can't locate auto/Tk/TiedListbox/buttonwidth.al in @INC (@INC contains: > C:/Perl/lib C:/Perl/site/lib .) at C:/Perl/site/ > lib/Tk/Derived.pm line 467 > > Joe I can't get anything sensible from 'buttonwidth' with either 5.6.1 or 5.8.0. For me it produces the error "Failed to AUTOLOAD 'Tk::__ButtonContainer::indexedbutton". I don't understand OO perl at all well - and I don't use Tk very much - but it seems to me that the above error is to be expected because there is no 'Tk::__ButtonContainer::indexedbutton' subroutine. Columns.pm does contain an 'indexedbutton' subroutine, but it exists in package Tk::Columns, *not* in package 'Tk::__ButtonContainer'. None of the demos that ship with the cpan distro utilise 'buttonwidth'. You should probably check with the author - maybe he has made a mistake. That's about all that *I* can come up with. Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Problem Using 'unlink' within Script
> > A dumb question (and I'm reachin, here): > > > > Perhaps you need to Close() or Quit() your $Word object before you try to > > unlink the file? If you are able to "del" the file from CMD.exe after the > > script has run, but not during, I would look at what objects might still > > retain flocks. > > Not a dumb question. I took a guess at Close() -- no success at deleting > the text file -- but not at Quit(). I'm flying blind here because I can't > locate any comprehensive documentation of Perl-Word interactions. Here's another straw at which to clutch: undef($Word); Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Stuck in Find::File
HI I am trying to log on to my unix server (from my windows m/c) and list the directory structure. I came across this File::Find module . It works fne on my windows m/c. but when i try to telnet to my unix m/c and set the base dir as xxx it gives the following error "Can't stat /home/: No such file or directory". If i just give a "ls " command on the samr dir it works fine. the code used is as follows: Code === find(\&edits, $basedir); sub edits() { print "File name is $_\n\t\tFull path is $File::Find::name\n"; } where $basedir is the home directory. Also is it possible to traverse each directory one by one? TIA Ashish _ Looking for love? Yearning for friendship? http://www.msn.co.in/Romance/ You're in the right place ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Problem Using 'unlink' within Script
- Original Message - From: "Messenger, Mark" <[EMAIL PROTECTED]> To: "'James E Keenan'" <[EMAIL PROTECTED]>; "Maraglia, Dominicx" <[EMAIL PROTECTED]>; "asphyx" <[EMAIL PROTECTED]>; "Messenger, Mark" <[EMAIL PROTECTED]>; "Arms, Mike" <[EMAIL PROTECTED]> Cc: "Perl-Win32-Users" <[EMAIL PROTECTED]> Sent: Friday, June 13, 2003 11:52 PM Subject: RE: Problem Using 'unlink' within Script > A dumb question (and I'm reachin, here): > > Perhaps you need to Close() or Quit() your $Word object before you try to > unlink the file? If you are able to "del" the file from CMD.exe after the > script has run, but not during, I would look at what objects might still > retain flocks. Not a dumb question. I took a guess at Close() -- no success at deleting the text file -- but not at Quit(). I'm flying blind here because I can't locate any comprehensive documentation of Perl-Word interactions. > > Also, IMHO, replacing the spaces with _s may have been unnecessary. I have > used unlink() with LFNs (Long File Names) before with no adverse effects. It was just a guess. > Another question: Once the SaveAs operation completes, are you able to open > the file for read with anotehr application? (IOW, is the SaveAs procedure > actually working?) Yes. The code posted Saves the MS Word file As a plain-text document which is completely manipulable and deletable from any place other than in the current Perl process. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Problem Using 'unlink' within Script
On 13 Jun 03, James E Keenan ([EMAIL PROTECTED]) wrote: > 6. Now believe problem stems from *how* the target file was originally > created. It was created by opening a Microsoft Word file and saving it as a > plain-text document. > > my $Word = Win32::OLE->new('Word.Application', 'Quit'); > $Word->{'Visible'} = 1; > $Word->Documents->Open($fullin) > || die("Unable to open $fullin", Win32::OLE->LastError()); > > $Word->ActiveDocument->SaveAs({ > FileName => $fullout, > FileFormat => wdFormatText, > }); As you're using word to create the file, word itself will lock the file against deletion while word has the file open. Have you checked after the above code to see if word has terminated? This snippet from the Win32::OLE docs should do that. while (my $Word = Win32::OLE->GetActiveObject('Word.Application')) { sleep 1; } unlink($fullout); -- Stephen Patterson http://www.lexx.uklinux.net http://patter.mine.nu [EMAIL PROTECTED] remove SPAM to reply Linux Counter No: 142831 GPG Public key: 252B8B37 Last one down the pub's an MCSE pgp0.pgp Description: PGP signature
Re: Executing scripts out of Apache
Mundell, R. (Ronald) wrote: Good Day All I wrote a perl secript that is being used out of a web page. It is supposed to open the serial port. Unfortunatly it is unable to do that. If I run the script from the command line then it works. If anyone might know what I must do to resolve this, please help You must: 1. tell us what _does_ happen (i.e., error messages, the area of the computer smoke is coming out, etc.), not just what _does not_ happen when things go wrong. 2. supply a small script (cut-and-paste to your email, but leave out extraneous material) which exhibits this problem. Cameron -- Cameron Dorey Associate Professor of Chemistry University of Central Arkansas Phone: 501-450-5938 [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs