School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,120 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,955 people online right now. Registration is fast and FREE... Join Now!




[Perl] Script that submits a 'login' and downloads an html fil

 

[Perl] Script that submits a 'login' and downloads an html fil

liamzdenek

19 Oct, 2009 - 07:26 PM
Post #1

New D.I.C Head
*

Joined: 19 Oct, 2009
Posts: 1

I read that watermark on the submit text box...

I have no code to show, I just know what I need to do, but -zero- clue how to do it.

Basically:

I need a script that submits the form at http://www.minecraft.net/login.jsp with parameters username='foo' and password='bar'

After submitting that form, the script uses the cookie received from submitting that form to load and save the html from http://www.minecraft.net/play.jsp in a text file


--

To help you with an understanding of why this is needed:
the /play.jsp file has two parameters (for the game client) on the page that are otherwise not there if you do not log in

One is your username
The other is your 'verify' code (to proove your not spoofing by sending a fake nick)

I am trying to create a bot that connects to a server, and it needs to get the 'verify' param

Thanks in advance,
Liam

This post has been edited by liamzdenek: 19 Oct, 2009 - 07:28 PM

User is offlineProfile CardPM
+Quote Post


88EighT88

RE: [Perl] Script That Submits A 'login' And Downloads An Html Fil

17 Nov, 2009 - 12:32 PM
Post #2

New D.I.C Head
*

Joined: 17 Nov, 2009
Posts: 1

QUOTE(liamzdenek @ 19 Oct, 2009 - 07:26 PM) *

I read that watermark on the submit text box...

I have no code to show, I just know what I need to do, but -zero- clue how to do it.

Basically:

I need a script that submits the form at http://www.minecraft.net/login.jsp with parameters username='foo' and password='bar'

After submitting that form, the script uses the cookie received from submitting that form to load and save the html from http://www.minecraft.net/play.jsp in a text file


--

To help you with an understanding of why this is needed:
the /play.jsp file has two parameters (for the game client) on the page that are otherwise not there if you do not log in

One is your username
The other is your 'verify' code (to proove your not spoofing by sending a fake nick)

I am trying to create a bot that connects to a server, and it needs to get the 'verify' param

Thanks in advance,
Liam


Ok so i just started with Python but i have written this with a bunch of other sites hopefully it helps you.


CODE
import urllib
      import urllib2
      import cookielib
      
      cookiejar = cookielib.CookieJar()
      urlOpener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))
      urllib2.install_opener(urlOpener)
      
      values = {'loginID': 'foo', 'password': 'bar'}
      data = urllib.urlencode(values)
      request = urllib2.Request('http://www.minecraft.net/login.jsp',data)
      url = urlOpener.open(request)
      print url.read()


don't know if it is precisely correct but maybe u can make something out of it and email me ur version if it works please

Regards

This post has been edited by 88EighT88: 17 Nov, 2009 - 12:34 PM
User is offlineProfile CardPM
+Quote Post

numberwhun

RE: [Perl] Script That Submits A 'login' And Downloads An Html Fil

17 Nov, 2009 - 08:04 PM
Post #3

New D.I.C Head
*

Joined: 28 Mar, 2008
Posts: 17


My Contributions
QUOTE(liamzdenek @ 19 Oct, 2009 - 07:26 PM) *

I read that watermark on the submit text box...

I have no code to show, I just know what I need to do, but -zero- clue how to do it.

Basically:

I need a script that submits the form at http://www.minecraft.net/login.jsp with parameters username='foo' and password='bar'

After submitting that form, the script uses the cookie received from submitting that form to load and save the html from http://www.minecraft.net/play.jsp in a text file


--

To help you with an understanding of why this is needed:
the /play.jsp file has two parameters (for the game client) on the page that are otherwise not there if you do not log in

One is your username
The other is your 'verify' code (to proove your not spoofing by sending a fake nick)

I am trying to create a bot that connects to a server, and it needs to get the 'verify' param

Thanks in advance,
Liam


My recommendation to you is to use the WWW::Mechanize module (in Perl). Its not that difficult to figure out and it can handle your logging in and downloading what you need.

Regards,

Jeff


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 01:49PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month