mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2006
Posts: 47
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
I'm trying to get mIRC to read off a given page for pageaday.com, like http://pageaday.com/pad/editorial/front/2006STUP/01JAN/02/. Nothing terribly important, but it would be nice if I could get this to work. I've tried looking up information on handling cookies but none of that's worked...

In ON *:SOCKREAD, I've tried both GET and POST.
When I try to use POST to go directly to the site, mIRC gets sent this page: http://pageaday.com/pub-bin/paduserlogin...-google-adsense

Code:
  .sockwrite -nt $sockname GET /pub-bin/paduserlogin.pl?rm=setuser&target_uri=/pad/editorial/front/2004STUP/
01JAN/02/&email=[[EMAIL@ADDRESS]]&password=[[PASSWORD]] HTTP/1.0 $+ $crlf $+ $crlf 

gets me:
Code:
- HTTP/1.1 302 Moved
- Date: Fri, 11 Aug 2006 20:38:57 GMT
- Server: Apache/1.3.33 (Unix) mod_perl/1.29
- Set-Cookie: PADSID=1155328737.558714CjPnjzCOiJDVLEhRiW7/dQ; path=/
- Pragma: no-cache
- Cache-control: no-cache
- Location: /pad/editorial/front/2004STUP/01JAN/02/
- Content-Type: text/plain
- Expires: Fri, 11 Aug 2006 20:38:57 GMT
- X-Cache: MISS from www.pageaday.com
- Connection: close
- Redirect: /pad/editorial/front/2004STUP/01JAN/02/
- 302 Moved
- Moved
- The document has moved here.
- Apache/1.3.33 Server at www.pageaday.com Port 80



Here's the whole code (with old tries commented out):
Code:
alias otherpage {
  .sockclose otherpage
  .sockopen otherpage pageaday.com 80
}
on *:SOCKOPEN:otherpage:{
  .sockwrite -nt $sockname GET /pub-bin/paduserlogin.pl?rm=setuser&target_uri=/pad/editorial/front/2004STUP/01JAN/02/&email=[[EMAIL_ADDRESS]]&password=[[PASSWORD]] HTTP/1.0 $+ $crlf $+ $crlf
  ;.sockwrite -nt $sockname POST http://pageaday.com/pub-bin/paduserlogin.pl?rm=setuser&target_uri=/pad/editorial/front/2004STUP/01JAN/02/&email=[[EMAIL_ADDRESS]]&password=[[PASSWORD]]
  ;.sockwrite -nt $sockname POST http://pageaday.com/pad/editorial/front/2004STUP/01JAN/02/
  ;.sockwrite -nt $sockname Cookie: PADSID=1155323009.847156uHwUmGYmOVRMS8YhGtgknw;
  ;.sockwrite -nt $sockname Cookie: GV= $+ $readcookie(blah,www.pageaday.com,PADUID) $+ ; SID= $+ $readcookie(blah,pageaday.com,PADUID) $+ ;
}
on *:SOCKREAD:otherpage:{
  /var %other
  .sockread %other
  if ($htmlfree(%other)) /echo $chan - $htmlfree(%other)
}
alias htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  return $remove(%x,&,$chr(9))
}

Joined: Dec 2005
Posts: 58
S
Babel fish
Offline
Babel fish
S
Joined: Dec 2005
Posts: 58
Send This Datas on sockopen event ;

POST /pub-bin/paduserlogin.pl HTTP/1.1
Host: pageaday.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://pageaday.com/pub-bin/paduserlogin.pl
Cookie: COOKIE
Content-Type: application/x-www-form-urlencoded
Content-Length: $calc($len(blah%40hotmail.com) + $len(YOURPASS) + 38)

rm=setuser&target_uri=&email=blah%40hotmail.com&password=YOURPASS


i like that
Joined: Mar 2006
Posts: 47
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
Now my SOCKOPEN event is as below, but nothing happens, and it doesn't trigger the SOCKREAD event. I've tried the post code as
Code:
 .sockwrite -nt $sockname POST /pub-bin/paduserlogin.pl?rm=setuser&target_uri=/pad/editorial/front/2004STUP/01JAN/02/&email=[[[EMAIL ADDRESS]]]&password=[[[PASSWORD]]] HTTP/1.1 

as well. I've also tried using a $urlencode alias just in case it didn't like something in my email/password.
Code:
on *:SOCKOPEN:otherpage:{
  .sockwrite -nt $sockname POST /pub-bin/paduserlogin.pl HTTP/1.1
  .sockwrite -nt $sockname Host: pageaday.com
  .sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
  .sockwrite -nt $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 -nt $sockname Accept-Language: en-us,en;q=0.5
  .sockwrite -nt $sockname Accept-Encoding: gzip,deflate
  .sockwrite -nt $sockname Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  .sockwrite -nt $sockname Keep-Alive: 300
  .sockwrite -nt $sockname Connection: keep-alive
  .sockwrite -nt $sockname Referer: http://pageaday.com/pub-bin/paduserlogin.pl
  .sockwrite -nt $sockname Cookie: COOKIE
  .sockwrite -nt $sockname Content-Type: application/x-www-form-urlencoded
  .sockwrite -nt $sockname Content-Length: $calc($len([[[EMAIL ADDRESS]]]) + $len([[[PASSWORD]]]) + 38)
  .sockwrite -nt $sockname rm=setuser&target_uri=/pad/editorial/front/2004STUP/01JAN/02/&email=[[[EMAIL ADDRESS]]]&password=[[[PASSWORD]]]
}


With both of the above POST lines, if I remove the HTTP/1.1 part, I get the standard login page.

Last edited by CitizenKane; 12/08/06 01:39 AM.
Joined: Dec 2005
Posts: 58
S
Babel fish
Offline
Babel fish
S
Joined: Dec 2005
Posts: 58
Try This ;
Code:
alias start { sockopen $+(started,$ctime) www.pageaday.com 80 }
alias -l cooked { sockopen $+(otherpage,$ctime) www.pageaday.com 80 }
on *:SockOpen:started*:{
  sockwrite -n $sockname GET / HTTP/1.1
  sockwrite -n $sockname host: pageaday.com
  sockwrite -n $sockname $crlf
}
on *:SockRead:started*:{
  var %a
  sockread %a
  if (Set-Cookie isin %a) { set %sjn.cook $remove($gettok(%a,2,32),;) | sockclose started* | cooked }
}
on *:SockOpen:otherpage*:{
  var %mail YOURMAIL@hotmail.com , %pass YOURPASS
  .sockwrite -nt $sockname POST /pub-bin/paduserlogin.pl HTTP/1.1
  .sockwrite -nt $sockname Host: pageaday.com
  .sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
  .sockwrite -nt $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 -nt $sockname Accept-Language: en-us,en;q=0.5
  .sockwrite -nt $sockname Accept-Encoding: gzip,deflate
  .sockwrite -nt $sockname Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  .sockwrite -nt $sockname Keep-Alive: 300
  .sockwrite -nt $sockname Connection: keep-alive
  .sockwrite -nt $sockname Referer: http://www.pageaday.com/pub-bin/paduserlogin.pl?target_uri=%2fpad-bin%2fmyaccountmanager.pl&auth_fail=valid-user
  .sockwrite -nt $sockname Cookie: %sjn.cook
  .sockwrite -nt $sockname Content-Type: application/x-www-form-urlencoded
  .sockwrite -nt $sockname Content-Length: $calc($len(%mail) + $len(%pass) + 71)
  .sockwrite -nt $sockname  
  .sockwrite -nt $sockname rm=setuser&target_uri=%2Fpad-bin%2Fmyaccountmanager.pl&email= $+ %mail $+ &password= $+ %pass
  .sockwrite -nt $sockname $crlf
}
on *:SockRead:otherpage*:{
  var %a
  sockread %a
  if (Redirect: isin %a) { set %get $gettok($gettok(%a,3,32),2,$asc(")) | sockopen $+(moved,$ctime) www.pageaday.com 80 | sockclose otherpage* }
}
on *:SockOpen:moved*:{
  sockwrite -n $sockname GET %get HTTP/1.1
  sockwrite -n $sockname host: pageaday.com
  sockwrite -n $sockname Cookie: %sjn.cook
  sockwrite -n $sockname $crlf
}
on *:SockRead:moved*:{
  var %a
  sockread %a
  echo -a %a
}


/start


i like that
Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
I don't know if this is the issue or not, but I thought I'd point this out, since it is one of those problems that drives you crazy trying to find, if it is a problem. Referrer has two R's. It's spelled with only one in the script. Other than that, I don't know much about using a login in sockets. Good luck.

Joined: Mar 2006
Posts: 47
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
Okay! Progress. The code above gets me to my account manager correctly, so much thanks for getting me this far. But now I need to figure out how to get it to the specific address I want (i.e. http://pageaday.com/pad/editorial/front/2004STUP/01JAN/02/ ) Any attempt I make to alter the code, though, like the "target_uri="... results in nothing appearing when I use /start.

EDIT: Cancel that! I finally found the fix that makes it work the way I wanted.:
Code:
on *:SockOpen:moved*:{
  sockwrite -n $sockname GET /pad/editorial/front/2004STUP/01JAN/02/ HTTP/1.1
  sockwrite -n $sockname host: pageaday.com
  sockwrite -n $sockname Cookie: %sjn.cook
  sockwrite -n $sockname $crlf
}

I just needed to manually change the %get value, which was being assigned the url for the manager. Is there any way to reduce the number of sockopen calls from 3 to 2? The first one gets a cookie, the second one sends the login info, and the third one goes straight to the page.

Last edited by CitizenKane; 12/08/06 02:14 PM.
Joined: Dec 2005
Posts: 58
S
Babel fish
Offline
Babel fish
S
Joined: Dec 2005
Posts: 58
Code:
alias start { sockopen $+(started,$ctime) www.pageaday.com 80 }
alias -l cooked { sockopen $+(otherpage,$ctime) www.pageaday.com 80 }
on *:SockOpen:started*:{
  sockwrite -n $sockname GET / HTTP/1.1
  sockwrite -n $sockname host: pageaday.com
  sockwrite -n $sockname $crlf
}
on *:SockRead:started*:{
  var %a
  sockread %a
  if (Set-Cookie isin %a) { set %sjn.cook $remove($gettok(%a,2,32),;) | sockclose started* | cooked }
}
on *:SockOpen:otherpage*:{
  var %mail YOURMAIL@hotmail.com , %pass YOURPASS   
  .sockwrite -nt $sockname POST /pub-bin/paduserlogin.pl HTTP/1.1
  .sockwrite -nt $sockname Host: pageaday.com
  .sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
  .sockwrite -nt $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 -nt $sockname Accept-Language: en-us,en;q=0.5
  .sockwrite -nt $sockname Accept-Encoding: gzip,deflate
  .sockwrite -nt $sockname Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  .sockwrite -nt $sockname Keep-Alive: 300
  .sockwrite -nt $sockname Connection: keep-alive
  .sockwrite -nt $sockname Referer: http://pageaday.com/pub-bin/paduserlogin.pl?target_uri=%2fpad%2feditorial%2ffront%2f2004STUP%2f01JAN%2f02%2f&auth_fail=valid-user-or-google-adsense
  .sockwrite -nt $sockname Cookie: %sjn.cook
  .sockwrite -nt $sockname Content-Type: application/x-www-form-urlencoded
  .sockwrite -nt $sockname Content-Length: $calc($len(%mail) + $len(%pass) + 92) 
  .sockwrite -nt $sockname  
  .sockwrite -nt $sockname rm=setuser&target_uri=%2Fpad%2Feditorial%2Ffront%2F2004STUP%2F01JAN%2F02%2F&email= $+ %mail $+ &password= $+ %pass
  .sockwrite -nt $sockname $crlf
}
on *:SockRead:otherpage*:{
  var %a
  sockread %a 
  if (Redirect: isin %a) { set %get $gettok($gettok(%a,3,32),2,$asc(")) | sockopen $+(moved,$ctime) www.pageaday.com 80 | sockclose otherpage* }
}
on *:SockOpen:moved*:{
  sockwrite -n $sockname GET %get HTTP/1.1
  sockwrite -n $sockname host: pageaday.com
  sockwrite -n $sockname Cookie: %sjn.cook
  sockwrite -n $sockname $crlf
}
on *:SockRead:moved*:{
  var %a
  sockread %a
  echo -a %a
}


try this.


i like that
Joined: Mar 2006
Posts: 47
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
I'm not sure if you saw my last edit, but in any case, your latest code works exactly as I wanted. Is it necessary to make three sockopen calls to get this result? It does seem like it, as far as I can tell, but I just wanted to make sure. Thanks for everything!


Link Copied to Clipboard