Jump to content
Ketarin forum

How to bypass mandatory license agreement for JRE/JDK?


TerDale
 Share

Recommended Posts

I used to update the latest JRE & JDK thanks to Ketarin, it used to work until a few months ago. This is when Oracle decided that if the license agreement was not checked, then an error page will be displayed even when getting the actual DL link.

Does anyone knows how to bypass it, or cheating it?

 

TIA

 

PS : here is how my "JDK" app is set up:

 

<?xml version='1.0' encoding='utf-8'?>
<Jobs>
 <ApplicationJob xmlns:xsi="[url="http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance[/url]" xmlns:xsd="[url="http://www.w3.org/2001/XMLSchema"]http://www.w3.org/2001/XMLSchema[/url]" Guid="2f5fdbb7-e5bf-4e74-8eee-3251b0b9439b">
<Category>Java</Category>
<WebsiteUrl>[url="http://www.oracle.com/"]http://www.oracle.com/[/url]{relNotes}</WebsiteUrl>
<UserAgent />
<UserNotes />
<LastFileSize>91662296</LastFileSize>
<LastFileDate>2012-03-26T17:19:32.755477</LastFileDate>
<IgnoreFileInformation>false</IgnoreFileInformation>
<DownloadBeta>Default</DownloadBeta>
<DownloadDate xsi:nil="true" />
<CheckForUpdatesOnly>true</CheckForUpdatesOnly>
<VariableChangeIndicator />
<CanBeShared>true</CanBeShared>
<ShareApplication>true</ShareApplication>
<ExclusiveDownload>false</ExclusiveDownload>
<HttpReferer />
<SetupInstructions>
  <SetupInstruction xsi:type="StartProcessInstruction">
	<EnvironmentVariables />
	<FileName>{file}</FileName>
	<Parameters />
	<WaitForExit>true</WaitForExit>
  </SetupInstruction>
</SetupInstructions>
<Variables>
  <item>
	<key>
	  <string>branch</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>Textual</VariableType>
		<Regex />
		<TextualContent>Java</TextualContent>
		<Name>branch</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>vendor</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>Textual</VariableType>
		<Regex />
		<TextualContent>Oracle</TextualContent>
		<Name>vendor</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>project</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>Textual</VariableType>
		<Regex />
		<TextualContent>{appname}</TextualContent>
		<Name>project</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>subProject</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>Textual</VariableType>
		<Regex />
		<TextualContent>/</TextualContent>
		<Name>subProject</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>projectAlias</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>Textual</VariableType>
		<Regex />
		<TextualContent />
		<Name>projectAlias</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>templateAuthor</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>Textual</VariableType>
		<Regex />
		<TextualContent>TerDale</TextualContent>
		<Name>templateAuthor</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>dlUrl</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>RegularExpression</VariableType>
		<Regex>Windows x64.+?"filepath":"(.+?)"</Regex>
		<Url>[url="http://www.oracle.com"]http://www.oracle.com[/url]{fileUrl}</Url>
		<Name>dlUrl</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>version</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>RegularExpression</VariableType>
		<Regex>Windows x64.+?"filepath":".+?jdk/(.+?)/.+?"</Regex>
		<Url>[url="http://www.oracle.com"]http://www.oracle.com[/url]{fileUrl}</Url>
		<Name>version</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>relNotes</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>RegularExpression</VariableType>
		<Regex>Current Version.+?href="(.+?)"</Regex>
		<Url>[url="http://www.oracle.com/"]http://www.oracle.com/[/url]{allRelNotes}</Url>
		<Name>relNotes</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>allRelNotes</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>RegularExpression</VariableType>
		<Regex>Java SE 7.+?>JDK</h.+?>ReadMe.+?"(.+?)"</Regex>
		<Url>[url="http://www.oracle.com/technetwork/java/javase/downloads"]http://www.oracle.com/technetwork/java/javase/downloads[/url]</Url>
		<Name>allRelNotes</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>major</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>RegularExpression</VariableType>
		<Regex>Windows x64.+?"filepath":".+?jdk/(\d).+?/.+?"</Regex>
		<Url>[url="http://www.oracle.com"]http://www.oracle.com[/url]{fileUrl}</Url>
		<Name>major</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>update</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>RegularExpression</VariableType>
		<Regex>Windows x64.+?"filepath":".+?jdk/\du(\d+).+?/.+?"</Regex>
		<Url>[url="http://www.oracle.com"]http://www.oracle.com[/url]{fileUrl}</Url>
		<Name>update</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>fileUrl</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>RegularExpression</VariableType>
		<Regex>Java SE 7.+?>JDK</h.+?href="(.+?)"</Regex>
		<Url>[url="http://www.oracle.com/technetwork/java/javase/downloads"]http://www.oracle.com/technetwork/java/javase/downloads[/url]</Url>
		<Name>fileUrl</Name>
	  </UrlVariable>
	</value>
  </item>
  <item>
	<key>
	  <string>dlFileName</string>
	</key>
	<value>
	  <UrlVariable>
		<RegexRightToLeft>false</RegexRightToLeft>
		<VariableType>RegularExpression</VariableType>
		<Regex>Windows x64.+?"filepath":".+?/(jdk-.+?)"</Regex>
		<Url>[url="http://www.oracle.com"]http://www.oracle.com[/url]{fileUrl}</Url>
		<Name>dlFileName</Name>
	  </UrlVariable>
	</value>
  </item>
</Variables>
<ExecuteCommand>{nirCmd} infobox "Copying ''{dlFileName}'' on Circle ..." "{appname} downloaded"
start /b copy "{file}" "\\Circle\partage\Technique\Software\java\{dlFileName}"</ExecuteCommand>
<ExecutePreCommand />
<ExecuteCommandType>Batch</ExecuteCommandType>
<ExecutePreCommandType>Batch</ExecutePreCommandType>
<SourceType>FixedUrl</SourceType>
<PreviousLocation>C:\users\Public\Downloads\Software\Java\Java\JDK 7 x64~7u3-b05~jdk-7u3-windows-x64.exe</PreviousLocation>
<DeletePreviousFile>true</DeletePreviousFile>
<Enabled>true</Enabled>
<FileHippoId />
<LastUpdated>2012-03-26T17:19:32.755477</LastUpdated>
<TargetPath>{base}\{branch}\{category}\{appname}~{version}~{url:basefile}.{url:ext}</TargetPath>
<FixedDownloadUrl>{dlUrl}</FixedDownloadUrl>
<Name>JDK 7 x64</Name>
 </ApplicationJob>
</Jobs>

Link to comment
Share on other sites

You don't really need to click the 'accept' box, you just need the URL to the package you're after, which you can obtain directly from the source on the page. I'm not going to load up your app profile (I don't have the time), but on the Oracle download pages, if you look in the source for ".exe" you'll find the complete URL to the download file. A little regex on that should get you the complete URL with something like this:

"(http://download.oracle.com/[^"]+-x64.exe)"

Link to comment
Share on other sites

Perhaps download from java.com instead of oracle.com?

I have JRE 7u5 from there ( search for Java x86 (Windows Offline Installer) from online DB )

Good idea and fix for the JRE, but not applicable to JDK

 

"Java Runtime Environment (Setup 32-bit)" and "Java Runtime Environment (Setup 64-bit)" from online database works as well. To switch between 32- and 64-bit you have to use the correct user agent....

OK, but also from java.com, so dead end for the JDK, thanks anyway

 

You don't really need to click the 'accept' box, you just need the URL to the package you're after, which you can obtain directly from the source on the page. I'm not going to load up your app profile (I don't have the time), but on the Oracle download pages, if you look in the source for ".exe" you'll find the complete URL to the download file. A little regex on that should get you the complete URL with something like this:

"([url="[url="[url="[url="http://download.oracle.com/"]http://download.oracle.com/[/url]"][url="http://download.oracle.com/"]http://download.oracle.com/[/url][/url]"][url="[url="http://download.oracle.com/"]http://download.oracle.com/[/url]"][url="http://download.oracle.com/"]http://download.oracle.com/[/url][/url][/url]"][url="[url="[url="http://download.oracle.com/"]http://download.oracle.com/[/url]"][url="http://download.oracle.com/"]http://download.oracle.com/[/url][/url]"][url="[url="http://download.oracle.com/"]http://download.oracle.com/[/url]"][url="http://download.oracle.com/"]http://download.oracle.com/[/url][/url][/url][/url][^"]+-x64.exe)"

Exactly what I'm doing, use to work for months till april... Since then, you're redirected to this page: http://download.orac...il-1505220.html

 

I once thought it was a cookie issue, thus tried to use the httpx trick mentioned on the wiki, but without luck.

Link to comment
Share on other sites

Yuck. They added cookie parsing to ensure that the session is validated. You can do it with httpx, but it's going to be a little complicated, since you need to parse several additional variables from the source page to compose the cookie name & value.

You'll also have to parse the source page each time from the downloads index, since it changes with different releases.

 

You need to parse the cookie value from this line:

writeSessionCookie( 'oraclelicense' + part, 'accept-securebackup-cookie' );

 

I'd use something like this:

writeSessionCookie\(\s*\'[^\']+'[^\']+'([^\']+)'

 

And for the cookie name you need to parse out the downloads variable value from this line:

downloads['jdk-7u6-oth-JPR'] = new Array();

 

I'd parse that with something like this:

downloads\['([^\']+)'\]

THEN you have to prefix that cookie name with the value from this (string + part):

writeSessionCookie\(\s*\'([^\']+)'

Link to comment
Share on other sites

Thanks Shawn, actually only the "gpw_e24" is needed, as per http://blog.kdecherf...-magic-cookies/. I checked it with wget and confirmed it worked fine.

 

So I tried using the syntax specified here: http://wiki.ketarin....=HTTPX_protocol, but I should miss something as it doesn't work...

 

Here is the log:

2012-08-21 10:23:02: Update started with 1 application(s)
2012-08-21 10:23:03: JDK 7 x64: Replacing {fileUrl} in '[url="[url="http://www.oracle.com"]http://www.oracle.com[/url]"][url="http://www.oracle.com"]http://www.oracle.com[/url][/url]{fileUrl}' with '/technetwork/java/javase/downloads/jdk7-downloads-1637583.html'
2012-08-21 10:23:03: JDK 7 x64: Replacing {dlUrl} in 'httpx{dlUrl}?cookie:gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk7-downloads-1637583.html' with '://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe'
2012-08-21 10:23:03: JDK 7 x64: Using referer: (none)
2012-08-21 10:23:33: JDK 7 x64: Failed, The operation has timed out
2012-08-21 10:23:33: JDK 7 x64: Replacing {fileUrl} in '[url="[url="http://www.oracle.com"]http://www.oracle.com[/url]"][url="http://www.oracle.com"]http://www.oracle.com[/url][/url]{fileUrl}' with '/technetwork/java/javase/downloads/jdk7-downloads-1637583.html'
2012-08-21 10:23:33: JDK 7 x64: Replacing {dlUrl} in 'httpx{dlUrl}?cookie:gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk7-downloads-1637583.html' with '://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe'
2012-08-21 10:23:33: JDK 7 x64: Using referer: (none)
2012-08-21 10:23:34: JDK 7 x64: Server source file: /otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe
2012-08-21 10:23:34: JDK 7 x64: Failed, The downloaded file is not a binary file type (text/html). Possibly there is an error page. Status code: 200 (OK)
2012-08-21 10:23:35: JDK 7 x64: Replacing {fileUrl} in '[url="[url="http://www.oracle.com"]http://www.oracle.com[/url]"][url="http://www.oracle.com"]http://www.oracle.com[/url][/url]{fileUrl}' with '/technetwork/java/javase/downloads/jdk7-downloads-1637583.html'
2012-08-21 10:23:35: JDK 7 x64: Replacing {dlUrl} in 'httpx{dlUrl}?cookie:gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk7-downloads-1637583.html' with '://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe'
2012-08-21 10:23:35: JDK 7 x64: Using referer: (none)
2012-08-21 10:23:35: JDK 7 x64: Server source file: /otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe
2012-08-21 10:23:35: JDK 7 x64: Failed, The downloaded file is not a binary file type (text/html). Possibly there is an error page. Status code: 200 (OK)
2012-08-21 10:23:35: Update finished

 

Any clue? Thanks for your help

Edited by TerDale
Link to comment
Share on other sites

That may have been the case back in April, but the cookie that's assigned today doesn't indicate gpw_e24 anywhere. I suggest you try your script with the following cookie and see if that works. If it does, you should probably use the method above, as the cookie is explicitly designed to be altered for different products and releases:

oraclelicensejdk-7u6-oth-JPR=accept-securebackup-cookie

Link to comment
Share on other sites

That may have been the case back in April, but the cookie that's assigned today doesn't indicate gpw_e24 anywhere. I suggest you try your script with the following cookie and see if that works. If it does, you should probably use the method above, as the cookie is explicitly designed to be altered for different products and releases:

oraclelicensejdk-7u6-oth-JPR=accept-securebackup-cookie

I have confirmed that gpw_e24 is still the magic cookie:

So, the solution is to set the gpw_e24 cookie to any value, as stated at http://blog.kdecherf...-magic-cookies/.

Now I just need to fix the syntax I used, from what I've seen, using this HTTPX URL fails (also tried with simpler cookie values):

httpx://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?cookie:gpw_e24=http%3A%2F%2Fwww.oracle.com

I get:

JDK 7 x64 The downloaded file is not a binary file type (text/html). Possibly there is an error page. Status code: 200 (OK) (httpx://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?cookie:gpw_e24=http%3A%2F%2Fwww.oracle.com)

 

Thus I guess that the syntax I'm using should be incorrect, is it? (though it follows what is specified on the wiki)

Link to comment
Share on other sites

If "Cookie" is used in the HTTPX URL, it is not interpreted by Ketarin, verified with Wireshark.

 

Checked the difference between wget & Ketarin using Wireshark:

- both send: "GET /otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe HTTP/1.0\r\n" with cookie set

- both receive "HTTP/1.0 302 Moved Temporarily\r\n", with "Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe"

- then:

- wget resends "GET /otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam=1345542419_d9ef9b9c3bf21654dfb8802594d430f1 HTTP/1.0\r\n" => download starts

- Ketaring sends "GET /errors/download-fail-1505220.html HTTP/1.1\r\n", and receives "HTTP/1.1 200 OK\r\n" => no download

Link to comment
Share on other sites

That doesn't make sense. I thought for a minute that AuthParam might be something generated via client-side script, but wget doesn't parse scripts either. The only other thing that comes to mind is maybe the referer header. Are you setting the referer?

Link to comment
Share on other sites

OK, understood the AuthParam issue, here is the wget output (was too focused on the network capture):

wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com;" [url="[url="http://download.orac"]http://download.orac[/url]"][url="http://download.orac"]http://download.orac[/url][/url] le.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe
--2012-07-28 11:28:41--  [url="[url="http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe"]http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe[/url]"][url="http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe"]http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe[/url][/url]
Resolving download.oracle.com... 80.239.178.177, 80.239.178.146
Connecting to download.oracle.com|80.239.178.177|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: [url="[url="https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe"]https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe[/url]"][url="https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe"]https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe[/url][/url] [following]
--2012-07-28 11:28:41--  [url="[url="https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe"]https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe[/url]"][url="https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe"]https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe[/url][/url]
Resolving edelivery.oracle.com... 2.17.18.174
Connecting to edelivery.oracle.com|2.17.18.174|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: [url="[url="http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam=1345621896_de1"]http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam=1345621896_de1[/url]"][url="http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam=1345621896_de1"]http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam=1345621896_de1[/url][/url] 5999d9ded9cbcf10cc0c0300d9345 [following]
--2012-07-28 11:28:42--  [url="[url="http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam"]http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam[/url]"][url="http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam"]http://download.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe?AuthParam[/url][/url] =1345621896_de15999d9ded9cbcf10cc0c0300d9345
Reusing existing connection to download.oracle.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 94385632 (90M) [application/octet-stream]
Saving to: `jdk-7u6-windows-x64.exe?AuthParam=1345621896_de15999d9ded9cbcf10cc0c0300d9345'

So the 2nd "302 Moved Temporarily" gives the AuthParam to be used.

Wonder why I didn't see it in the network capture....

 

So, wondering if Ketarin wouldn't be supposed to use the "Location" field upon 302 to reissue its request? If it would, it would succeed as wget.

Sounds like a bug, what do you think?

Link to comment
Share on other sites

Yes, this looks like a bug, probably not pushing the cookie again thru the 302.

Actually, the cookie is properly pushed upon both retries after receiving the 302. FMPOV the bug is the fact that Ketarin ignore the "Location" field provided with the 302 and retries instead with the original URL. See attached capture showing this.

Something else puzzles me in this capture: one can see that, after teh two first 302 error, Ketarin is first getting "/errors/download-fail-1505220.html", before trying again the original URL, but can't understand where it find this error URL from. Looks like it is inferred from the 302, but the three 302 errors are stating "Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u6-b24/jdk-7u6-windows-x64.exe" so...!?

 

Anyway, time to file a bug for Flo, I think.

 

However, there's an alternative. Since you're using wget already, you can use the "pre-update" script in Ketarin to perform an external download via wget. Here's an example.

Thanks for the tip, will try it

 

And for your help to track down this issue ;-)

Ketarin-OracleJDK.zip

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.