Tweaks to various tools.
This commit is contained in:
parent
d1452f54c0
commit
e33e8c3ce5
|
@ -10,6 +10,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/cloudflare/cfssl/helpers"
|
"github.com/cloudflare/cfssl/helpers"
|
||||||
|
@ -213,14 +214,23 @@ func main() {
|
||||||
flag.BoolVar(&leafOnly, "l", false, "only show the leaf certificate")
|
flag.BoolVar(&leafOnly, "l", false, "only show the leaf certificate")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
for _, filename := range flag.Args() {
|
if flag.NArg() == 0 || (flag.NArg() == 1 && flag.Arg(1) == "-") {
|
||||||
fmt.Printf("--%s ---\n", filename)
|
certs, err := ioutil.ReadAll(os.Stdin)
|
||||||
in, err := ioutil.ReadFile(filename)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Warn(err, "couldn't read certificate")
|
Warn(err, "couldn't read certificates from standard input")
|
||||||
continue
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
displayAllCerts(certs, leafOnly)
|
||||||
|
} else {
|
||||||
|
for _, filename := range flag.Args() {
|
||||||
|
fmt.Printf("--%s ---\n", filename)
|
||||||
|
in, err := ioutil.ReadFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
Warn(err, "couldn't read certificate")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
displayAllCerts(in, leafOnly)
|
displayAllCerts(in, leafOnly)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/kisom/goutils/die"
|
"github.com/kisom/goutils/die"
|
||||||
|
@ -39,7 +40,11 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, site := range flag.Args() {
|
for _, site := range flag.Args() {
|
||||||
conn, err := tls.Dial("tcp", site+":443", cfg)
|
_, _, err := net.SplitHostPort(site)
|
||||||
|
if err != nil {
|
||||||
|
site += ":443"
|
||||||
|
}
|
||||||
|
conn, err := tls.Dial("tcp", site, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Loading…
Reference in New Issue