mirror of
https://github.com/maride/pancap.git
synced 2024-12-22 20:27:29 +00:00
Check if we got a file
This commit is contained in:
parent
1c23ca3859
commit
8a76ed7d99
5
file.go
5
file.go
@ -19,6 +19,11 @@ func registerFileFlags() {
|
||||
|
||||
// Opens the PCAP, returns its packets and the link type or an error
|
||||
func openPCAP() (*gopacket.PacketSource, layers.LinkType, error) {
|
||||
// Check if we even got a file.
|
||||
if *filenameFlag == "" {
|
||||
return nil, 0, fmt.Errorf("missing file to analyze. Please specifiy it with --file")
|
||||
}
|
||||
|
||||
// Open specified file
|
||||
handle, openErr := pcap.OpenOffline(*filenameFlag)
|
||||
if openErr != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user