
Enlaces de Golang para PE-sieve
Bindings de Golang para PE-sieve.
Requiere que pe-sieve32.dll, pe-sieve64.dll (de una versión compatible) estén presentes en el directorio del proyecto, o en una ruta indicada por la variable de entorno: PESIEVE_DIR.
Expone los siguientes envoltorios para la API de PE-sieve:
PESieveVersion uint32
func PESieveHelp()
func PESieveScan(pp PEsieveParams) PEsieveReport
func PESieveScanEx(pp PEsieveParams, rtype t_report_type, jsonMaxSize uint32) (PEsieveReport, string, uint32)
package main
import (
"fmt"
"syscall"
"github.com/hasherezade/pesieve-go"
)
// Escanear el proceso actual
func ScanThis(myPid uint32) string {
var mods = string("kernel32.dll")
ignoredBuf := make([]byte, len(mods)+1)
copy(ignoredBuf[:], mods)
// Configurar los parámetros de escaneo
pp := pesieve.PEsieveParams{
Pid: myPid,
Threads: true,
Shellcode: pesieve.SHELLC_PATTERNS,
Quiet: true,
JsonLvl: pesieve.JSON_DETAILS2,
ModulesIgnored : pesieve.PARAM_STRING { Buffer: ignoredBuf, Length: uint32(len(mods)) },
}
copy(pp.OutputDir[:], "MyDemoDir")
const rtype = pesieve.REPORT_ALL
const jsonMaxLen = 2000
_, json, _ := pesieve.PESieveScanEx(pp, rtype, jsonMaxLen)
return json
}
func main() {
message := ScanThis( uint32(syscall.Getpid()) )
fmt.Println(message)
}