add colored output

This commit is contained in:
Andrii Ursulenko
2023-07-18 13:43:11 +03:00
parent 4cc65afe14
commit 18937e1e4a
6 changed files with 46 additions and 18 deletions
+5 -4
View File
@@ -3,6 +3,7 @@ package Plugins
import (
"bytes"
"fmt"
"github.com/fatih/color"
"github.com/shadow1ng/fscan/common"
"golang.org/x/net/icmp"
"net"
@@ -26,11 +27,11 @@ func CheckLive(hostslist []string, Ping bool) []string {
for ip := range chanHosts {
if _, ok := ExistHosts[ip]; !ok && IsContain(hostslist, ip) {
ExistHosts[ip] = struct{}{}
if common.Silent == false {
if Ping == false {
fmt.Printf("(icmp) Target %-15s is alive\n", ip)
if !common.Silent {
if !Ping {
color.Green("(icmp) Target %-15s is alive\n", ip)
} else {
fmt.Printf("(ping) Target %-15s is alive\n", ip)
color.Green("(ping) Target %-15s is alive\n", ip)
}
}
AliveHosts = append(AliveHosts, ip)
+4 -3
View File
@@ -2,6 +2,7 @@ package Plugins
import (
"fmt"
"github.com/fatih/color"
"github.com/shadow1ng/fscan/WebScan/lib"
"github.com/shadow1ng/fscan/common"
"reflect"
@@ -25,7 +26,7 @@ func Scan(info common.HostInfo) {
if len(Hosts) > 0 || len(common.HostPort) > 0 {
if common.NoPing == false && len(Hosts) > 0 {
Hosts = CheckLive(Hosts, common.Ping)
fmt.Println("[*] Icmp alive hosts len is:", len(Hosts))
color.Cyan("[*] Icmp alive hosts len is: %d", len(Hosts))
}
if common.Scantype == "icmp" {
common.LogWG.Wait()
@@ -40,7 +41,7 @@ func Scan(info common.HostInfo) {
AlivePorts = NoPortScan(Hosts, info.Ports)
} else if len(Hosts) > 0 {
AlivePorts = PortScan(Hosts, info.Ports, common.Timeout)
fmt.Println("[*] alive ports len is:", len(AlivePorts))
color.Cyan("[*] alive ports len is: %d", len(AlivePorts))
if common.Scantype == "portscan" {
common.LogWG.Wait()
return
@@ -50,7 +51,7 @@ func Scan(info common.HostInfo) {
AlivePorts = append(AlivePorts, common.HostPort...)
AlivePorts = common.RemoveDuplicate(AlivePorts)
common.HostPort = nil
fmt.Println("[*] AlivePorts len is:", len(AlivePorts))
color.Cyan("[*] AlivePorts len is:", len(AlivePorts))
}
common.GC()
var severports []string //severports := []string{"21","22","135"."445","1433","3306","5432","6379","9200","11211","27017"...}