Post by naskootbg on Feb 10, 2016 13:31:47 GMT
1. Let's make simple bot, that will output the source code of any page.
This is made through the built-in UniBot string command [src] (response headers and source code of the page).
Let's do it:
1.1. Type the URL
1.2. Create some string (random name), that will output the whole response [src]:
Image 1:
If you want the bot to output just text, then in String builder type this text with single quotes e.g. 'text for input'.
2. Building our first regex string
Now let's tell the bot to output a part from the source code, instead the full code. This is made trough regex command in the String builder. Its syntax is like this rg('[src]','regex string'): rg – do regex ; [src] – source code; 'regex string' – the string we are looking for.
We have the source code from the output from step 1 (see the image 1). Let's try to extract and output the date which looks like that: “Date: Wed, 10 Feb 2016 12:13:33 GMT” in the output of my bot.
2.1. Type [build] in the string value and press Enter.
2.2. Choose Regex from the first drop-down menu.
2.3. Type Date: (.*?) GMT on the next field type $1
2.4. Click ‘Insert’ button and click OK.
Image 2:
Our regex looks like this: rg('[src]','Date: (.*?) GMT ','$1')+
The symbols (.*?) and $1 require attention.
The first symbol (.*?) is maybe the most important part of any regex. In normal language it will means "find this", so 'Date: (.*?) GMT’ will means "find this between Date: and GMT"
The second symbol $1 means "find exact (.*?)". If we do not add this $1 it will output the full string that passed criteria 'Date: (.*?) GMT ', which is "Date: Wed, 10 Feb 2016 12:13:33 GMT" in our situation.
It can be $2,$3… in different strings, but this is more advanced and it's explained here: unibot.boards.net/thread/52/solved-little-help
Let's make our first POST
What POST in UniBot means?
In normal language means “auto fill and submit HTML form”.
For creating a POST we need:
1. post URL (in most cases it have php extension, but it can be cgi, asp.. )
2. post’s query (this is basically string that contains form fields names and their values)
3. Cookies (sometime used to authenticate the session)
4. hidden form fields (if the POST require tokens, returns and related things used lately for authentication )
To find these 4 things, which are required for creating a POST, all we must do is record the returned headers. There have 2 ways:
- HTTP analyzer (recommended)
- Live HTTP headers – addon for Firefox
Note: as you can see from the example on image 1, UniBot can output the source code with some of the headers, but still can’t record and such output can’t help for creating POST
To understand all this better, let's make some simple form submitter bot for www.iopus.com/imacros/demo/v6/f1/form.asp
Image 3
This bot is simple and do not require cookies and other kind of authentication, but if you want to see more advanced tutorial see mikisoft.me/tutorials/unibot-2/ (cookies only) or the videos here unibot.boards.net/thread/15/official-guides (in the second video, the bot require cookies and hidden values).
Let's get started.
How to find required POST data?
1. Using Live HTTP header
1.1. To record the HTTP request first press Ctrl+Shift+L (can click ‘Clear’ button if it has already recorded something)
1.2. Submit the form in the browser (‘click to order now’ in our example)
Done we do it! We have all needed data:
Image 4
Note: As you can notice the post’s query ALWAYS starts with 2 blank spaces on Live HTTP headers.
2. Using HTTP analyzer
2.1. Run the program and click Start
2.2. Click on the POST (there have other posts recorded too, but we are looking for the URL of our example)
2.3. Click on “Raw Stream”
Done we do it! We have all needed data:
Image 5
We have the data – let's make the bot!
In our example the data is:
- Post URL: “http://www.iopus.com/imacros/demo/v6/f1/confirm.asp”
- Post’s query: “Name=My+Name&abc=1234567890&main=Pizza&drink=Milk&C9=ON&dessert=chocolate+cake&Reg_code=&newcustomer=Not_yet&Remarks=I+don%27t+want+pizza%2C+just+showing+POST+example&SendButton=Click+to+order+now”
So all we have to do is:
1. Add URL
2. Add the Post
Image 6
SIMPLE . We have the bot. Let's check if it works. The simpler method to do this is:
1. Create string that will output the source code (see image 1)
2. Save the output source code as .html file and open it in your browser.
OK, we have the bot, but it outputs the same values every time.
How to make it to change these values without changing the post’s query every time?
Simple!
Let's say - we want to order Pizza with Milk for our friends. All you have to do is:
- make a string, which will require input from clipboard. It’s made with the command [inp]
- change the post data using %theinputstring% as name
In this example I create a string “name” and the post’s query looks like this:
“Name=%name%&abc=1234567890&main=Pizza&drink=Milk&C9=ON&dessert=chocolate+cake&Reg_code=&newcustomer=Not_yet&Remarks=I+don%27t+want+pizza%2C+just+showing+POST+example&SendButton=Click+to+order+now”
Image 7
note: in some very basic forms is possible to not see POST. The reason is the form use GET method. In this situation all you need to do is find this GET, that includes the form’s names and values and use them direct in URL.
Example www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit . The only response from the form in the page above is GET /html/action_page.php?firstname=Mickey&lastname=Mouse HTTP/1.1. So to auto complete and submit this form is only needed to visit the URL www.w3schools.com/html/action_page.php?firstname=Mickey&lastname=Mouse
This is made through the built-in UniBot string command [src] (response headers and source code of the page).
Let's do it:
1.1. Type the URL
1.2. Create some string (random name), that will output the whole response [src]:
Image 1:
If you want the bot to output just text, then in String builder type this text with single quotes e.g. 'text for input'.
2. Building our first regex string
Now let's tell the bot to output a part from the source code, instead the full code. This is made trough regex command in the String builder. Its syntax is like this rg('[src]','regex string'): rg – do regex ; [src] – source code; 'regex string' – the string we are looking for.
We have the source code from the output from step 1 (see the image 1). Let's try to extract and output the date which looks like that: “Date: Wed, 10 Feb 2016 12:13:33 GMT” in the output of my bot.
2.1. Type [build] in the string value and press Enter.
2.2. Choose Regex from the first drop-down menu.
2.3. Type Date: (.*?) GMT on the next field type $1
2.4. Click ‘Insert’ button and click OK.
Image 2:
Our regex looks like this: rg('[src]','Date: (.*?) GMT ','$1')+
The symbols (.*?) and $1 require attention.
The first symbol (.*?) is maybe the most important part of any regex. In normal language it will means "find this", so 'Date: (.*?) GMT’ will means "find this between Date: and GMT"
The second symbol $1 means "find exact (.*?)". If we do not add this $1 it will output the full string that passed criteria 'Date: (.*?) GMT ', which is "Date: Wed, 10 Feb 2016 12:13:33 GMT" in our situation.
It can be $2,$3… in different strings, but this is more advanced and it's explained here: unibot.boards.net/thread/52/solved-little-help
Let's make our first POST
What POST in UniBot means?
In normal language means “auto fill and submit HTML form”.
For creating a POST we need:
1. post URL (in most cases it have php extension, but it can be cgi, asp.. )
2. post’s query (this is basically string that contains form fields names and their values)
3. Cookies (sometime used to authenticate the session)
4. hidden form fields (if the POST require tokens, returns and related things used lately for authentication )
To find these 4 things, which are required for creating a POST, all we must do is record the returned headers. There have 2 ways:
- HTTP analyzer (recommended)
- Live HTTP headers – addon for Firefox
Note: as you can see from the example on image 1, UniBot can output the source code with some of the headers, but still can’t record and such output can’t help for creating POST
To understand all this better, let's make some simple form submitter bot for www.iopus.com/imacros/demo/v6/f1/form.asp
Image 3
This bot is simple and do not require cookies and other kind of authentication, but if you want to see more advanced tutorial see mikisoft.me/tutorials/unibot-2/ (cookies only) or the videos here unibot.boards.net/thread/15/official-guides (in the second video, the bot require cookies and hidden values).
Let's get started.
How to find required POST data?
1. Using Live HTTP header
1.1. To record the HTTP request first press Ctrl+Shift+L (can click ‘Clear’ button if it has already recorded something)
1.2. Submit the form in the browser (‘click to order now’ in our example)
Done we do it! We have all needed data:
Image 4
Note: As you can notice the post’s query ALWAYS starts with 2 blank spaces on Live HTTP headers.
2. Using HTTP analyzer
2.1. Run the program and click Start
2.2. Click on the POST (there have other posts recorded too, but we are looking for the URL of our example)
2.3. Click on “Raw Stream”
Done we do it! We have all needed data:
Image 5
We have the data – let's make the bot!
In our example the data is:
- Post URL: “http://www.iopus.com/imacros/demo/v6/f1/confirm.asp”
- Post’s query: “Name=My+Name&abc=1234567890&main=Pizza&drink=Milk&C9=ON&dessert=chocolate+cake&Reg_code=&newcustomer=Not_yet&Remarks=I+don%27t+want+pizza%2C+just+showing+POST+example&SendButton=Click+to+order+now”
So all we have to do is:
1. Add URL
2. Add the Post
Image 6
SIMPLE . We have the bot. Let's check if it works. The simpler method to do this is:
1. Create string that will output the source code (see image 1)
2. Save the output source code as .html file and open it in your browser.
OK, we have the bot, but it outputs the same values every time.
How to make it to change these values without changing the post’s query every time?
Simple!
Let's say - we want to order Pizza with Milk for our friends. All you have to do is:
- make a string, which will require input from clipboard. It’s made with the command [inp]
- change the post data using %theinputstring% as name
In this example I create a string “name” and the post’s query looks like this:
“Name=%name%&abc=1234567890&main=Pizza&drink=Milk&C9=ON&dessert=chocolate+cake&Reg_code=&newcustomer=Not_yet&Remarks=I+don%27t+want+pizza%2C+just+showing+POST+example&SendButton=Click+to+order+now”
Image 7
note: in some very basic forms is possible to not see POST. The reason is the form use GET method. In this situation all you need to do is find this GET, that includes the form’s names and values and use them direct in URL.
Example www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit . The only response from the form in the page above is GET /html/action_page.php?firstname=Mickey&lastname=Mouse HTTP/1.1. So to auto complete and submit this form is only needed to visit the URL www.w3schools.com/html/action_page.php?firstname=Mickey&lastname=Mouse