[SOLVED] how to convert a perl script *.pl to *.exe ?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The only ways to convert a perl source to a binary executable have (to my knowledge) been depreciated because they no longer work in any useful way.
The supported and approved technique is to read the perl, write a program in Assembler, C, C++, Pascal, FORTRAN, COBOL, or something for which a binary output compiler exists. Then compile, test, and release.
Perl was never intended to obfuscate code or result in binary programs. Use something that is intended for the purpose.
Or, the non-technical solution, start doing business with people you can trust. Then trust them.
It worked for me. I tried it on Ubuntu 14.04 and Ubuntu 16.04, but it generates 32 bit executable which would not work on a 64 bit Windows.
What worked for me ?
I took a Strawberry Perl (not Active perl) on my windows machine which is already shipped with dmake utilities for gcc compilers to generate the executable.
Use cpan to install the pp utility to work
Quote:
cpan:/> install PAR::Packer
Take your Perl script on to the Windows machine and make changes to run the script on Windows, once the Perl script is ready run the following commands:
Quote:
pp -B -p script.pl
The above bundles all the dependent modules to a par file generated as "a.par" in the same location where you run this script.
Now, run the below command to generate the executable:
Even though related to the thread topic, the link provided is for a commercial-only product with a license which restricts use of the executables it produces from user written perl code. The link has been removed as inappropriate for this forum and in conflict with the forum rules which prohibit advertising.
There is a shareware version of this software...........
Shareware Version
You are hereby licensed to use the shareware evaluation version of Perl2Exe for evaluation purposes without charge for a period of 30 days. This is not free software. If you use this software after the 30 day evaluation period a registration fee is required. Under no circumstances are you licensed to distribute Exe files created by the shareware evaluation version of Perl2Exe. Unregistered use of Perl2Exe after the 30 day evaluation period is in violation of copyright laws.
Distribution of Perl2Exe
You are hereby licensed to make as many copies of the shareware evaluation version of this software and documentation as you wish; give exact copies of the original shareware version to anyone; and distribute the shareware version of the software and documentation in its unmodified form via electronic means. There is no charge for any of the above.
This commercial product is well-known but not frequently used, because it is frankly easier to install Strawberry Perl (or some other Win32 distribution), which will register the .pl extension to itself so that you can double-click on files to run them. The only thing that "perl-to-exe" products really do is to slightly-package this: the source code is there as a resource in the file-bundle, because Perl is fundamentally a one-step interpreter which accepts source code as input. (So, why bother?)
A language like Perl is also heavily dependent upon library modules, from CPAN, which must be installed and available. Most of "what Perl is, to you," actually comes from these modules. If you ask a product to "package these into an EXE," you will be rewarded with a humongous EXE! (Which is impossible to maintain.) So, again, "why bother?"
Last edited by sundialsvcs; 08-31-2017 at 08:16 AM.
Well if you where into cyber security / ethical hacking / pen testing you would want to be able to deploy exploits on your targets machine without having to install the perl software ... (same goes for example python).
A lot of exploits are written in perl..... so the ability to make a win32 exe out of such a perl script is very useful.
Well if you where into cyber security / ethical hacking / pen testing you would want to be able to deploy exploits on your targets machine without having to install the perl software ... (same goes for example python).
A lot of exploits are written in perl..... so the ability to make a win32 exe out of such a perl script is very useful.
Regards,
J wouter
A very good reason to rewrite them them in C, C++, Pascal,or any other language that can do that job AND has true compilers available.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.