-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathflag_lsps.go
63 lines (54 loc) · 1.44 KB
/
flag_lsps.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
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"errors"
"flag"
"fmt"
frida_go "github.com/a97077088/frida-go"
jsoniter "github.com/json-iterator/go"
)
var param_lsps_devi= FlagLsPs.String("devi","","设备")
var FlagLsPs =flag.NewFlagSet("lsps",flag.ExitOnError)
func init(){
FlagLsPs.Usage= func() {
fmt.Fprintf(FlagLsPs.Output(), "============== 列出所有进程 使用方法:%s\n", "lsps")
FlagLsPs.PrintDefaults()
}
}
func FlagLsPsMain(args []string)error{
FlagLsPs.Parse(args)
if FlagLsPs.Parsed() {
return NewLsPs().Run(LsPsParam{*param_lsps_devi})
}
return errors.New("lsps命令解析失败")
}
type LsPsParam struct {
Devi string
}
type LsPs struct {
}
func (l *LsPs) Run(param LsPsParam) error {
mgr:=frida_go.DeviceManager_Create()
defer mgr.Close()
d,err:=ParseDevice(mgr,param.Devi)
if err!=nil{
return err
}
sysparam,err:=d.QuerySystemParameters()
if err!=nil{
return err
}
jssys:=jsoniter.Wrap(sysparam)
jsos:=jssys.Get("os")
fmt.Printf("内核平台:%s cpu构架:%s 当前系统:%s(%s) 设备名称:%s 权限:%s \n",jssys.Get("platform").ToString(),jssys.Get("arch").ToString(),jsos.Get(1).Get("id").ToString(),jsos.Get(0).Get("version").ToString(),jssys.Get("name").ToString(),jssys.Get("access").ToString())
pss,err:=d.EnumerateProcesses(frida_go.ProcessQueryOptions{})
if err!=nil{
return err
}
for _, ps := range pss {
fmt.Printf("名称:%-50s pid:%d \n",ps.Name(),ps.Pid())
}
return nil
}
func NewLsPs()*LsPs{
return &LsPs{}
}