Skip to content

Commit a3ca46b

Browse files
committed
Initial commit
1 parent af5d1c5 commit a3ca46b

19 files changed

+1064
-0
lines changed

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

MochiCryptUnpacker.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28407.52
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MochiCryptUnpacker", "MochiCryptUnpacker\MochiCryptUnpacker.csproj", "{24EBC2B2-ABDB-4486-8444-2539332FCCC8}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{24EBC2B2-ABDB-4486-8444-2539332FCCC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{24EBC2B2-ABDB-4486-8444-2539332FCCC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{24EBC2B2-ABDB-4486-8444-2539332FCCC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{24EBC2B2-ABDB-4486-8444-2539332FCCC8}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {D9616CCB-66E0-401C-A009-7FF1D9C42058}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{24EBC2B2-ABDB-4486-8444-2539332FCCC8}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>MochiCryptUnpacker</RootNamespace>
10+
<AssemblyName>MochiCryptUnpacker</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<Deterministic>true</Deterministic>
14+
<TargetFrameworkProfile />
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
<Prefer32Bit>false</Prefer32Bit>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<PlatformTarget>AnyCPU</PlatformTarget>
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
<Prefer32Bit>false</Prefer32Bit>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="SwfExtractor">
39+
<HintPath>..\..\Mochi\Lib\SwfExtractor.dll</HintPath>
40+
</Reference>
41+
<Reference Include="System" />
42+
<Reference Include="System.Core" />
43+
<Reference Include="System.Xml.Linq" />
44+
<Reference Include="System.Data.DataSetExtensions" />
45+
<Reference Include="System.Data" />
46+
<Reference Include="System.Deployment" />
47+
<Reference Include="System.Drawing" />
48+
<Reference Include="System.Windows.Forms" />
49+
<Reference Include="System.Xml" />
50+
<Reference Include="zlib.managed, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
51+
<HintPath>..\packages\zlib.managed.1.1.1\lib\net45\zlib.managed.dll</HintPath>
52+
</Reference>
53+
</ItemGroup>
54+
<ItemGroup>
55+
<Compile Include="frmAbout.cs">
56+
<SubType>Form</SubType>
57+
</Compile>
58+
<Compile Include="frmAbout.Designer.cs">
59+
<DependentUpon>frmAbout.cs</DependentUpon>
60+
</Compile>
61+
<Compile Include="frmMain.cs">
62+
<SubType>Form</SubType>
63+
</Compile>
64+
<Compile Include="frmMain.Designer.cs">
65+
<DependentUpon>frmMain.cs</DependentUpon>
66+
</Compile>
67+
<Compile Include="MochiDecrypt.cs" />
68+
<Compile Include="Program.cs" />
69+
<Compile Include="Properties\AssemblyInfo.cs" />
70+
<EmbeddedResource Include="frmAbout.resx">
71+
<DependentUpon>frmAbout.cs</DependentUpon>
72+
</EmbeddedResource>
73+
<EmbeddedResource Include="frmMain.resx">
74+
<DependentUpon>frmMain.cs</DependentUpon>
75+
</EmbeddedResource>
76+
<EmbeddedResource Include="Properties\Resources.resx">
77+
<Generator>ResXFileCodeGenerator</Generator>
78+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
79+
<SubType>Designer</SubType>
80+
</EmbeddedResource>
81+
<Compile Include="Properties\Resources.Designer.cs">
82+
<AutoGen>True</AutoGen>
83+
<DependentUpon>Resources.resx</DependentUpon>
84+
<DesignTime>True</DesignTime>
85+
</Compile>
86+
<None Include="app.config" />
87+
<None Include="packages.config" />
88+
<None Include="Properties\Settings.settings">
89+
<Generator>SettingsSingleFileGenerator</Generator>
90+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
91+
</None>
92+
<Compile Include="Properties\Settings.Designer.cs">
93+
<AutoGen>True</AutoGen>
94+
<DependentUpon>Settings.settings</DependentUpon>
95+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
96+
</Compile>
97+
</ItemGroup>
98+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
99+
</Project>

MochiCryptUnpacker/MochiDecrypt.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Text;
6+
using Elskom.Generic.Libs;
7+
8+
namespace MochiCryptUnpacker
9+
{
10+
public static class MochiDecrypt
11+
{
12+
public static byte[] Decrypt(byte[] payload)
13+
{
14+
List<byte> S = new List<byte>();
15+
int i = 0;
16+
int j = 0;
17+
int k = 0;
18+
int n = 0;
19+
int u = 0;
20+
int v = 0;
21+
22+
n = payload.Length - 32;
23+
while (i < 256)
24+
{
25+
S.Add((byte)i);
26+
i++;
27+
}
28+
j = 0;
29+
i = 0;
30+
while (i < 256)
31+
{
32+
j = j + S[i] + payload[n + (i & 31)] & 255;
33+
u = S[i];
34+
S[i] = S[j];
35+
S[j] = (byte)u;
36+
i++;
37+
}
38+
if (n > 131072)
39+
{
40+
n = 131072;
41+
}
42+
j = 0;
43+
i = 0;
44+
k = 0;
45+
while (k < n)
46+
{
47+
i = i + 1 & 255;
48+
u = S[i];
49+
j = j + u & 255;
50+
v = S[j];
51+
S[i] = (byte)v;
52+
S[j] = (byte)u;
53+
payload[k] = (byte)(payload[k] ^ S[u + v & 255]);
54+
k++;
55+
}
56+
57+
byte[] buf = new byte[65535];
58+
int lastDecompressed = 0;
59+
using (Stream input = new MemoryStream(payload))
60+
using (MemoryStream output = new MemoryStream())
61+
using (ZOutputStream zlib = new ZOutputStream(output))
62+
{
63+
do
64+
{
65+
lastDecompressed = input.Read(buf, 0, buf.Length);
66+
zlib.Write(buf, 0, lastDecompressed);
67+
output.Flush();
68+
}
69+
while (lastDecompressed > 0);
70+
return output.ToArray();
71+
}
72+
}
73+
}
74+
}

MochiCryptUnpacker/Program.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Windows.Forms;
5+
6+
namespace MochiCryptUnpacker
7+
{
8+
static class Program
9+
{
10+
/// <summary>
11+
/// 应用程序的主入口点。
12+
/// </summary>
13+
[STAThread]
14+
static void Main()
15+
{
16+
Application.EnableVisualStyles();
17+
Application.SetCompatibleTextRenderingDefault(false);
18+
Application.Run(new frmMain());
19+
}
20+
}
21+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// 有关程序集的一般信息由以下
6+
// 控制。更改这些特性值可修改
7+
// 与程序集关联的信息。
8+
[assembly: AssemblyTitle("MochiCryptUnpacker")]
9+
[assembly: AssemblyDescription("Extract source SWF file from animations using MochiCrypt.")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("MochiCryptUnpacker")]
13+
[assembly: AssemblyCopyright("By.whc2001")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// 将 ComVisible 设置为 false 会使此程序集中的类型
18+
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19+
//请将此类型的 ComVisible 特性设置为 true。
20+
[assembly: ComVisible(false)]
21+
22+
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23+
[assembly: Guid("24ebc2b2-abdb-4486-8444-2539332fccc8")]
24+
25+
// 程序集的版本信息由下列四个值组成:
26+
//
27+
// 主版本
28+
// 次版本
29+
// 生成号
30+
// 修订号
31+
//
32+
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
33+
// 方法是按如下所示使用“*”: :
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

MochiCryptUnpacker/Properties/Resources.Designer.cs

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)