Skip to content

Commit

Permalink
Fix command parameter exception
Browse files Browse the repository at this point in the history
  • Loading branch information
XinRoom committed Jun 1, 2022
1 parent bdfb2eb commit 7bcb153
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/go-portScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"bufio"
"flag"
"fmt"
"github.com/XinRoom/go-portScan/core/host"
"github.com/XinRoom/go-portScan/core/port"
Expand Down Expand Up @@ -50,6 +49,9 @@ func parseFlag(c *cli.Context) {
}

func run(c *cli.Context) error {
if c.NumFlags() == 0 {
cli.ShowAppHelpAndExit(c, 0)
}
parseFlag(c)
if devices {
pcapDevices, err := pcap.FindAllDevs()
Expand All @@ -62,8 +64,7 @@ func run(c *cli.Context) error {
os.Exit(0)
}
if ipStr == "" && iL == "" {
flag.PrintDefaults()
os.Exit(0)
cli.ShowAppHelpAndExit(c, 0)
}
if portStr == "-" {
portStr = "1-65535"
Expand Down Expand Up @@ -245,7 +246,7 @@ func main() {
&cli.StringFlag{
Name: "ip",
Usage: "target ip, eg: \"1.1.1.1/30,1.1.1.1-1.1.1.2,1.1.1.1-2\"",
Required: true,
Required: false,
Value: "",
},
&cli.StringFlag{
Expand Down

0 comments on commit 7bcb153

Please sign in to comment.