Auto Login for a website (Tribal wars)

07/09/2017 00:11 IchWillNurBotsSchreiben#1
I want to make a bot for tribal wars, the first thing I want to do is an auto login.
The user types his username and password into a GUI and if he is not already logged in, it should type in the information.

My Questions:

1. How can the program put the information in the right fields?

2.If I need the variables that the site uses how can I get them?
07/09/2017 17:27 rachefaust#2
read the class of the input field replace the strings example the standart filled (username) replaced the user name (WillNur) same with pw 2. right click on the username inputfield and inspect ...

watch some youtube tuts there are some good explained for a auto-login script
07/17/2017 11:35 mhaendler#3
you can either use "Browser automation" or "WinHTTP"
With Browser automation you can use IE.au3 or FF.au3 WinHTTP is sending Pakets -> WinHTTP.au3

With Web Developer Tools you can figure out how to get to the needed "fields" / name of the fields e.g.
<input type="text" name="username" or stuff like that

or just google autoit auto login script :)
07/17/2017 14:12 psydinger#4
I assume you already have a basic idea of how to create a GUI with AutoIt. There are plenty of tutorials on youtube if that's not the case.

In case you don't want to use any UDFs, AutoIt brings a great set of Internet Explorer functions. All you need to do is make use of them and pass your login variables-interact with the needed elements of the website. AutoIt can perform these tasks in the background.

I would suggest reading through these functions and their parameters thoroughly. They are -in my opinion- the most important ones to get you started!

[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]


To know more about any DOM element of the website you are targeting (like a form element in your case for example), just open the site in any browser and right-click -> inspect the element.

This is key for telling AutoIt exactly what it should do, and to understand how the targeted site works.
07/19/2017 08:37 Memphiisto#5
Hallo!

Hier ein kleines Beispiel: (kleiner Ausschnitt aus einem meiner Codes)

Dieses Login hier ist mit einem "verschlüsseltem" Passwort in einer Ini Datei, damit man es zumindet nicht grad im Klartext lesen kann...
Die interessanten Befehle für dich wären momentan nur die _IE.... Befehle.

PHP Code:
Func _Login()
    
$LBenutzername = IniRead(@WorkingDir & "\Settings\Settings.ini", "Logindata", "Benutzername", "Default")
    
$EncryptedPasswort = IniRead(@WorkingDir & "\Settings\Settings.ini", "Logindata", "Passwort", "Default")
    
$sDecryptedPW = _Crypt_DecryptData($EncryptedPasswort, "VerschlüsselungsPW", $CALG_RC4)
    
$oForm = _IEFormGetObjByName($oIE, "login")
    
$oQueryUsername = _IEFormElementGetObjByName($oForm, "username")
    
$oQueryPassword = _IEFormElementGetObjByName($oForm, "password")
    
_IEFormElementSetValue($oQueryUsername, $LBenutzername)
    
_IEFormElementSetValue($oQueryPassword, BinaryToString($sDecryptedPW))
    
_IEFormSubmit($oForm)
    
_IELoadWait($oIE, 0)
EndFunc   ;==>_Login 

Dafür brauchst du natürlich zuerst ein Objekt und die IE.au3 :)

Lg Memphisto


Edit:
Ups didnt see you wrote in english haha...

Let me rewrite that....:

Hello!
Here you have a short snipplet out of a code of mine (also learned it out of a tutorial somewhere on elitepvpers)

The Code i posted above is a "Loginscript" with an encrypted Password.. the Data is read out of an ini File.. (I only "encrypted" the password so you cant read it this easy out of the Ini File...)

The most intresting Commands for you would be the ones with _IE...


[CODE]

For this you will of course first need an Object and the IE.au3 :)

Greetz Memphisto
08/09/2017 14:21 xShizoidx#6
The input fields of the page have no name. As I see it, you do not have a unique class or ID. It is easiest if you determine the surrounding DIV containers of the input fields and then select the child element.