mIRC Home    About    Download    Register    News    Help

Print Thread
#142956 20/02/06 02:04 PM
Joined: Feb 2006
Posts: 11
H
h4z4rd Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2006
Posts: 11
hello i have been trying to create a script which logins into a php webpage that requires to login first and then continue but i cant make the cookie to work.
page output is like that:

HTTP/1.1 200 OK
Date: Mon, 20 Feb 2006 13:52:11 GMT
Server: Apache/1.3.34 (Unix) mod_ssl/2.8.25 OpenSSL/0.9.7e PHP/4.4.0 FrontPage/5.0.2.2510
X-Powered-By: PHP/4.4.0
Set-Cookie: PHPSESSID=066a9ff4efb87945b73542a2201a4d62; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/html

am saving the 066a9ff4efb87945b73542a2201a4d62 as the %cookie and using it later like this:

sockwrite -n $sockname Cookie: %cookie $+ ;

but the page saying am not logged in.

any help would be thankful


The more you learn, the less you know...
#142957 20/02/06 02:58 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Try installing and running this program (shareware) and then navigate to your website using a normal browser. You will be able to see exactly what is being sent back and forth between your client and the server.

-genius_at_work

#142958 20/02/06 03:11 PM
Joined: Feb 2006
Posts: 11
H
h4z4rd Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2006
Posts: 11
i tried that program and it conficts with my antivirus program (NOD32) and my network connection doesn't even work (wont let me open any page)

Edit: i even tried to quit the antivirus but still the same problem

Last edited by h4z4rd; 20/02/06 03:14 PM.

The more you learn, the less you know...
#142959 21/02/06 01:55 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You can try other software if you can find it. I did a search for "http sniffer" in google.

-genius_at_work

#142960 21/02/06 11:28 AM
Joined: Feb 2006
Posts: 11
H
h4z4rd Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2006
Posts: 11
i decided to unistalled my antivirus and it really helped me
i got another problem tho.

when i POST the data required to continue to another page (inserting info to text boxes n clicking ok) that info i need to send is way to big for mirc to handle (like 2000+ length line) and i get error Strike too long.

is there a solution to this problem, thanks


The more you learn, the less you know...
#142961 21/02/06 02:52 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You will need to supply more information. Include the output from the HTTP Look when you went to the site using a normal browser. mIRC can't handle strings longer than about 950 chars, so you may have to use loops to send the string.

-genius_at_work

#142962 21/02/06 05:49 PM
Joined: Feb 2006
Posts: 11
H
h4z4rd Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2006
Posts: 11
well imagine this:

sockwrite -n $sockname <about 2000 length line>

i tried to send it using multiple variables and got the same error: * String too long:

how could i use it in a loop?


The more you learn, the less you know...
#142963 22/02/06 05:17 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You must be getting the 2000+ characters from somewhere (text file, dialog item, etc). If you are using a text file, the text could be broken up into several lines that are short enough for mIRC to handle, then sent to the server with /sockwrite commands (and no new-line characters, -n switch or $crlf). The server shouldn't care if you send the text in several lines, like this:

sockwrite SOCKET this is a very
sockwrite SOCKET long sentence
sockwrite SOCKET which is being
sockwrite SOCKET sent as separate
sockwrite -n SOCKET lines.

The method you use to send the data (multiple sends, loops, etc) depend on the data and the way it is stored.

-genius_at_work

#142964 22/02/06 10:11 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You can send binvars with sockwrite. So write the urlencoded text to a file and bread it, or create a bvar dynamically. Then: sockwrite -n $sockname &bvar


Gone.
#142965 22/02/06 10:14 AM
Joined: Feb 2006
Posts: 11
H
h4z4rd Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2006
Posts: 11
well there are all text boxes were u can write numbers except for 1 button were u press it to save all the numbers

the info i got from httplook is like this:

submit=done&box%5B<cookie>%5B%5D1%5D=1&box%5B<cookie>%5B%5D2%5D =2....

and so on

Last edited by h4z4rd; 22/02/06 10:17 AM.

The more you learn, the less you know...
#142966 22/02/06 10:26 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Copy the entire string that you found in httplook to a file, lets name it cookie.txt, and put it in your main mIRC folder.

Then in your code put:

bread cookie.txt 0 $file(cookie.txt) &cookie

and then one of the headers you will be sending is like:

sockwrite -n $sockname Cookie: &cookie


Gone.
#142967 22/02/06 10:40 AM
Joined: Feb 2006
Posts: 11
H
h4z4rd Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2006
Posts: 11
the cookie is not my problem its the info i send


Code:
 
  sockwrite -n $sockname POST /test.php?action=test HTTP/1.1
  sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7
  sockwrite -n $sockname Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
  sockwrite -n $sockname Accept-Language: en-us,en;q=0.5
  sockwrite -n $sockname Accept-Encoding: gzip,deflate
  sockwrite -n $sockname Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  sockwrite -n $sockname Keep-Alive: 300
  sockwrite -n $sockname Connection: keep-alive
  sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
  sockwrite -n $sockname Cookie: PHPSESSID= $+ %cookie
  sockwrite -n $sockname
  sockwrite -n $sockname submit=done&amp;box%5B&lt;cookie&gt;%5B%5D1%5D=1&amp;box%5B&lt;cookie&gt;%5B%5D2%5D =2...

 


The more you learn, the less you know...
#142968 22/02/06 10:47 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Well duh just send the binvar as postdata, as the method is 100% the same, except that I named everything cookie, and that postdata doesn't require a header. Surely you could have deducted this yourself wink

So that last line replace it with writing a binvar with the postdata that you bread from a file, which contains the postdata that you copied from httplook to that file.


Gone.
#142969 22/02/06 10:56 AM
Joined: Feb 2006
Posts: 11
H
h4z4rd Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2006
Posts: 11
problem is that postdata contains the cookie which changes all the time so i need to make a new file each time i load the socket, how can i make a line of 2000 length fit on 1 line on a txt file

i tried

/write -il1 we.txt <postdata0>
/write -il1 we.txt <postdata1>
...

but didn't work

Last edited by h4z4rd; 22/02/06 10:57 AM.

The more you learn, the less you know...
#142970 22/02/06 01:34 PM
Joined: Feb 2006
Posts: 11
H
h4z4rd Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2006
Posts: 11
thank you both very much i finally did it with binaries, they can fit any length of line..


The more you learn, the less you know...

Link Copied to Clipboard