automatic login and download file

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

boysky76
Posts: 48
Joined: Tue Aug 13, 2013 9:49 am

automatic login and download file

Post by boysky76 » Thu Aug 22, 2013 2:43 pm

I wanted to know if we could get to download a file from a file hosting site, I'll explain, I can access the site through the call url with a query string like this:

sitename?op=login&redirect=sitename/esnbj1t8ki32/filename.rar.htm&login=login&password=password



in this way I log onto my site and I come to the web page that contains a button "continue with download"
page source code:

[code][*][color=#00FF00]--<Form Method="POST" name="F1" action=''>--

<input type="hidden" name="op" value="download2">
<input type="hidden" name="id" value="esnbj1t8ki32">
<input type="hidden" name="rand" value="qs4wv2swsv4ekcbv3uuyfwrkret3hcnucvzbfii">
--<input type="hidden" name="referer" value="sitename/filename.rar">--
<input type="hidden" name="method_free" value="">
<input type="hidden" name="method_premium" value="1">[/color]
[/code]

Which brings me to a page of the site that contains another "download" button:

page source code:

[code][*][color=#40FF00]Form << method = "POST" action =''>

<input type="hidden" name="op" value="download1">
<input type="hidden" name="usr_login" value="">
<input type="hidden" name="id" value="esnbj1t8ki32">
<input type="hidden" name="fname" value="filename.rar">
<input type="hidden" name="referer" value="">[/color][/code]

the button "download" using this command line:
[code]
[*][color=#FFFF00]<input type="button" value="Download" name="submit_btn" class="button_input_download" onclick="parent.location='serversitename/d/6lgijo2mppnwfywjvipi4foknemabby3gygexwce7xrb6gmb6d3dppu3/filename.rar.htm'"></input>
[/color][/code]

in practice I would like to get to the file downloaded there every time without going through the two buttons, there is a command that give me back the "parent.location" button download site.

I hope I explained, I am available for more questions.

thanks[/quote][/quote]
Last edited by boysky76 on Wed Sep 11, 2013 9:11 pm, edited 1 time in total.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: automatic login and download file

Post by BvG » Fri Aug 23, 2013 12:49 pm

look up the post command in the dictionary.

Code: Select all

post url "op=download2&id=esnbj1t8ki32&rand=qs4wv2swsv4ekcbv3uuyfwrkret3hcnucvzbfii&referer=sitename/filename.rar&method_premium=1" to url sitename
put it
note this is a nonfunctional example, you also need to urlencode your strings (see "urlencode" in the dictionary)!
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

boysky76
Posts: 48
Joined: Tue Aug 13, 2013 9:49 am

Re: automatic login and download file

Post by boysky76 » Fri Aug 23, 2013 2:09 pm

thanks for the reply, I looked in the dictionary as input the commands and controls urlencode post but do not understand how will insert and image parameters correctly to receive in response to the download link.

Could you give me a more practical example.

thanks

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: automatic login and download file

Post by BvG » Fri Aug 23, 2013 7:43 pm

I'm not sure what you mean, but i suggest to use variables for changing inputs:
post url "op=download2&id=esnbj1t8ki32&rand=qs4wv2swsv4ekcbv3uuyfwrkret3hcnucvzbfii&referer=sitename/filename.rar&method_premium=1" to url sitename

Code: Select all

put "download2" into op
put "esnbj1t8ki32" into id
--etc.
put op & "&" & id & "&" & "some more text"
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

boysky76
Posts: 48
Joined: Tue Aug 13, 2013 9:49 am

Re: automatic login and download file

Post by boysky76 » Wed Sep 11, 2013 12:45 pm

I still have not solved the problem, what I would like is to create a small download manager for a site like ddlstorage . com, I manage to get to the page where there is the download button, I'm stuck here.
Moving on from the browser should first click on a button "go to download" and this opens a new page with an additional "download" button that when clicked download the file.
I would skip these two steps and get to the direct link to download.


this is the first query string that gives me access to the site and download the file, and everything is right

h t p p://w w w . d d l s t o r a g e . c o m / ? op = login & redirect= h t p p://w w w . d d l s t o r a g e . c o m /ygizctnxtmdo&login=login&password=password




I hope I explained, it's just a simple download manager for a site.
Last edited by boysky76 on Wed Sep 11, 2013 8:15 pm, edited 1 time in total.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: automatic login and download file

Post by BvG » Wed Sep 11, 2013 7:06 pm

It's not necessary to post an url. instead, you would do better by specifying a more exact and smaller part of your problem, so people here can give you specific help. Until then, here's some general help:


Try a stab at reading the documentation pdf (help menu -> user guide). Spend extra time on chapters 6 for learning how to manipulate strings (like for example an url), as well as chapter 11 (general internet & urls).

lessons:
http://lessons.runrev.com/s/lessons/m/4 ... revolution
http://lessons.runrev.com/s/lessons/m/2 ... -directory

dictionary (pay special attention to the "see also" parts):
url
&
&&
,
comma
http
put
get
into
after
before


As a side note, i also suggest never to post login information to public forums, and hope you remove those parts of the url.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

boysky76
Posts: 48
Joined: Tue Aug 13, 2013 9:49 am

Re: automatic login and download file

Post by boysky76 » Wed Sep 11, 2013 8:26 pm

Thanks for the reply, I removed the login data as suggested by you.
The problem is that I need to download the files stored in that site written above through a small downloader created with LiveCode to by-pass directly from the site.
  But if you enter the url before you get to download from the site, you need to log in (and thus far no problem) then goes through two confirmations of downloads that are the ones that stop me, the php page is what I I posted above.

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: automatic login and download file

Post by SparkOut » Wed Sep 11, 2013 8:53 pm

You still have the login details at the top of the very first post!

boysky76
Posts: 48
Joined: Tue Aug 13, 2013 9:49 am

Re: automatic login and download file

Post by boysky76 » Wed Sep 11, 2013 9:11 pm

now is deleted ;) thnx

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: automatic login and download file

Post by Simon » Wed Sep 11, 2013 9:30 pm

Hi boysky76,
I'm going to go out on a limb here.
You might not ever be able to crack this, most login websites are built to prevent machine attacks (which eventually is what you could do with your request). The one thing you do have going for you is that you can embed your password into the url.

You might try using a revBrowser control and the "click" command??? Not even sure the click command works with revBrowser.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: automatic login and download file

Post by SparkOut » Wed Sep 11, 2013 9:47 pm

I think you could do this - I have done similar things on a number of sites for automatic population of dealer stock levels from head office data files, etc. What you have to do is to parse the headers and make sure the right session cookies are set, and use libURL to mimic browser actions. (This means it won't be workable for iOS or Android at the moment, as far as I know). I'm taking a look now to see if something could be adapted. I don't know the structure of the site in question though ... entonces lo siento si no es possible sin más información.


Do you actually have a test file uploaded on that site at present?

boysky76
Posts: 48
Joined: Tue Aug 13, 2013 9:49 am

Re: automatic login and download file

Post by boysky76 » Wed Sep 11, 2013 10:31 pm

the last lines of your text are in Spanish, if you prefer to write in Spanish is much better for me, since I live in spain;) ..... for what concerns the file to download this is the url of one file:

http:// www. ddlstorage. c o m /ygizctnxtmdo

If you need the data for the log I can give it to you in private message.

these are the codes of the two php pages to login to download, if they can be useful.

first:

<Form method="POST" name="F1" action=''>

<input type="hidden" name="op" value="download2">
<input type="hidden" name="id" value="ygizctnxtmdo">
<input type="hidden" name="rand" value="fln4q2tw6p5jlh6mrh2xrx4z5yslxmx4mxbixyi">
<input type="hidden" name="referer" value="">
<input type="hidden" name="method_free" value="">
<input type="hidden" name="method_premium" value="1">
second:

<Form method="POST" action=''>

<input type="hidden" name="op" value="download1">
<input type="hidden" name="usr_login" value="">
<input type="hidden" name="id" value="ygizctnxtmdo">
<input type="hidden" name="fname" value="Web_Idea_Settembre_2013.pdf">
<input type="hidden" name="referer" value="">

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: automatic login and download file

Post by SparkOut » Thu Sep 12, 2013 9:15 pm

ddlstorage seems to be broken or blocked for me at the moment. http attempts tell me "DDLStorage temporarily unavailable from your region" and https attempts give an error "SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)"

boysky76
Posts: 48
Joined: Tue Aug 13, 2013 9:49 am

Re: automatic login and download file

Post by boysky76 » Thu Sep 12, 2013 9:23 pm

you must reset the router, sometimes block the ip.

;)

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: automatic login and download file

Post by SparkOut » Sat Sep 14, 2013 10:46 pm

This is tricky to interpret but kind of fun with some interesting steps along the way. Making progress.

Post Reply