feat: capture pcap file for iOS, including CLI hrp ios pcap

This commit is contained in:
debugtalk
2022-12-16 10:45:21 +08:00
parent 455724dd1b
commit a433c8a9ca
3 changed files with 61 additions and 2 deletions

View File

@@ -388,13 +388,13 @@ func (dev *IOSDevice) StopPerf() string {
}
func (dev *IOSDevice) StartPcap() error {
log.Info().Msg("start packet capture")
packets, err := dev.d.PcapStart()
if err != nil {
return err
}
dev.pcapFile = filepath.Join(env.ResultsPath, "dump.pcap")
log.Info().Str("pcapFile", dev.pcapFile).Msg("create pcap file")
file, err := os.OpenFile(dev.pcapFile,
os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0o755)
if err != nil {
@@ -435,6 +435,7 @@ func (dev *IOSDevice) StopPcap() string {
return ""
}
close(dev.pcapStop)
log.Info().Str("pcapFile", dev.pcapFile).Msg("stop packet capture")
return dev.pcapFile
}