1
0

Implements insmod kernel module from local file

This commit is contained in:
2018-09-22 13:18:25 +00:00
parent 623a7f08c1
commit 8649c791ea
5 changed files with 40 additions and 0 deletions

View File

@@ -280,6 +280,16 @@ func (q *QemuSystem) CopyFile(user, localPath, remotePath string) (err error) {
return
}
func (q *QemuSystem) CopyAndInsmod(localKoPath string) (output string, err error) {
remoteKoPath := fmt.Sprintf("/tmp/module_%d.ko", rand.Int())
err = q.CopyFile("root", localKoPath, remoteKoPath)
if err != nil {
return
}
return q.Command("root", "insmod "+remoteKoPath)
}
// CopyAndRun is copy local file to qemu vm then run it
func (q *QemuSystem) CopyAndRun(user, path string) (output string, err error) {
remotePath := fmt.Sprintf("/tmp/executable_%d", rand.Int())