top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Calling perl script with arguments

+1 vote

I have a 3rd party perl script:

 head -n 1 /usr/sbin/ftpasswd

I want to write data to stdin and read from stdout:

proc = Popen( ["/usr/bin/perl", "/usr/sbin/ftpasswd" "--hash", "--stdin"], 
stdout=PIPE, stdin=PIPE)

output, input = proc.communicate(pwd)
return output.strip()

Since pwd comes from a non-trusted source I don't want to use shell=True.
The arguments to the perl interpreter do not seem to right:

Can't open perl script "/usr/sbin/ftpasswd--hash": No such file or directory

Adding a leading " " to "--hash" does not help. How can I use that script and achieve something like

# echo "123" | ftpasswd --hash --stdin
ftpasswd: $1$8BuLAqCl$y/URBN/OCSLsKtnu8nFHH0
posted Oct 15, 2013 by Deepankar Dubey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
"/usr/sbin/ftpasswd" "--hash"

A COMMA is missing in between "/usr/sbin/ftpasswd" and "--hash".
Python automatically concatenates adjacent strings.

answer Oct 16, 2013 by Satyabrata Mahapatra
oh man, thanks...
Similar Questions
0 votes

How can write a python script which will execute some perl scripts in a gui and shouldn't be post processed....?

+2 votes

Is there any Bugzilla API to upload and download bug's attachment files with perl script?
I want to write a Perl script to download all the attachment in a specified bug, and save the files to local directory.
Attachment method in Bugzilla::Webservice::Bug seems not to download or upload attachment from or to bug.

+1 vote

I have a perl script I want to create desktop shortcut. While I click on this shortcut icon it will run my perl script and keep the terminal open.

I have tried the command

ln -s ~/Desktop/abc

while I click on this abc Icon from my desktop. It run and same time the terminal exit. Could you please help here?

My requirement is:

I want to create desktop shortcut for particular perl program. While I click on this icon from desktop, it should run and keep the terminal open.

0 votes

Do you know if there is a working module that can be used to post to WordPress from a Perl script? I've seen that all the modules that contain WordPress are very old.

I need to install that module under a Perl built with Perlbrew. I tried to install WordPress, WordPress::API, but they both depend on WordPress::XMLRPC which depends on SOAP::Lite which depends on XML::Parser which can't be installed because of the error "expat.h - no such file or directory".
I also tried to install XML::Parser::Expat but it gives the same error.

By curiosity I searched for a Python module, and I found python-wordpress-xmlrpc, I installed it very fast and easy, I found that it offers more features than the Perl module WordPress, I tested a sample script I found on the web, and it worked very well.