-
Notifications
You must be signed in to change notification settings - Fork 796
/
minidump.go
50 lines (40 loc) · 1.75 KB
/
minidump.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Merlin is a post-exploitation command and control framework.
This file is part of Merlin.
Copyright (C) 2024 Russel Van Tuyl
Merlin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
Merlin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Merlin. If not, see <http://www.gnu.org/licenses/>.
*/
package minidump
import (
"fmt"
"strconv"
)
// Parse is the initial entry point for all extended modules. All validation checks and processing will be performed here
// The function input types are limited to strings and therefore require additional processing
func Parse(options map[string]string) ([]string, error) {
// Convert PID to integer
if options["pid"] != "" && options["pid"] != "0" {
_, errPid := strconv.Atoi(options["pid"])
if errPid != nil {
return nil, fmt.Errorf("there was an error converting the PID to an integer:\r\n%s", errPid.Error())
}
}
command, errCommand := GetJob(options["process"], options["pid"], options["tempLocation"])
if errCommand != nil {
return nil, fmt.Errorf("there was an error getting the minidump job:\r\n%s", errCommand.Error())
}
return command, nil
}
// GetJob returns a string array containing the commands, in the proper order, to be used with agents.AddJob
func GetJob(process string, pid string, tempLocation string) ([]string, error) {
return []string{"Minidump", process, pid, tempLocation}, nil
}