refactor: modified visibility and error handling in build func

This commit is contained in:
fizm0 2022-11-14 17:04:25 +01:00
parent 9850f0476d
commit ce54d3bca9
2 changed files with 9 additions and 6 deletions

View File

@ -29,7 +29,10 @@ func main() {
0xd7,
}
ldr := loader.NewLoader()
ldr, err := loader.NewLoader()
if err != nil {
panic(err)
}
// if err := ldr.SelfInjectThread(calcSc); err !+ nil {
// fmt.Printf("An error occured:\n%s\n", err.Error())

View File

@ -34,17 +34,17 @@ type Loader struct {
ntdllApi map[int64]InMemProc
}
func NewLoader() *Loader {
func NewLoader() (*Loader, error) {
djb2 := hashing.NewDJB2()
pl := &Loader{djb2: djb2}
ntProcs, err := pl.ResolveSyscallIDs()
ntProcs, err := pl.resolveSyscallIDs()
if err != nil {
panic(err)
return nil, err
}
pl.ntdllApi = ntProcs
return pl
return pl, nil
}
func (pl *Loader) GetSysID(funcName string) int {
@ -126,7 +126,7 @@ func (p *InMemProc) IsHooked() bool {
return false
}
func (pl *Loader) ResolveSyscallIDs() (map[int64]InMemProc, error) {
func (pl *Loader) resolveSyscallIDs() (map[int64]InMemProc, error) {
procMap := make(map[int64]InMemProc)
var ntProcs []InMemProc