Help running a GO program

Hi all,

Apologies for the newbie question. I’m trying to run a program that is designed to decrypt external Western Digital drives when the bridge board which contains the encryption information, dies. The drive on its own without the board cannot be read normally.

Thankfully someone has developed a program that will decrypt the drive, which is found here https://github.com/andlabs/reallymine
Its written in GO language which I am completely new to as I’m not a programmer. I downloaded the zip file which contained the multiple .go files which make up the program, and unpacked them into a directory

I then downloaded the GO language files from here https://golang.org/doc/install, downloaded the .msi installation file for Windows and ran it, and installed the files in a directory on my c drive.

I looked up some tutorials on running go programs, which lead me to trying the following
Opened command prompt, cd’d to the directory I unziped the program files to, then typed “go run main.go” (as I assumed that main.go was the main program file I needed to run), but it threw lots of errors saying lots of things were undefined. So I’m assuming I need to run it in some way which compiles all the .go files that are all in that directory, but I don’t know how.

Can anyone help? Many thanks.

If you already have your Go environment ok, open a console and cd in your project folder (GOPATH). From here, just type :
go get github.com/andlabs/reallymine

And when source is in your project source directory, everything is already complied and ready (in [GOPATH FOLDER, SEE YOUR ENV]/bin). If this folder is currently into your PATH, juste type the command like explained in README. If not, goes into the bin folder and run the command from here.

I hope this help you.

Hi Ludovic, many thanks for the reply. I’m afraid some of what you said has gone over my head, I’ll try to break it down.

I’m pretty sure I have the Go environment setup. After I downloaded and run the installation file from golang.org it had me input a check in cmd prompt that appeared to confirm it had installed correctly. All the general GO files installed to C:\Go\

I think I missed a step in setting the GOPATH. So to set the GOPATH I followed the instructions on golang.org, went into System>Advanced System Settings>Environment Variables and added a new system variable called GOPATH, and set it to C:\reallymine\

I then opened command prompt, cd’d to C:\reallymine\ and typed
go get github.com/andlabs/reallymine
but it came back with an error:
go: missing Git command.

However, is that step just to download the program files? I think I’ve already done that manually by downloading the zip file from https://github.com/andlabs/reallymine and unzipping all the files into C:\reallymine\

Just so I’m clear C:\reallymine\ is what you call my project source directory, correct?

I’m a bit confused when you say “if this folder is currently into you PATH”. What my PATH? In the same location I set the GOPATH, there is a system variable called Path already set to %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\PuTTY;C:\Go\bin
Do I need to delete all the other entries and just have it set to C:\Go\bin? Or is that ok?

And I have looked through the readme that came with the program files but it doesn’t explain the command to type in.

Sorry again for the beginner questions, and thanks for your help.

Hello Tristan,

GOPATH is the path to your project folder for your go developments. In this folder, you will have /bin /pkg and /src ; To begin, you have to create the /src folder. /bin and /pkg will be created by Go. /bin will receive your compiled program ready to run. You can name your folder as you want (C:\reallymine\ or C:\go_projects, as you want).

The normal way to consume Go programs is to use go get, this will populate your /src folder following Go conventions. After the go get, this package will be located in the folder /src/github.com/andlabs/reallymine. Any dependencies from this package will be also populated in the /src folder automatically.

The problem here is that go get need tools that are usually installed by developers, like GIT. And I see you haven’t this tool installed. I think you can install a Windows version of GIT. If you don’t want use go get (and have to install GIT), you can try to unpack your zip into /src/github.com/andlabs/reallymine (be aware that the unzip don’t create a reallymine subfolder again). In this case, there is no dependency check, but perhaps there is no dependency at all (to verify).

To compile or re-compile a program, juste locate your console into your /src/github.com/andlabs/reallymine folder and type go install ./…

When this is done, your binary will be into /bin folder. If it fail, this is perhaps you have missing dependencies, and in this case, you will be better to install GIT and use go get.

By advances, my apologies for the use of “/” instead “”. I’m a Linux (happy) user

1 Like

I see you need also this package : https://github.com/mendsley/gojwe
If you don’t want use go get, unpack the source into your GOPATH/src/github.com/mendsley/gojwe

I hope you will can compile the program and use it.

I missing your reply about your PATH. Your PATH is Ok, don’t delete it. Because you use Go only for this task, I think you haven’t to add the full path to your GOPATH/bin folder. From a console, just switch to this folder to run the complied program.

Hi Ludovic, thank you so much for the help. I think I’m nearly there.

I downloaded and installed GIT from here https://git-scm.com/downloads

I created a new project directory, I set the GOPATH to that location, created a folder called src within that that directory, cd’d to that location in command prompt and typed
"go get github.com/andlabs/reallymine"

This populated the src folder with the files for reallymine and gojwe as you said it would. I then cd’d to /src/github.com/andlabs/reallymine and typed “go install”. This created the executable reallymine.exe in the bin folder. But when I run the exe I get a command prompt looking window flash up for about half a second and disappear immediately. I cd’d to src\github.com\mendsley\gojwe and ran ‘go install’ there, but I’m not sure what that did but it made no change on the behaviour of reallymine.exe.

Any ideas what I’m doing wrong? Thanks so much again.

Hello,

I’m sorry to read that. I try to help other on Go, but I don’t know the program reallymine. Go programs are usually commands, to run in a console. Try to see if an error message is printed, and ask help from the author. But for now, you have done all necessary steps to compile and run this program. I’m afraid you start a new battle with reallymine program to decrypt how use it. And I noticed the description of the project saying :

     WD MyBook encrypted hard drive decryption (still WIP).

… Still WIP (Work In Progress) is a bad sign if you look for a quick and polished solution… But you had the courage to try it :smile:

Hi Ludovic,

I read about it on a forum where one user had got it to work, so I’m sure it can work. From what I read, the WIP referred to the fact it could only decrypt drives that had certain chips on the bridge board, and mine has a chip its supposed to work for.

I tried compiling it in Ubuntu Live, but I get the same error as in Windows
"encrypted must exist, should not be a device. decrypted must NOT exist."

I’m not sure what to do from here, I guess I’ll try to contact the author. Thanks again for your help getting me this far!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.