Implement Set_Kernelstub and attempt to elevate to sudo using STDIN and then attempt to remove the password from the program memory
This commit is contained in:
parent
ca992bf864
commit
7081bfa8d7
5 changed files with 81 additions and 13 deletions
|
@ -1,10 +1,13 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
|
||||
"github.com/HikariKnight/quickpassthrough/internal/configs"
|
||||
"github.com/HikariKnight/quickpassthrough/internal/logger"
|
||||
"github.com/HikariKnight/quickpassthrough/pkg/command"
|
||||
"github.com/HikariKnight/quickpassthrough/pkg/fileio"
|
||||
)
|
||||
|
||||
|
@ -115,7 +118,8 @@ func (m *model) processSelection() bool {
|
|||
//m.focused++
|
||||
|
||||
// Because we have no QuickEmu support yet, just skip USB Controller configuration
|
||||
m.focused = DONE
|
||||
m.focused = INSTALL
|
||||
return true
|
||||
|
||||
case INTRO:
|
||||
// This is an OK Dialog
|
||||
|
@ -133,3 +137,34 @@ func (m *model) processSelection() bool {
|
|||
// Return false as we are not done
|
||||
return false
|
||||
}
|
||||
|
||||
// This function starts the install process
|
||||
// It takes 1 auth string as variable
|
||||
func (m *model) install(auth string) {
|
||||
// Get the config
|
||||
config := configs.GetConfig()
|
||||
|
||||
// Write to logger
|
||||
logger.Printf("Getting authentication token by elevating with sudo once")
|
||||
|
||||
// Elevate to sudo
|
||||
command.Elevate(auth)
|
||||
|
||||
// Write to logger
|
||||
logger.Printf("Attempting to free hash from memory")
|
||||
|
||||
// Blank out the variable
|
||||
auth = ""
|
||||
|
||||
// Based on the bootloader, setup the configuration
|
||||
if config.Bootloader == "kernelstub" {
|
||||
// Write to logger
|
||||
logger.Printf("Configuring systemd-boot using kernelstub")
|
||||
|
||||
// Configure kernelstub
|
||||
configs.Set_KernelStub()
|
||||
} else if config.Bootloader == "unknown" {
|
||||
kernel_args := fileio.ReadFile(config.Path.CMDLINE)
|
||||
fmt.Printf("Unsupported bootloader, please add the below line to your bootloaders kernel arguments\n%s", kernel_args)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue