Oh hay guise, today I will teach you how to make a simple autoit auth, an auth is also called an Authentication Program, these are used to make it so only certain people are allowed to access your programs.
But before we start I suggest you get Autoit V3. But you must download these files in the exact order listed.
http://www.autoitscript.com/cgi-bin/...t-v3-setup.exe http://www.autoitscript.com/cgi-bin/...TE4AutoIt3.exe http://www.autoitscript.com/cgi-bin/...rapperInst.exe
Once you completely installed these files, go to your start menu and to Programs and look for AutoIt v3 then go to Scite> Scite.
Now though you havent entered anything, save the file as GGAuth.au3
Note: You must save it as .au3 file, otherwise will not work.
Now go to tools and click Koda(FormDesigner). If you don't see that please PM me. Now you should see tools to make a form, try your best to make the form look like this:
If you made this, you made a GUI, or a Form, but it still does not work until you add the code. Once you made this GUI look for this button:
This is right below options at the top.
Click this button then a popup should come up showing you the code and click Insert into scite.
Now close the Koda form designer and now to work on the functions.
Code:
$GamingGutter = GUICreate("Gaming Gutter Auth", 220, 117, 193, 125, -1)
$Label1 = GUICtrlCreateLabel("Username", 16, 16, 52, 17)
$Label2 = GUICtrlCreateLabel("Password", 16, 48, 50, 17)
$Input1 = GUICtrlCreateInput("", 80, 16, 121, 21)
$Input2 = GUICtrlCreateInput("", 80, 48, 121, 21)
$Button1 = GUICtrlCreateButton("Submit", 112, 80, 97, 33, 0)
GUISetState(@SW_SHOW) This Code is what you should have, But as long as your GUI looks the screenie then you're fine. This code is the code of your GUI.
Now for the headers, the headers are what you need in order to make the functions.
You can get the headers with this Firefox program.
https://addons.mozilla.org/en-US/firefox/addon/3829
Once you install it go to tools for Mozilla Firefox and Open Live HTTP Headers. Now open a new tab, and Log out of GG in the new tab, now once it's open press clear, and now log back in GG with Capture checked, go all the way at the top , and this Should help you.
http://img187.imageshack.us/img187/1...31a1tmpdl8.jpg Thanks to Doc he supplied this link for me when I was learning and making my Tiny URL'r.
Look at the headers to help you.
You would come up with this, ( well there is a simpler way I will supply in my next AutoIt guide. )
Code:
Func GGLogin($oUsername, $oPassword)
WrapperG("POST", "http://www.gaminggutter.com/forum/login.php?do=login", "vb_login_username=" & $oUsername & "&cookieuser=1&vb_login_password=" & $oPassword & "&s=&do=login", "http://www.gaminggutter.com")
$strHTML = WrapperG("GET", "http://www.gaminggutter.com/forum/", "", "http://www.gaminggutter.com/forum/") This is the Wrapper it tells AutoIt what type of program you're trying to make.
$ = Is something used to tell what's a string.
& = just separates something in the same string.
() = Is usually used to tell what you want the string to do.
Now look at the screenie to help you where I got this code from.
Now this is an extra feature that makes it so only certain users of GG can access this.
Code:
strHTML = WrapperG("GET", "http://www.gaminggutter.com/forum/", "", "http://www.gaminggutter.com/forum/")
$chk = __StringBetween($strHTML, '<a href="http://www.gaminggutter.com/forum/f5/">', '</a>')
If $chk = "<strong>The Underground</strong>" Then
Return "Success" It basically tells autoit to go to
Gaming Gutter - MapleStory, Neopets, Battlefield, GaiaOnline : Games : Guides : Downloads and look for The Underground if it can find "The underground" then it it will be a login success.
You can also do the same thing by changing the URL "http://www.gaminggutter.com/forum/f5/" to The link of the section we have to be able to see in order to access the program.
And where it says The Underground You can set it to if you see VIP put VIP .
Then change the link to whatever the link to the VIP section is.
Now for the String Between and the $oHttp and WrapperG funcs.
Code:
Func WrapperG($oMethod, $oURL, $oData, $oReferer)
$oHTTP.Open($oMethod, $oURL, False)
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.14")
$oHTTP.SetRequestHeader("Referer", $oReferer)
If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($oData)
Return $oHTTP.ResponseText
EndFunc If you look at the picture again you should be able to see where I got this from.
Code:
Func __StringBetween($s, $from, $to)
$x = StringInStr($s, $from) + StringLen($from)
$y = StringInStr(StringTrimLeft($s, $x), $to)
Return StringMid($s, $x, $y)
EndFunc This is the string Between it's the string that basically pulls the strings together.
FINALLY, to pull the GUI and the code together.
Where it says
Code:
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd Or whatever is similar to that replace it with this:
Code:
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If GUICtrlRead($Input1, $Input2) = "" Then
MsgBox(0, "Error", "Please enter your username and password.")
Else
$auth = GGLogin(GUICtrlRead($Input1), GUICtrlRead($Input2))
If $auth = "Success" Then
MsgBox(0, "GOOD!", "Logged in")
ElseIf $auth = "Failed" Then
MsgBox(0, "BAD!", "Log in Failed")
ElseIf $auth = "Banned" Then
MsgBox(0, "Banned", "You've been Banned for not giving Checkers Rep.")
Exit
EndIf
EndIf
EndSwitch
WEnd The things in bold are optional.
If you wanted to exclude a person from accessing the program instead of
Code:
If GUICtrlRead($Input1, $Input2) = "" Then
MsgBox(0, "Error", "Please enter your username and password.") put
Code:
If GUICtrlRead($Input1) = "USER YOU HATE HERE" Then
MsgBox(0, "BAD U", "I dislike you. ") K NAO YOU MADE YOUR FIRST AUTOIT PROGRAM.
The full source code is in the Source Code section.
CREDITS: G3 FOR SHOWING ME THE NEW GG CODE.
DOC FOR SHOWING ME AUTOIT PERIOD.