Sign in to follow this  
Followers 0
ludics

HTTP Login user & pass

10 posts in this topic

I have a problem I am developing anti-cheat the question is I have that it almost finished, but I need script of login, I have then it I throw by TCP but and given account to me that I can do the same by HTTP and avoid to without making a Server-client, the thing is that of all the information that there is here, with himself not to remove script that I need. Some direct example would help me much but, for example the CMS of the Web that I go to use is webspell, so it would need script that outside compatible with the POST of the CMS.

Share this post


Link to post
Share on other sites




 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Bond if in TCP I have I throw what happens that I would like to make it in HTTP.au3 the problem comes that the examples are not very specific so I need.

Share this post


Link to post
Share on other sites

@ludics

Maybe this one....

http://www.autoitscript.com/forum/index.php?showtopic=84133

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Thanks for the connections, but that or seen e what I need is that somebody explains to me more or less since is made to be able to do login in HTTP so that I do not understand them, if somebody is so amiable, to put an example to me or to explain it to me or say is for making an authentication in webspell by means of http.au3

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

In HTTP.au3, you need to add the Authorization header. For example:

; ===================================================================
; _HTTPGet($host, $page[, $login[, $socket]])
;
; Executes a GET request on an open socket.
; Parameters:
;    $host - IN - The hostname you want to get the page from. This should be in the format "www.google.com" or "localhost"
;    $page - IN - The the file you want to get. This should always start with a slash. Examples: "/somepage.php" or "/somedirectory/somefile.zip"
;    $login - OPTIONAL IN - The login information in the format "username:password"
;    $socket - OPTIONAL IN - The socket opened by _HTTPConnect. If this is not supplied, the last socket opened with _HTTPConnect will be used.
; Returns:
;    The number of bytes sent in the request.
; Remarks:
;   Possible @errors:
;   1 - No socket supplied and no current socket exists
;   2 - Error sending to socket. Check @extended for Windows API WSAGetError return
; ===================================================================
Func _HTTPGet($host, $page, $login = "", $socket = -1)
    Dim $command
    
    If $socket == -1 Then
        If $_HTTPLastSocket == -1 Then
            SetError(1)
            Return
        EndIf
        $socket = $_HTTPLastSocket
    EndIf
    
    $command = "GET "&$page&" HTTP/1.1"&@CRLF
    $command &= "Host: " &$host&@CRLF
    If $login Then
        $command &= "Authorization: Basic "&_Base64Encode($login)&@CRLF
    EndIf
    $command &= "User-Agent: "&$_HTTPUserAgent&@CRLF
    $command &= "Connection: close"&@CRLF
    $command &= ""&@CRLF
    
    Dim $bytessent = TCPSend($socket, $command)
    
    If $bytessent == 0 Then
        SetExtended(@error)
        SetError(2)
        return 0
    EndIf
    
    SetError(0)
    Return $bytessent
EndFunc

Notice the _Base64Encode() function call? That means you need a separate Base64 encoding UDF (there are several to be found in the Example Scripts forum).

Anyhow, with this modified function, you can call _HTTPGet($host, $page, "user:pass") to login using basic HTTP auth, where "user" is your username and "pass" is your password on the server.

Edited by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

Share this post


Link to post
Share on other sites

I take all the morning and leaves from yesterday trying and with himself not to make work script in localhost, the question is if somebody an example of login of http://cms.webspell.org for example by http.au3 could put me would help me but that copying pieces of codes that I see by the forum and I am not able to make it work, the question is that I have almost it already and only I need this and I am not able to do. Thanks for the people who this helping me.

Share this post


Link to post
Share on other sites

Did you look at my post?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

If the seen e, but with himself not to find the coherence him, to make the logeo, basically will be so that I am an apprentice and not too much of the subject, but that nothing basic of c++, line of vision BASIC and php but not so that they have taught it to me if not so that been moving to me by forums and reading books to me, if as I say I have I throw anti-cheat but only I need an Array that does not leave to me either so that it is to look for in log variable that they are repeated, for example x: x: xxxxx, and: and: yyyyy, x: x: xxxxx, and: and: yyyyy, and: and: yyyyy, and: and: yyyyy to remove solely from these 6 variables 2 groups x: x: xxxxx and: and: yyyyy.

And what I do not understand of http.au3 that not like connecting it so that the program of the name and password of the user, the Web gives back with the correct or incorrect answer, simply this to him and good soon for having if a page can be read Web that only has access the program to a part of the Web to read a data base of cheats.

If somebody has an idea but on which could add for the detection of illegal programs, some advance, to improve it would be well. In order to become an idea which does it is basically to Aequitas, it creates log with the initiated programs, and those that begin during the party and close and later it is taking images during the party, it finishes is compressed and ready.

Greetings...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0