Jump to content

HTTP Login user & pass


 Share

Recommended Posts

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.

Link to comment
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

Link to comment
Share on other sites

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() ]

Link to comment
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.

Link to comment
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...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...