• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

AutoIT Autoit in WebServer xD

Status
Not open for further replies.

DDoSer

The Real DDoSer
User
Joined
Oct 9, 2013
Messages
352
Reputation
0
Reaction score
4,578
Points
243
Credits
0
‎11 Years of Service‎
51%
[HIDE-THANKS]I will take as a basis platform DENWER. So, AutoIt, we will use as a CGI.

Install Denwer (will not describe the installation process). I chose the default path: C: \ WebServers (you it may be different), go to the folder where you installed AutoIt (usually: C: \ Program Files \ AutoIt3). Next, copy the file and folder AutoIt3.exe Include, then go here: C: \ WebServers \ usr \ local (do not forget that you have a way to Denver may be different), and create a folder autoit3, and insert our created folder copied files.

If you are currently included Denver, be sure to turn it off.

Server AutoIt script is slightly different from a simple script. First Directive:

Code:
>#!/usr/local/autoit3/autoit3
This line should be the first because, thanks to this line of Apache determines the path to the interpreter.

Next, we have to get into the console (STDOUT stream) Mime type of content. Output to the console using the function:

Code:
>ConsoleWrite()
because we will display a normal html text encoding WINDOWS-1251, we specify as follows:

Code:
>ConsoleWrite("Content-Type: text/html; charset=WINDOWS-1251"&@CRLF&@CRLF)
At the beginning of each end of the script of the server should be two lines:

Code:
>#!/usr/local/autoit3/autoit3
ConsoleWrite("Content-Type: text/html; charset=WINDOWS-1251"&@CRLF&@CRLF);

ConsoleWrite("Hello from AutoIt");
And save the script file on the path: C: \ WebServers \ home \ cgi-glob \ test.au3

Run Denver, and go here:
This link is hidden for visitors. Please Log in or register now.


As you can see hatched, our line:

Code:
>Hello from AutoIt
If you could do it, then I congratulate you, you've written a server-side script to AutoIt!

[/HIDE-THANKS]

 
Last edited by a moderator:
Re: Autoit in WebServer xD[HIDE-THANKS]1. HeadlinesSo, now we shall understand with the environment of our server-side script. Each browser sends the server headers, and he already passes them to the script. Headers can be found via the function

Code:
>EnvGet
Suppose we can find our browser (User-Agent):

Code:
>#!/usr/local/autoit3/autoit3ConsoleWrite("Content-Type: text/html; charset=WINDOWS-1251"&@CRLF&@CRLF);$user_agent = EnvGet('HTTP_USER_AGENT');ConsoleWrite("Our browser: "&$user_agent);
After running the script, you will see User-Agent string our browser. For example, I use Google Chrome and I have User-Agent:

Code:
>Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36
2. GET requestMany of us have seen the links of this type:
This link is hidden for visitors. Please Log in or register now.
all that after the question mark "?" Is a query string (Eng. Query String).This is part of GET request. Server allows us to get this same query string, also through the function EnvGet. code:

Code:
>#!/usr/local/autoit3/autoit3ConsoleWrite("Content-Type: text/html; charset=WINDOWS-1251"&@CRLF&@CRLF);$var = EnvGet('QUERY_STRING');ConsoleWrite("Query string: "&$var);
If we have to add our URL request, for example:

Code:
>http://localhost/cgi-glob/test.au3?Val=Hello_User
we will get in the browser like this:

Code:
>Query string: val=Hello_User
We can specify the number of variables in the query, separated by the ampersand "&", like this:

Code:
>http://localhost/cgi-glob/test.au3?a=foo&b=bar
3. POST request.Handling POST requests is somewhat different from GET requests. To obtain the data specified in the POST request, we need to consider them with STDIN stream in AutoIt does it function:

Code:
>ConsoleRead();
On this basis, POST request can be read as follows:

Code:
>#!/usr/local/autoit3/autoit3ConsoleWrite("Content-Type: text/html; charset=WINDOWS-1251"&@CRLF&@CRLF);$var = ConsoleRead()ConsoleWrite("String POST query: "&$var);
Note that POST requests are not added to the URL, after the question mark "?", As do the GET requests, POST request line is stored in the header, which are transmitted to the server. So, the end of the theory, let's you write a script that will receive the POST request and trace all occurrences of the word "AutoIt" blue and white letters:

Code:
>$method = EnvGet('REQUEST_METHOD') ;$path = EnvGet('SCRIPT_NAME'); $uri = 'http://'&EnvGet('SERVER_NAME')& $pathIf $method = "POST" Then   $POST = ConsoleRead();EndIf; Код на HTMLConsoleWrite(''&@CRLF)ConsoleWrite('AutoIt Application')ConsoleWrite('Enter text:
This is AutoIt script. AutoIt is subtle
');
[/HIDE-THANKS]

 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top