Skip to content

Commit

Permalink
Andere Methode für verschlüsselte Smartphones.
Browse files Browse the repository at this point in the history
  • Loading branch information
ultrara1n committed Apr 9, 2017
1 parent cd38653 commit 44cf001
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 50 deletions.
10 changes: 9 additions & 1 deletion MiTranslate/Form1.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions MiTranslate/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="FolderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>134, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>53</value>
</metadata>
Expand Down
79 changes: 32 additions & 47 deletions MiTranslate/Form1.vb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Imports System.IO
Imports System.Net
Imports System.Security.Principal
Imports Microsoft.Win32

Public Class Form1
Expand All @@ -21,22 +22,40 @@ Public Class Form1
'Prüfen ob Verschlüsselt
If returnData.androidEncryption = "encrypted" Then
pbSchloss.Visible = True

'Java Verzeichnis herausfinden
'Hier kann es passieren das eine Exception kommt, also fahren wir das über einen Catch
Dim javaKey As String = "SOFTWARE\JavaSoft\Java Runtime Environment"
Dim javaPath As String
Dim javaVersion As String
Using baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(javaKey)
javaVersion = baseKey.GetValue("CurrentVersion").ToString()
Using homeKey = baseKey.OpenSubKey(javaVersion)
javaPath = homeKey.GetValue("JavaHome").ToString()
Try
Using baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(javaKey)
javaVersion = baseKey.GetValue("CurrentVersion").ToString()
Using homeKey = baseKey.OpenSubKey(javaVersion)
javaPath = homeKey.GetValue("JavaHome").ToString()
End Using
End Using
End Using
Catch Exc As System.NullReferenceException
MsgBox("Leider konnte der Java Ordner nicht automatisch ermittelt werden, bitte wähle ihn manuell aus.")
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
javaPath = FolderBrowserDialog1.SelectedPath
If (File.Exists(javaPath & "\bin\java.exe")) Then
Else
MsgBox("Der Ordner scheint nicht zu stimmen, in " & javaPath & "\bin\ befindet sich keine java.exe")
Exit Sub
End If
Else
MsgBox("Ohne den Java Ordner kommen wir leider nicht weiter.")
Exit Sub
End If
End Try

'Java Version festlegen
checkJava()
Dim javaVersionSmall As Integer
If javaVersion.Contains("1.8") Then
If returnData.javaInfo.Contains("1.8") Then
javaVersionSmall = 8
ElseIf javaVersion.Contains("1.7") Then
ElseIf returnData.javaInfo.Contains("1.7") Then
javaVersionSmall = 7
End If

Expand Down Expand Up @@ -288,14 +307,6 @@ Public Class Form1
oProcess.Start()
oProcess.WaitForExit()

Dim oProcess3 As New Process()
Dim oStartInfo3 As New ProcessStartInfo("tar.exe", "-rf save/newbackup.tar apps/com.xiaomi.smarthome/_manifest")
oStartInfo3.UseShellExecute = False
oStartInfo3.CreateNoWindow = True
oProcess3.StartInfo = oStartInfo3
oProcess3.Start()
oProcess3.WaitForExit()

Dim oProcess2 As New Process()
Dim restoreOption As String = "-jar abe.jar pack save/newbackup.tar save/newbackup.ab"
If pbSchloss.Visible = True Then
Expand Down Expand Up @@ -374,38 +385,12 @@ Public Class Form1
"Programmiert von blacksn0w.")
End Sub
Private Sub cmdCheckJava_Click(sender As Object, e As EventArgs) Handles cmdCheckJava.Click
'Java Installation prüfen
Dim JavaProc As New Process()
Dim JavaProcInfo As New ProcessStartInfo("java", "-version")
With JavaProcInfo
.UseShellExecute = False
.RedirectStandardError = True
.CreateNoWindow = True
End With
Try
With JavaProc
.StartInfo = JavaProcInfo
.Start()
End With
Dim sOutput As String
Using sReader As System.IO.StreamReader = JavaProc.StandardError
sOutput = sReader.ReadToEnd()
End Using

Dim info() As String = Split(sOutput, vbCrLf)
Dim found As Boolean
For Each output As String In info
If (output.Contains("Runtime Environment")) Then
MsgBox("Java gefunden: " & output)
found = True
End If
Next
If found <> True Then
MsgBox("Java scheint installiert zu sein, jedoch keine Runtime Environment. Bitte neu installieren.", MsgBoxStyle.Critical)
End If
Catch Exc As System.ComponentModel.Win32Exception
MsgBox("Konnte kein Java finden. Sicher das es installiert ist?", MsgBoxStyle.Critical)
checkJava()
If (returnData.javaInfo = "ERROR") Then
MsgBox("Konnte kein Java Runtime Environment finden. Sicher das es installiert ist?", MsgBoxStyle.Critical)
Process.Start("https://java.com/de/download/")
End Try
ElseIf returnData.javaInfo <> "" Then
MsgBox("Java gefunden: " & returnData.javaInfo)
End If
End Sub
End Class
4 changes: 2 additions & 2 deletions MiTranslate/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.2.0.0")>
<Assembly: AssemblyFileVersion("1.2.0.0")>
<Assembly: AssemblyVersion("1.3.0.0")>
<Assembly: AssemblyFileVersion("1.3.0.0")>
31 changes: 31 additions & 0 deletions MiTranslate/modFunctions.vb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Public Class returnData
Public Shared androidVersion As String
Public Shared androidAPI As String
Public Shared androidEncryption As String
Public Shared javaInfo As String
End Class

Module modFunctions
Expand Down Expand Up @@ -92,4 +93,34 @@ Module modFunctions
End If
Return filterDeviceInfo
End Function

Function checkJava()
'Java Installation prüfen
Dim JavaProc As New Process()
Dim JavaProcInfo As New ProcessStartInfo("java", "-version")
With JavaProcInfo
.UseShellExecute = False
.RedirectStandardError = True
.CreateNoWindow = True
End With
Try
With JavaProc
.StartInfo = JavaProcInfo
.Start()
End With
Dim sOutput As String
Using sReader As System.IO.StreamReader = JavaProc.StandardError
sOutput = sReader.ReadToEnd()
End Using

Dim info() As String = Split(sOutput, vbCrLf)
For Each output As String In info
If (output.Contains("Runtime Environment")) Then
returnData.javaInfo = output
End If
Next
Catch Exc As System.ComponentModel.Win32Exception
returnData.javaInfo = "ERROR"
End Try
End Function
End Module

0 comments on commit 44cf001

Please sign in to comment.