Ejemplo n.º 1
0
func main() {
	app := cli.NewApp()
	app.Name = "filterpcap"
	app.Version = "0.1"
	app.Usage = "filterpcap someFile.pcap [options]"

	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "to",
			Usage: "Extract calls to a certain number",
		},
		cli.StringFlag{
			Name:  "callId",
			Usage: "Extract call with a specific SIP call ID",
		},
		cli.StringFlag{
			Name:  "outputDirectory, d",
			Usage: "Directory used to output filtered files",
			Value: "./",
		},
		cli.BoolFlag{
			Name:  "debug",
			Usage: "Output debugging information",
		},
	}

	app.Action = func(c *cli.Context) {
		runTestZone()
	}

	app.Run(os.Args)
}
Ejemplo n.º 2
0
func main() {
	app := cli.NewApp()
	app.Name = "filterpcap"
	app.Version = "0.1"
	app.Usage = "filterpcap someFile.pcap [options]"

	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "to",
			Usage: "Extract calls to a certain number",
		},
		cli.StringFlag{
			Name:  "callId",
			Usage: "Extract call with a specific SIP call ID",
		},
		cli.StringFlag{
			Name:  "sipCode",
			Usage: "Extract calls containing SIP packets with a certain status code",
		},
	}

	app.Action = func(c *cli.Context) {
		if len(c.Args()) == 0 {
			fmt.Println("You must specify a pcap filename")
			return
		} else if _, err := os.Stat(c.Args()[0]); os.IsNotExist(err) {
			fmt.Printf("no such file or directory: %s\n", c.Args()[0])
			return
		} else if !hasFilters(c) {
			fmt.Println("You must specify at least one filter for the pcap.")
			return
		}
	}

	app.Run(os.Args)
}