finished automation

This commit is contained in:
Jakob 2018-07-06 23:05:42 +02:00
parent a26960cea1
commit 4b3163c80f
17 changed files with 153 additions and 93 deletions

View file

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:h_encore_auto"
mc:Ignorable="d"
Title="ZUGABE" Height="175.807" Width="512" ResizeMode="CanMinimize" WindowStyle="None">
Title="ZUGABE" Height="175.807" Width="512" ResizeMode="NoResize" WindowStyle="None">
<Grid MouseDown="Grid_MouseDown">
<Rectangle Fill="#FFF3F3F3" Stroke="Black"/>

View file

@ -1,18 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Threading;
namespace h_encore_auto
@ -29,13 +19,13 @@ namespace h_encore_auto
if (File.Exists(Ref.tempDir + "keepfile"))
{
Ref.areFilesKept = true;
Util.keepFilesCleanup();
}
else
{
Ref.areFilesKept = false;
if (Directory.Exists(Ref.tempDir))
Util.DeleteDirectory(Ref.tempDir);
Directory.CreateDirectory(Ref.tempDir);
}
InitTimer();
@ -43,6 +33,7 @@ namespace h_encore_auto
private void buttonStart_Click(object sender, RoutedEventArgs e)
{
Directory.CreateDirectory(Ref.tempDir);
buttonStart.IsEnabled = false;
buttonClose.IsEnabled = false;
barWorking.Visibility = Visibility.Visible;
@ -50,7 +41,6 @@ namespace h_encore_auto
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
/* run your code here */
Process[] pname = Process.GetProcessesByName("qcma");
if (pname.Length != 0)
@ -62,10 +52,6 @@ namespace h_encore_auto
MessageBox.Show("QCMA was closed, since this application has to interact with it.");
}
// 7ZIP Download and extraction
Util.dlFile(Ref.url7zr, "7zr.exe");
Util.dlFile(Ref.url7za, "7z-extra.7z");
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
ProcessStartInfo startInfoOut = new ProcessStartInfo();
@ -78,26 +64,33 @@ namespace h_encore_auto
startInfoOut.FileName = "cmd.exe";
startInfoOut.WorkingDirectory = Ref.tempDir;
startInfo.Arguments = "/C 7zr.exe x 7z-extra.7z";
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
if (Ref.areFilesKept == false)
{
// 7ZIP Download and extraction
Util.dlFile(Ref.url7zr, "7zr.exe");
Util.dlFile(Ref.url7za, "7z-extra.7z");
//Rest of the tool downloads
Util.dlFile(Ref.urlPsvimg, "psvimgtools.zip");
Util.dlFile(Ref.urlPkg, "pkg2zip.zip");
Util.dlFile(Ref.urlEnc, "h-encore.zip");
Util.dlFile(Ref.urlEntry, "entryPoint.pkg");
Util.dlFile(Ref.urlQcma, "qcma.zip");
Util.dlFile(Ref.urlReg, "qcma.reg");
startInfo.Arguments = "/C 7zr.exe x 7z-extra.7z";
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
string text = File.ReadAllText(Ref.pathImportReg);
text = text.Replace("REPLACE", Ref.pathQcmaRes);
File.WriteAllText(Ref.pathImportReg, text);
text = text.Replace("\\", "/");
File.WriteAllText(Ref.pathImportReg, text);
text = text.Replace("HKEY_CURRENT_USER/Software/codestation/qcma", @"HKEY_CURRENT_USER\Software\codestation\qcma");
File.WriteAllText(Ref.pathImportReg, text);
//Rest of the tool downloads
Util.dlFile(Ref.urlPsvimg, "psvimgtools.zip");
Util.dlFile(Ref.urlPkg, "pkg2zip.zip");
Util.dlFile(Ref.urlEnc, "h-encore.zip");
Util.dlFile(Ref.urlEntry, "entryPoint.pkg");
Util.dlFile(Ref.urlQcma, "qcma.zip");
Util.dlFile(Ref.urlReg, "qcma.reg");
string text = File.ReadAllText(Ref.pathImportReg);
text = text.Replace("REPLACE", Ref.pathQcmaRes);
File.WriteAllText(Ref.pathImportReg, text);
text = text.Replace("\\", "/");
File.WriteAllText(Ref.pathImportReg, text);
text = text.Replace("HKEY_CURRENT_USER/Software/codestation/qcma", @"HKEY_CURRENT_USER\Software\codestation\qcma");
File.WriteAllText(Ref.pathImportReg, text);
}
startInfo.Arguments = "/C " + Ref.path7z + " x " + Ref.pathPsvimg;
process.StartInfo = startInfo;
@ -126,15 +119,8 @@ namespace h_encore_auto
process.Start();
process.WaitForExit();
startInfo.Arguments = "/C xcopy /E /Y /I " + Ref.tempDir + @"app\PCSG90096\ " + Ref.tempDir + @"h-encore\app\ux0_temp_game_PCSG90096_app_PCSG90096\";
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
startInfo.Arguments = "/C xcopy /E /Y /I " + Ref.tempDir + @"app\PCSG90096\sce_sys\package\temp.bin " + Ref.tempDir + @"h-encore\license\ux0_temp_game_PCSG90096_license_app_PCSG90096\6488b73b912a753a492e2714e9b38bc7.rif*";
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
Util.CopyDir(Ref.tempDir + "app\\PCSG90096\\", Ref.tempDir + "h-encore\\app\\ux0_temp_game_PCSG90096_app_PCSG90096\\",true);
File.Copy(Ref.tempDir + "app\\PCSG90096\\sce_sys\\package\\temp.bin", Ref.tempDir + @"h-encore\license\ux0_temp_game_PCSG90096_license_app_PCSG90096\6488b73b912a753a492e2714e9b38bc7.rif");
try
{
@ -226,7 +212,9 @@ namespace h_encore_auto
for (; ; )
{
stage = 0;
Ref.isSecondGuide = false;
guide.ShowDialog();
Ref.isSecondGuide = true;
if (Util.IsDirectoryEmpty(Ref.pathQcmaRes + "PSVita\\APP\\"))
{
@ -255,20 +243,15 @@ namespace h_encore_auto
startInfo.WorkingDirectory = Ref.tempDir + "h-encore";
Ref.shortAID = new DirectoryInfo(Directory.GetDirectories(Ref.pathQcmaRes + "PSVita\\APP\\")[0]).Name;
MessageBox.Show(Ref.shortAID);
Ref.longAID = Util.GetEncKey(Ref.shortAID);
MessageBox.Show(Ref.longAID);
startInfo.Arguments = "/C create.bat " + Ref.longAID;
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
startInfo.Arguments = "/C xcopy /E /Y /I " + Ref.tempDir + @"h-encore\PCSG90096\ " + Ref.pathQcmaRes + "PSVita\\" + Ref.shortAID + "\\PCSG90096\\";
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
Util.CopyDir(Ref.tempDir + "h-encore\\PCSG90096\\", Ref.pathQcmaRes + "PSVita\\APP\\" + Ref.shortAID + "\\PCSG90096\\", true);
stage = 3;
}).Start();
@ -276,7 +259,6 @@ namespace h_encore_auto
if (stage == 3)
{
stage = 0;
Ref.isSecondGuide = true;
guide.ShowDialog();
MessageBox.Show("If not already done, wait until your Vita has copied over the exploit, then press OK.");

View file

@ -95,7 +95,9 @@ namespace h_encore_auto
if (Directory.Exists(Ref.tempDir))
{
if (MessageBox.Show("Do you want to keep the downloaded files for future use?\nPressing no will wipe any leftover files of this application off your computer.", "Keep Files?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
File.Create(Ref.tempDir + "keepfile");
{
keepFilesCleanup();
}
else
DeleteDirectory(Ref.tempDir);
}
@ -117,5 +119,74 @@ namespace h_encore_auto
return ci.TwoLetterISOLanguageName;
}
public static void CopyDir(string sourceDirName, string destDirName, bool copySubDirs)
{
// Get the subdirectories for the specified directory.
DirectoryInfo dir = new DirectoryInfo(sourceDirName);
if (!dir.Exists)
{
throw new DirectoryNotFoundException("Source directory does not exist or could not be found: " + sourceDirName);
}
DirectoryInfo[] dirs = dir.GetDirectories();
// If the destination directory doesn't exist, create it.
if (!Directory.Exists(destDirName))
{
Directory.CreateDirectory(destDirName);
}
// Get the files in the directory and copy them to the new location.
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
string temppath = Path.Combine(destDirName, file.Name);
file.CopyTo(temppath, false);
}
// If copying subdirectories, copy them and their contents to new location.
if (copySubDirs)
{
foreach (DirectoryInfo subdir in dirs)
{
string temppath = Path.Combine(destDirName, subdir.Name);
CopyDir(subdir.FullName, temppath, copySubDirs);
}
}
}
public static void keepFilesCleanup()
{
if (!File.Exists(Ref.tempDir + "keepfile"))
{
File.Create(Ref.tempDir + "keepfile");
}
string backupTemp = Ref.tempDir + "keepfiles\\";
Directory.CreateDirectory(backupTemp);
foreach (string download in Ref.downloads)
{
File.Copy(Ref.tempDir + download, backupTemp + download);
}
Util.DeleteDirectory(Ref.tempDir + "\\app");
Util.DeleteDirectory(Ref.tempDir + "\\Far");
Util.DeleteDirectory(Ref.tempDir + "\\h-encore");
Util.DeleteDirectory(Ref.tempDir + "\\Qcma");
Util.DeleteDirectory(Ref.tempDir + "\\QcmaRes");
Util.DeleteDirectory(Ref.tempDir + "\\x64");
foreach (string file in Directory.GetFiles(Ref.tempDir))
{
File.Delete(file);
}
foreach (string download in Ref.downloads)
{
File.Copy(backupTemp + download, Ref.tempDir + download);
}
Util.DeleteDirectory(backupTemp);
}
}
}

View file

@ -1,16 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace h_encore_auto
{
@ -19,7 +9,7 @@ namespace h_encore_auto
/// </summary>
public partial class VitaGuide : Window
{
int currImg = 1;
int currImg;
string[] currText = lang.GuideText(Util.GetLang());
@ -28,9 +18,9 @@ namespace h_encore_auto
InitializeComponent();
if (Ref.isSecondGuide == true)
{
currImg = 15;
}
else
currImg = 1;
imgFrame.Source = new BitmapImage(new Uri("/img/" + currImg + ".png", UriKind.Relative));
textField.Text = currText[currImg - 1];
@ -44,7 +34,7 @@ namespace h_encore_auto
textField.Text = currText[currImg - 1];
buttonBck.IsEnabled = true;
if (currImg == 14 || currImg == 25)
if (currImg == 14 || currImg == 26)
{
buttonFwd.IsEnabled = false;
buttonDone.Visibility = Visibility.Visible;

View file

@ -8,7 +8,7 @@
<ProjectGuid>{9F8577B2-16A2-4147-B264-308B68679F78}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>h_encore_auto</RootNamespace>
<AssemblyName>h-encore-auto</AssemblyName>
<AssemblyName>ZUGABE</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -53,10 +53,10 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="InputBox, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Essy.Tools.InputBox.1.0.0\lib\net20\InputBox.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
<Reference Include="System.Data" />
@ -164,6 +164,17 @@
<ItemGroup>
<Resource Include="img\ajax-loader.gif" />
</ItemGroup>
<ItemGroup>
<Resource Include="img\20.png" />
<Resource Include="img\21.png" />
<Resource Include="img\22.png" />
<Resource Include="img\23.png" />
<Resource Include="img\24.png" />
<Resource Include="img\25.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>

BIN
h-encore-auto/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
h-encore-auto/img/20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

BIN
h-encore-auto/img/21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

BIN
h-encore-auto/img/22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 KiB

BIN
h-encore-auto/img/23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
h-encore-auto/img/24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
h-encore-auto/img/25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
h-encore-auto/img/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View file

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace h_encore_auto
namespace h_encore_auto
{
class lang
{
@ -36,11 +30,12 @@ namespace h_encore_auto
"3. Wait for it to connect.",
"4. Select \"PC -> PS Vita System\"",
"5. Select \"Applications\"",
"6",
"7",
"8",
"9",
"10",
"6. Select \"PS Vita\"",
"7. Tick \"h-encore\" and click \"copy\". Wait for it to complete and close Content Manager.",
"8. Start the new \"h-encore\" bubble.",
"9. Select \"Install HENkaku\"",
"10. Select \"Download VitaShell\"",
"11. Finally, exit.",
"Done. Keep in mind that you have to launch h-encore every time you reboot the Vita. \nWhen launched, just press Exit again. This reapplies the exploit."
};
}

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Essy.Tools.InputBox" version="1.0.0" targetFramework="net452" />
<package id="MSBuilder.CodeTaskAssembly" version="0.2.5" targetFramework="net40" developmentDependency="true" />
</packages>

View file

@ -34,6 +34,17 @@ namespace h_encore_auto
"text\\01\\"
};
public static readonly string[] downloads = new string[] {
"7zr.exe",
"7z-extra.7z",
"entryPoint.pkg",
"h-encore.zip",
"pkg2zip.zip",
"psvimgtools.zip",
"qcma.reg",
"qcma.zip"
};
public static bool isSecondGuide = false;
public static bool isQcmaConfigFound = false;