Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Video stream recording (http://stream-recorder.com/forum/forumdisplay.php?f=4)
-   -  

how to decrypt and decode png files to real file (.ass)

(http://stream-recorder.com/forum/showthread.php?t=16727)

gaaara 11-10-2013 11:53 PM

how to decrypt and decode png files to real file (.ass)


 
Hi,

I have an coded and encrypted .png file that I would like to decrypt and decode using an « ActionScript » fonction.

I know it’s coded using « basse64 » but I have no ideas what it is encrypted with. This fonction has what it takes to decrypt and decode and I want to use it to get the original .ass file.

I don’t have all the informations but I really am looking forward to make this all work.

Step #1 : Discovery of the encryption
Step #2 : Make the modifications to use the fonction to grab the .ass file.

Quote:

public static function decryptSubtitle(param1:String, param2:String = "5463201897") : String {
var _loc_7:String = null;
var _loc_8:int = 0;
var _loc_9:int = 0;
var _loc_10:int = 0;
var _loc_3:* = new ByteArray();
var _loc_4:String = "";
var _loc_5:int = 0;
while (_loc_5 < param1.length)
{

_loc_7 = param1.substr(_loc_5, 1);
_loc_8 = parseInt(param2.substr(_loc_5 % param2.length - 1, 1));
_loc_9 = _loc_7.charCodeAt(0);
_loc_10 = _loc_9 - _loc_8;
_loc_7 = String.fromCharCode(_loc_10);
_loc_4 = _loc_4 + _loc_7;
_loc_5++;
}
var _loc_6:* = Base64.decode(_loc_4).replace(/?»?""?»?/, "");
_loc_3.writeMultiByte(_loc_6, "iso-8859-1");
return _loc_3.toString();
}// end function
link for this files animedigitalnetwork dot fr/picture_3615.png
A++

KSV 11-11-2013 10:14 AM

Re: how to decrypt and decode png files to real file (.ass)


 
you can use the following php script to decode the subtitles file.

Code:

<?php
  function decryptSubtitle($encrypted, $key = "5463201897")
    {
      $decrypted    = "";
      $encryptedLen = strlen($encrypted);
      $keyLen      = strlen($key);
      for ($i = 0; $i < $encryptedLen; $i++)
        {
          $dataCharCode = ord($encrypted[$i]);
          $keyInt      = substr($key, ($i % $keyLen) - 1, 1);
          $decodedChar  = chr($dataCharCode - $keyInt);
          $decrypted    = $decrypted . $decodedChar;
        }
      $decrypted = base64_decode($decrypted);
      return $decrypted;
    }

  file_put_contents("decrypted_subtitles.txt", decryptSubtitle(file_get_contents("http://animedigitalnetwork.fr/picture_3615.png")));
?>

PS: also don't ask the basic questions like how i can install php or use this script etc. it's trivial to rewrite this script to your language of choice.

gaaara 11-11-2013 11:35 AM

Re: how to decrypt and decode png files to real file (.ass)


 
resolved !! tx

KSV 11-11-2013 10:42 PM

Re: how to decrypt and decode png files to real file (.ass)


 
you have posted my decryption script to several websites without mentioning the original author or this thread. this is not how it's supposed to be. you can't present someone else's work as your own. i have wasted time to look at your problem and come up with a working solution. so atleast give the credit where it's due.

gaaara 11-12-2013 07:06 AM

Re: how to decrypt and decode png files to real file (.ass)


 
sorry I did not think about it .... and I can remove all on your request :(

KSV 11-12-2013 10:50 AM

Re: how to decrypt and decode png files to real file (.ass)


 
Quote:

Originally Posted by gaaara (Post 63908)
sorry I did not think about it .... and I can remove all on your request :(

i am not against sharing of the script. but atleast you could have mentioned the original thread.

karlo2105 11-23-2013 04:39 AM

Re: how to decrypt and decode png files to real file (.ass)


 
Without KSV many streams wouldn't work on VLC, so give him at least credit on what he does. ;)

gaaara 11-23-2013 06:14 PM

Re: how to decrypt and decode png files to real file (.ass)


 
Hello

Quote:

<?php
$formulaire = $_GET['formulaire'];
If ($formulaire==1)
{
$ID = strip_tags(substr($_POST['ID'],0, 100));
$safeID = mysql_escape_string($ID);
$nomfic = strip_tags(substr($_POST['nomfic'],0,100));
$safenomfic = mysql_escape_string($nomfic);
$verif = $_POST['parpost'];

if ($verif == "jeverifiequecapasseparformulaire")
{

function decryptSubtitle($encrypted, $key = "5463201897")
{
$decrypted = "";
$encryptedLen = strlen($encrypted);
$keyLen = strlen($key);
for ($i = 0; $i < $encryptedLen; $i++)
{
$dataCharCode = ord($encrypted[$i]);
$keyInt = substr($key, ($i % $keyLen) - 1, 1);
$decodedChar = chr($dataCharCode - $keyInt);
$decrypted = $decrypted . $decodedChar;
}
$decrypted = base64_decode($decrypted);
return $decrypted;
}

file_put_contents($safenomfic, decryptSubtitle(file_get_contents("http://animedigitalnetwork.fr/picture_".$safeID.".png")));
}
else
{
print "Erreur pas de formulaire détecté";
}
}
else
{
?>
<html>
<head><title>Get ADN Subtitles</title>
<body>
<form action="index.php?formulaire=1" method="post">
ID : <input type="text" name="ID">
Nom fichier : <input type="text" name="nomfic">
<input type="hidden" name="parpost" value="jeverifiequecapasseparformulaire">
<input type="submit" value=" Submit ">
</form>
</body>
</head>
</html>
<?php
}
?>
I want to make a form to retrieve the file but I can not manage to do what am
a pop to download the file

and would like to center the form in the center of the image http://i.imgur.com/dkHJSZR.png

sorry for my english :(

tx

Liluy 04-15-2014 05:16 AM

Re: how to decrypt and decode png files to real file (.ass)


 
Thanks, KSV, for the script.
The Key 5463201897 no longer works.
Do you have the solution for the new key?

http://animedigitalnetwork.fr/picture_4916.png

PS : Sorry if my English is not perfect.

gaaara 04-16-2014 12:51 AM

Re: how to decrypt and decode png files to real file (.ass)


 
I am looking for the solution :)

links that may be useful
http://stackoverflow.com/questions/8...-encrypted-xml
http://stackoverflow.com/questions/2...448441#2448441
http://stackoverflow.com/questions/1...ryption-in-php

aes in swf
http://pastebin.com/71rD0KNb
xml
http://pastebin.com/QHxsX20H

the encrypted code possibly this code im not sure yet

50,52,115,98,117,109,54,100,122,102,56,114,101

Liluy 04-16-2014 06:57 AM

Re: how to decrypt and decode png files to real file (.ass)


 
Thanks, for links.
I am also looking for the solution.

Zackangel 04-17-2014 12:24 AM

Re: how to decrypt and decode png files to real file (.ass)


 
the encoding method is different.
I look swf file in the site and here is the new code on the site...

May be :p
HTML Code:

      public static function decrypt(param1:String, param2:String) : String {
        var _loc9_:* = NaN;
        var _loc10_:* = NaN;
        var _loc14_:* = NaN;
        if(param1.length == 0)
        {
            return "";
        }
        var _loc3_:Array = charsToLongs(hexToChars(param1));
        var _loc4_:Array = charsToLongs(strToChars(param2.substr(0,16)));
        var _loc5_:Number = _loc3_.length;
        var _loc6_:Number = _loc3_[_loc5_-1];
        var _loc7_:Number = _loc3_[0];
        var _loc8_:Number = 2.654435769E9;
        var _loc11_:Number = Math.floor(6 + 52 / _loc5_);
        var _loc12_:Number = _loc11_ * _loc8_;
        while(_loc12_ != 0)
        {
            _loc10_ = _loc12_ >>> 2 & 3;
            _loc14_ = _loc5_-1;
            while(_loc14_ >= 0)
            {
              _loc6_ = _loc3_[_loc14_ > 0?_loc14_-1:_loc5_-1];
              _loc9_ = (_loc6_ >>> 5 ^ _loc7_ << 2) + (_loc7_ >>> 3 ^ _loc6_ << 4) ^ (_loc12_ ^ _loc7_) + (_loc4_[_loc14_ & 3 ^ _loc10_] ^ _loc6_);
              _loc7_ = _loc3_[_loc14_] = _loc3_[_loc14_] - _loc9_;
              _loc14_--;
            }
            _loc12_ = _loc12_ - _loc8_;
        }
        var _loc13_:Array = longsToChars(_loc3_);
        return charsToStr(_loc13_);
      }
     
      private static function charsToLongs(param1:Array) : Array {
        var _loc2_:Array = new Array(Math.ceil(param1.length / 4));
        var _loc3_:Number = 0;
        while(_loc3_ < _loc2_.length)
        {
            _loc2_[_loc3_] = param1[_loc3_ * 4] + (param1[_loc3_ * 4 + 1] << 8) + (param1[_loc3_ * 4 + 2] << 16) + (param1[_loc3_ * 4 + 3] << 24);
            _loc3_++;
        }
        return _loc2_;
      }
     
      private static function longsToChars(param1:Array) : Array {
        var _loc2_:Array = new Array();
        var _loc3_:Number = 0;
        while(_loc3_ < param1.length)
        {
            _loc2_.push(param1[_loc3_] & 255,param1[_loc3_] >
>> 8 & 255,param1[_loc3_] >>> 16 & 255,param1[_loc3_] >>> 24 & 255);
            _loc3_++;
        }
        return _loc2_;
      }
     
      private static function longToChars(param1:Number) : Array {
        var _loc2_:Array = new Array();
        _loc2_.push(param1 & 255,param1 >>> 8 & 255,param1 >>> 16 & 255,param1 >>> 24 & 255);
        return _loc2_;
      }
     
      private static function charsToHex(param1:Array) : String {
        var _loc2_:String = new String("");
        var _loc3_:Array = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
        var _loc4_:Number = 0;
        while(_loc4_ < param1.length)
        {
            _loc2_ = _loc2_ + (_loc3_[param1[_loc4_] >
> 4] + _loc3_[param1[_loc4_] & 15]);
            _loc4_++;
        }
        return _loc2_;
      }
     
      private static function hexToChars(param1:String) : Array {
        var _loc2_:Array = new Array();
        var _loc3_:Number = param1.substr(0,2) == "0x"?2:0;
        while(_loc3_ < param1.length)
        {
            _loc2_.push(parseInt(param1.substr(_loc3_,2),16));
            _loc3_ = _loc3_ + 2;
        }
        return _loc2_;
      }
     
      private static function charsToStr(param1:Array) : String {
        var _loc2_:String = new String("");
        var _loc3_:Number = 0;
        while(_loc3_ < param1.length)
        {
            _loc2_ = _loc2_ + String.fromCharCode(param1[_loc3_]);
            _loc3_++;
        }
        return _loc2_;
      }
     
      private static function strToChars(param1:String) : Array {
        var _loc2_:Array = new Array();
        var _loc3_:Number = 0;
        while(_loc3_ < param1.length)
        {
            _loc2_.push(param1.charCodeAt(_loc3_));
            _loc3_++;
        }
        return _loc2_;
      }
  }
}


gaaara 04-17-2014 11:55 AM

Re: how to decrypt and decode png files to real file (.ass)


 
or is the code I do not see ?

Zackangel 04-17-2014 12:00 PM

Re: how to decrypt and decode png files to real file (.ass)


 
In player-licensed.swf.

I decode the swf file and in scripts/wowza/encryptionAS3/TEA.
sceach decrypt function.

but I'm not sure that it is used for subtitles. :D

gaaara 04-17-2014 12:12 PM

Re: how to decrypt and decode png files to real file (.ass)


 
tx men ^^

KSV 04-17-2014 11:32 PM

Re: how to decrypt and decode png files to real file (.ass)


 
if you want me to take a look at it provide a working VPN and login information if required.

gaaara 04-18-2014 08:33 AM

Re: how to decrypt and decode png files to real file (.ass)


 
ksv pm :)

Liluy 04-20-2014 02:38 AM

Re: how to decrypt and decode png files to real file (.ass)


 
Thanks, KSV, gaaara.

KSV 04-20-2014 05:56 AM

Re: how to decrypt and decode png files to real file (.ass)


 
As someone pointed out in PM it seems another guy has already solved the problem so you can just use the solution provided by him. i will try to provide a faster version when i got some free time. but in the mean time above method is sufficient to convert the subtitles.

gaaara 04-20-2014 12:09 PM

Re: how to decrypt and decode png files to real file (.ass)


 
i forgot to post the link thank you ksv :)


one more thing for a perfect script

downloading video with script is possible ?

Zackangel 04-21-2014 08:19 AM

Re: how to decrypt and decode png files to real file (.ass)


 
thank you KSV XD

KSV 04-21-2014 02:02 PM

Re: how to decrypt and decode png files to real file (.ass)


 
so as promised here is the shorter and faster version of AnimeDigital script. it uses the mcrypt module to do the actual decryption so it's lot faster than pure php implementation. make sure you have mcrypt module installed and enabled on your system (enabled by default on windows).

AnimeDigital.php

Liluy 04-21-2014 02:31 PM

Re: how to decrypt and decode png files to real file (.ass)


 
Thanks you ! KSV !

gaaara 04-21-2014 11:26 PM

Re: how to decrypt and decode png files to real file (.ass)


 
tx ksv :)

Liluy 04-24-2014 04:04 PM

Re: how to decrypt and decode png files to real file (.ass)


 
Adn has a new protection (htacsess redirection ) how to bypass this protection is on the picture?

gaaara 05-23-2014 12:07 AM

Re: how to decrypt and decode png files to real file (.ass)


 
site begins to ban ip loll

FRino 06-02-2014 02:35 PM

Re: how to decrypt and decode png files to real file (.ass)


 
Hi, can i send you a mp, to have more information gaara ? :D

denobis 06-08-2014 04:39 AM

Re: how to decrypt and decode png files to real file (.ass)


 
Hi, i'm working in adding this channel to atresdownloader. First tests works good, incrusting the subtitles too, but need premium account to make it more robust.

denobis 06-08-2014 11:38 AM

Re: how to decrypt and decode png files to real file (.ass)


 
For anyone interested, atresdownloader v15.7 finds and download streams from animedigital.fr with subtitle-decryption-incrustation implemented.

For those in France don't use proxies or use it for anonymity. Outside France the used free proxies not always returns valid data so the streams are limited to 5 min's. You can login and maybe get the premium links, but I don't have tested it.

Cheers!

nyan-nyan 07-06-2014 09:54 PM

Re: how to decrypt and decode png files to real file (.ass)


 
Hi Denobis.

Did you manage to get the whole subtitles file? When I try by myself I get just a small PNG file (around 6kb).

deltasebz 09-08-2014 08:07 PM

Re: how to decrypt and decode png files to real file (.ass)


 
Hi, I use the php script of KSV and my .ass can't be open in aegisub.

Pictures :
http://www.hostingpics.net/viewer.ph...912aegisub.jpg

http://www.hostingpics.net/viewer.ph...038notepad.jpg


Png files are around 30 ko and .ass around 25.

Any ideas ?
Thanks ;)

blurg 09-09-2014 01:16 PM

Re: how to decrypt and decode png files to real file (.ass)


 
me too, i think adn change crypt in png files
we need you KSV :p


Code:

package com.wowza.encryptionAS3
{

    public class TEA extends Object
    {

        public function TEA()
        {
            return;
        }// end function

        public static function encrypt(param1:String, param2:String) : String
        {
            var _loc_9:Number = NaN;
            var _loc_10:Number = NaN;
            var _loc_14:Number = NaN;
            if (param1.length == 0)
            {
                return "";
            }
            var _loc_3:* = charsToLongs(strToChars(param1));
            if (_loc_3.length <= 1)
            {
                _loc_3[1] = 0;
            }
            var _loc_4:* = charsToLongs(strToChars(param2.substr(0, 16)));
            var _loc_5:* = _loc_3.length;
            var _loc_6:* = _loc_3[(_loc_5 - 1)];
            var _loc_7:* = _loc_3[0];
            var _loc_8:Number = 2654435769;
            var _loc_11:* = Math.floor(6 + 52 / _loc_5);
            var _loc_12:Number = 0;
            while (_loc_11-- > 0)
            {
               
                _loc_12 = _loc_12 + _loc_8;
                _loc_10 = _loc_12 >>> 2 & 3;
                _loc_14 = 0;
                while (_loc_14 < _loc_5)
                {
                   
                    _loc_7 = _loc_3[(_loc_14 + 1) % _loc_5];
                    _loc_9 = (_loc_6 >>> 5 ^ _loc_7 << 2) + (_loc_7 >>> 3 ^ _loc_6 << 4) ^ (_loc_12 ^ _loc_7) + (_loc_4[_loc_14 & 3 ^ _loc_10] ^ _loc_6);
                    var _loc_15:* = _loc_3[_loc_14] + _loc_9;
                    _loc_3[_loc_14] = _loc_3[_loc_14] + _loc_9;
                    _loc_6 = _loc_15;
                    _loc_14 = _loc_14 + 1;
                }
            }
            var _loc_13:* = longsToChars(_loc_3);
            return charsToHex(_loc_13);
        }// end function

        public static function decrypt(param1:String, param2:String) : String
        {
            var _loc_9:Number = NaN;
            var _loc_10:Number = NaN;
            var _loc_14:Number = NaN;
            if (param1.length == 0)
            {
                return "";
            }
            var _loc_3:* = charsToLongs(hexToChars(param1));
            var _loc_4:* = charsToLongs(strToChars(param2.substr(0, 16)));
            var _loc_5:* = _loc_3.length;
            var _loc_6:* = _loc_3[(_loc_5 - 1)];
            var _loc_7:* = _loc_3[0];
            var _loc_8:Number = 2654435769;
            var _loc_11:* = Math.floor(6 + 52 / _loc_5);
            var _loc_12:* = Math.floor(6 + 52 / _loc_5) * _loc_8;
            while (_loc_12 != 0)
            {
               
                _loc_10 = _loc_12 >>> 2 & 3;
                _loc_14 = _loc_5 - 1;
                while (_loc_14 >= 0)
                {
                   
                    _loc_6 = _loc_3[_loc_14 > 0 ? ((_loc_14 - 1)) : ((_loc_5 - 1))];
                    _loc_9 = (_loc_6 >>> 5 ^ _loc_7 << 2) + (_loc_7 >>> 3 ^ _loc_6 << 4) ^ (_loc_12 ^ _loc_7) + (_loc_4[_loc_14 & 3 ^ _loc_10] ^ _loc_6);
                    var _loc_15:* = _loc_3[_loc_14] - _loc_9;
                    _loc_3[_loc_14] = _loc_3[_loc_14] - _loc_9;
                    _loc_7 = _loc_15;
                    _loc_14 = _loc_14 - 1;
                }
                _loc_12 = _loc_12 - _loc_8;
            }
            var _loc_13:* = longsToChars(_loc_3);
            return charsToStr(_loc_13);
        }// end function

        private static function charsToLongs(param1:Array) : Array
        {
            var _loc_2:* = new Array(Math.ceil(param1.length / 4));
            var _loc_3:Number = 0;
            while (_loc_3 < _loc_2.length)
            {
               
                _loc_2[_loc_3] = param1[_loc_3 * 4] + (param1[_loc_3 * 4 + 1] << 8) + (param1[_loc_3 * 4 + 2] << 16) + (param1[_loc_3 * 4 + 3] << 24);
                _loc_3 = _loc_3 + 1;
            }
            return _loc_2;
        }// end function

        private static function longsToChars(param1:Array) : Array
        {
            var _loc_2:* = new Array();
            var _loc_3:Number = 0;
            while (_loc_3 < param1.length)
            {
               
                _loc_2.push(param1[_loc_3] & 255, param1[_loc_3] >>> 8 & 255, param1[_loc_3] >>> 16 & 255, param1[_loc_3] >>> 24 & 255);
                _loc_3 = _loc_3 + 1;
            }
            return _loc_2;
        }// end function

        private static function longToChars(param1:Number) : Array
        {
            var _loc_2:* = new Array();
            _loc_2.push(param1 & 255, param1 >>> 8 & 255, param1 >>> 16 & 255, param1 >>> 24 & 255);
            return _loc_2;
        }// end function

        private static function charsToHex(param1:Array) : String
        {
            var _loc_2:* = new String("");
            var _loc_3:* = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
            var _loc_4:Number = 0;
            while (_loc_4 < param1.length)
            {
               
                _loc_2 = _loc_2 + (_loc_3[param1[_loc_4] >> 4] + _loc_3[param1[_loc_4] & 15]);
                _loc_4 = _loc_4 + 1;
            }
            return _loc_2;
        }// end function

        private static function hexToChars(param1:String) : Array
        {
            var _loc_2:* = new Array();
            var _loc_3:* = param1.substr(0, 2) == "0x" ? (2) : (0);
            while (_loc_3 < param1.length)
            {
               
                _loc_2.push(parseInt(param1.substr(_loc_3, 2), 16));
                _loc_3 = _loc_3 + 2;
            }
            return _loc_2;
        }// end function

        private static function charsToStr(param1:Array) : String
        {
            var _loc_2:* = new String("");
            var _loc_3:Number = 0;
            while (_loc_3 < param1.length)
            {
               
                _loc_2 = _loc_2 + String.fromCharCode(param1[_loc_3]);
                _loc_3 = _loc_3 + 1;
            }
            return _loc_2;
        }// end function

        private static function strToChars(param1:String) : Array
        {
            var _loc_2:* = new Array();
            var _loc_3:Number = 0;
            while (_loc_3 < param1.length)
            {
               
                _loc_2.push(param1.charCodeAt(_loc_3));
                _loc_3 = _loc_3 + 1;
            }
            return _loc_2;
        }// end function

    }
}


gaaara 09-13-2014 02:41 PM

Re: how to decrypt and decode png files to real file (.ass)


 
out to date

KSV 09-14-2014 04:21 AM

Re: how to decrypt and decode png files to real file (.ass)


 
They have only updated the decryption key. i have updated the script accordingly.

blurg 09-14-2014 04:57 AM

Re: how to decrypt and decode png files to real file (.ass)


 
the key have 1 more time change but........=>MP

gaaara 09-14-2014 07:24 AM

Re: how to decrypt and decode png files to real file (.ass)


 
résolv

KSV 09-14-2014 08:45 AM

Re: how to decrypt and decode png files to real file (.ass)


 
i don't understand what you guys are trying to say. why you are replacing new key with something else and then asking why it's not working? i have tested the script on following sample and it works as expected.

http://www.filedropper.com/m321

gaaara 09-14-2014 08:55 AM

Re: how to decrypt and decode png files to real file (.ass)


 
the new key in files swf

blurg 09-14-2014 09:30 AM

Re: how to decrypt and decode png files to real file (.ass)


 
KSV i know, but ADN have 1 more time changing the key since last time

KSV 09-14-2014 09:47 AM

Re: how to decrypt and decode png files to real file (.ass)


 
hmm.. either it was a pure coincidence or they are changing keys on some rotational basis. anyway i have pushed the new key.


All times are GMT -6. The time now is 07:51 PM.