Page 1 of 1

encrypted html

Posted: 2006-12-26 00:20:17
by ABNormal
here i am again with another problem
i have to read a web page but its source is encrypted.
is it possible (and how) not to read the "source code" but the "simple text" that is created (what is shown on video).

i've tried to save in a file that page and:
if i save it as HTML, the saved file is a crypted serie of numbers
if i save it as SIMPLE TXT, the saved files show me the unformatted text (the words shown in video).

for your test the page is http://www.o-tsn.com/sports/all.html

thx
ABN

Posted: 2006-12-26 00:41:44
by antp
It is Javascript "encryption". But this is somewhat lame as it is just the HTML page text that is encoded in URL-style entities.

So you would have to write in Delphi what is written in Javascript. Here is a function that should decode this:

Code: Select all

function Unescape(s: string): string;
var
  i, L: Integer;
  c: Char;
begin
  L := Length(s);
  i := 1;
  Result := '';
  while i <= L do
  begin
    if (i <= L + 2) and (StrGet(s, i) = '%') then
    begin
      c := Chr(StrToInt('$' + StrGet(s, i + 1) + StrGet(s, i + 2), 0));
      Result := Result + c;
      i := i + 3;
    end
    else
      i := i + 1;
  end;
end;
(just give to it as parameter the long string that is given to the Javascript unescape function)