Skip to content

Commit

Permalink
Had a brain fart - Fixes nandb dump/flash
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTheMan827 committed Jul 20, 2018
1 parent 2750807 commit 1226cdc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Tasks/MembootTasks.cs
Expand Up @@ -659,7 +659,7 @@ public static TaskFunc ProcessNand(string nandDump, NandTasks task)
switch (task)
{
case NandTasks.DumpNandB:
partitionSize = long.Parse(hakchi.Shell.ExecuteSimple($"echo $((($(hexdump -e '1/4 \"%u\"' -s $((0x28)) -n 4 ${osDecryptedDevice})+0xfff)/0x1000))", throwOnNonZero: true).Trim()) * 4 * 1024;
partitionSize = long.Parse(hakchi.Shell.ExecuteSimple($"echo $((($(hexdump -e '1/4 \"%u\"' -s $((0x28)) -n 4 {osDecryptedDevice})+0xfff)/0x1000))", throwOnNonZero: true).Trim()) * 4 * 1024;
break;
case NandTasks.FlashNandB:
Expand All @@ -671,7 +671,7 @@ public static TaskFunc ProcessNand(string nandDump, NandTasks task)
hakchi.Shell.ExecuteSimple("cryptsetup open /dev/nandb root-crypt --type plain --cipher aes-xts-plain --key-file /key-file", 2000, true);
}
partitionSize = long.Parse(hakchi.Shell.ExecuteSimple($"blockdev --getsize64 ${osDecryptedDevice}", throwOnNonZero: true));
partitionSize = long.Parse(hakchi.Shell.ExecuteSimple($"blockdev --getsize64 {osDecryptedDevice}", throwOnNonZero: true));
break;
case NandTasks.DumpNandC:
Expand Down Expand Up @@ -724,11 +724,11 @@ public static TaskFunc ProcessNand(string nandDump, NandTasks task)
switch (task)
{
case NandTasks.DumpNandB:
Shared.ShellPipe($"dd if=${osDecryptedDevice} bs=128K count={(partitionSize / 1024) / 4 }", null, file, throwOnNonZero: true);
Shared.ShellPipe($"dd if={osDecryptedDevice} bs=128K count={(partitionSize / 1024) / 4 }", null, file, throwOnNonZero: true);
break;
case NandTasks.FlashNandB:
Shared.ShellPipe($"dd of=${osDecryptedDevice} bs=128K", file, throwOnNonZero: true);
Shared.ShellPipe($"dd of={osDecryptedDevice} bs=128K", file, throwOnNonZero: true);
if(hasKeyfile)
hakchi.Shell.Execute("cryptsetup close root-crypt", throwOnNonZero: true);
break;
Expand Down

0 comments on commit 1226cdc

Please sign in to comment.