Perl + Apache + CGI - windows

How do I run perl script from local host?
I have installed Apache 2.2 and Active Perl 5.16.3.
I am able to run the perl scrip from command prompt.
But since i am dealing with web application, i want it to be run from localhost.
However, I am getting the following error in the browser
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please help me out!

Your problem is probably related to the configuration of Apache. (It may be Apache that needs configuring for .cgi scripts) - If this is the case then you can find good info on this here:
http://www.perlmonks.org/?node_id=44536
http://www.cgi101.com/book/connect/winxp.html
http://www.editrocket.com/articles/perl_apache_windows.html
There is usually a host of things that you need to do to get it working. Following a good HOWTO to make sure that everything is installed and configured correctly will usually get you going to execute scripts on your local Windows machine.

You could run cgi script from web browser. CGI means that it should send a HTML header before sending any output to the server (which is going to send it back to the browser).
http://perldoc.perl.org/CGI.html#NAME
http://www.cs.tut.fi/~jkorpela/perl/cgi.html
Like this:
use CGI; # load CGI routines
$q = CGI->new;
print $q->header; # create the HTTP header
print $q->start_html('hello world'); # start the HTML
### your script logic goes here
print $q->end_html; # end the HTML
Of course, CGI is outdated, for new development you should use some mmore recent framwork like: Dancer, Mojolicious, ...

if someone is looking for an answer in year 2017 then follow this on windows 2010 machine.
Download Strawberry perl from perl site
Install in default directory.C:\Strawberry
Download Apache from https://httpd.apache.org/download.cgi#apache24
Once you successfully get apache server running then
Place your perl scripts in your Apache24/cgi-bin/ folder.
firstline of your perl script should point to path where perl is installed for my case it is #!C:/Strawberry/perl/bin/perl.exe
you should change your path according your installation folder
Filename - first.pl
#!C:/Strawberry/perl/bin/perl.exe
print "Content-type: text/html\n\n";
print "Hello, World.";
Now you can run your script from browser http://localhost/cgi-bin/first.pl

Related

Download a file from FTP via proxy with Ruby

I have an app running on Heroku, and I need to download a file from an FTP. But I need to do it using a fixed IP. I´m using www.quotaguard.com to have fixed IPs.
But I can´t get it working.
Does anyone has a Ruby example to download a file from an FTP via a proxy server (quotaguard).
Both the proxy server and the FTP require username and password.
I´ve tried everything, using Ruby. And also calling wget from system to initiate a download, but wget apparently doesn´t go via the proxy. Also checked many posts, but no success so far.
I´m using Ruby 2.4.5
Thanks for any comments.
Thank you QuotaGuard. Socksify is not maintained and really old, we gave it a try but didn´t want to spend much time on it.
We actually managed to get this working with curl. You can call it within Heroku as well.
Here´s the command in case anyone wonders.
curl -x socks5h://socksproxyurl 'ftp://theftp/some.pdf' --user "ftp_user:ftp_pass" -o some.pdf
We've seen a few customers do this before with the socksify gem.
require 'socksify'
proxy = URI(ENV['QUOTAGUARDSTATIC_URL'])
TCPSocket::socks_username = proxy.user
TCPSocket::socks_password = proxy.password
Socksify::proxy(proxy.hostname, 1080) do |soc|
# do your FTP stuff in here
end
If that doesn't do it, post the errors you're seeing and we'll help get this running for you.

Is there a way to echo on a UNIX terminal the output of a local server running a web-socket?

I am running some code that implements a web-socket server locally.
I'd like to echo the output of it on a Unix Terminal to verify whether it works correctly.
The curl command page does not seem to state the support the web-socket protocol.
Are you aware of any other UNIX commend that does so?
My tool websocat supports it (and WebSocket server as well).
Other alternatives include multiple tools named "wscat" (1,2,3), "ws" and maybe others.

Running script on Meterpreter in Msfconsole

The purpose of my task is to run a Ruby script, which executes key-logger exe file, and starts working on remote computer. I manage to successfully connect by apache2 server (i.e. my other VM enters a link in the browser and meterpreter starts to work) with PAYLOAD php/meterpreter/reverse_tcp. So when meterpreter starts to work , Im trying to run script: run ruby.rb
https://i.stack.imgur.com/pVEDI.jpg
ruby.rb (with content)
exec("/root/Desktop/time/time/bin/Debug/time.exe")
However, error is occurring and I dont understand why? When I try to execute my time.exe file in WINDOWS it works perfectly. The keylogger is written in c# if someone interested in looking at the code: https://ufile.io/y9n3z
Maybe someone can give my an advice or a workaround?

install weblogic on console mode without xming

I'm trying to install weblogic server on Centos 7 with following instruction of oracle about console mode. Everything will be fine till weblogic file 's extracting on my computer. I get this message about
display enviroment variable failed
I google it and found xming as solution. But is there any solution to install weblogic without xming.
You need to do a silent install as mentioned. You can find the documentation here.
Basically, you need two files:
A response file
Here, you will set some parameters like ORACLE_HOME, proxy information if needed and installation type, etc.
An oraInst.loc file
In this file, you need to do the following(from documentation):
Replace oui_inventory_directory with the full path to the directory where you want the installer to create the inventory directory. Then, replace oui_install_group with the name of the group whose members have write permissions to this directory.
After doing all of this, you can run the command as follows;
java -jar distribution_name.jar -silent -responseFile file [-options] [()*]
I uploaded my own oraInst.loc and response files here for demonstration. I strongly suggest you to read the documentation though. Good luck.

Will the IBM Websphere Application Server run the Python/Jython script without Python Interpreter installed

I am new to Python and IBM Websphere Application Server.
I run a status.bat file which calls status.py file through wsadmin(provided username, password and status.py path passed as parameters to wsadmin). IBM Websphere Application Server is installed in the machine.What i want to know is a Python Interpreter needed to run a python script, it was not installed in the system.
Since the script is running through a WAS server-wsadmin, it had a capability to run a PY script even without having a PY Interpreter in that machine?? by its own compiling tool??
If it is must to have PYTHON.exe installed, do i need to tell wsadmin or anywhere that it is a PY script??
NOTE: The script and .bat was already existed in the machine and im supossed to work on it. I dont have any idea of the purpose of using wsadmin to run the script instead of by directly calling script by [python status.py] in .bat
Summary :- WS server had an any internal PY Interperter??
Thanks in Advance Friends....
WebSphere Application Server comes with Jython – Python implementation for JVM. It is usually located under <WAS_HOME>/optionalLibraries/jython.
To run a script you can use wsadmin:
./wsadmin.sh -lang jython -f your_script.py
The purpose of using wsadmin is that it provides facilities for server administration. If you don't need those then you can probably utilize optionalLibraries/jython/jython.jar directly although I never did this myself.

Resources