You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for the work for this library.
I am trying to use it to enable FileVault in macOS and retrieve the FileVault key back. The issue I have is that whenever macOS uses obfuscated command prompts, the library does not seem able to send the text in a way that can be received as input.
This is a rough code example I am using to test the library:
// MacOSEnableFileVault enables FileVault for the support user and the newly
// added user and returns the key. It requires an admin user username and password.
func MacOSEnableFileVault(supportAccount, supportPassword, userToActivate, userToActivatePassword string) (fileVaultKey string, err error) {
c, err := expect.NewConsole(expect.WithStdout(os.Stdout))
if err != nil {
return "", fmt.Errorf("Could not initialize new console while attempting to enable FileVault for users %s and %s. (Enable FileVault Error (0x01). %s", supportAccount, userToActivate, err)
}
defer c.Close()
cmd := exec.Command("/bin/bash", "-c", MacOSsudo+" -k -S "+MacOSfdesetup+" enable -user \""+supportAccount+"\" -usertoadd \""+userToActivate+"\" -password \""+supportPassword+"\"")
cmd.Stdin = c.Tty()
cmd.Stdout = c.Tty()
cmd.Stderr = c.Tty()
go func() {
c.ExpectEOF()
}()
err = cmd.Start()
if err != nil {
return "", fmt.Errorf("Could not initialize new console while attempting to enable FileVault for users %s and %s. (Enable FileVault Error (0x02). %s", supportAccount, userToActivate, err)
}
time.Sleep(5 * time.Second)
c.Send(supportPassword + "\r")
time.Sleep(5 * time.Second)
c.Send(userToActivatePassword + "\r")
err = cmd.Wait()
if err != nil {
return "", fmt.Errorf("Could not initialize new console while attempting to enable FileVault for users %s and %s. (Enable FileVault Error (0x03). %s", supportAccount, userToActivate, err)
}
return "", nil
}
As you can see, I still can't really figure out how to retrieve the FileVault key itself, but the real problem starts even before then.
With the code above, the first password (the one sent for sudo with the -k parameter), is sent properly and the program continues, but once FileVault prompts me for the password of the "standard" account (which is also "standard" for this example), this happens:
Also, ExpectString seems to be waiting for input forever, despite setting it in a very straightforward way with c.ExpectString("Password:")
All this is in Mojave 10.15.2.
Thanks again.
The text was updated successfully, but these errors were encountered:
Hello,
Thank you for the work for this library.
I am trying to use it to enable FileVault in macOS and retrieve the FileVault key back. The issue I have is that whenever macOS uses obfuscated command prompts, the library does not seem able to send the text in a way that can be received as input.
This is a rough code example I am using to test the library:
As you can see, I still can't really figure out how to retrieve the FileVault key itself, but the real problem starts even before then.
With the code above, the first password (the one sent for sudo with the -k parameter), is sent properly and the program continues, but once FileVault prompts me for the password of the "standard" account (which is also "standard" for this example), this happens:
Also, ExpectString seems to be waiting for input forever, despite setting it in a very straightforward way with
c.ExpectString("Password:")
All this is in Mojave 10.15.2.
Thanks again.
The text was updated successfully, but these errors were encountered: