phishlets now displayed cleanly in a table
This commit is contained in:
parent
eb98606b3b
commit
394836a350
@ -72,7 +72,7 @@ func (t *Terminal) Close() {
|
|||||||
|
|
||||||
func (t *Terminal) output(s string, args ...interface{}) {
|
func (t *Terminal) output(s string, args ...interface{}) {
|
||||||
out := fmt.Sprintf(s, args...)
|
out := fmt.Sprintf(s, args...)
|
||||||
fmt.Fprintf(color.Output, "\n%s\n\n", out)
|
fmt.Fprintf(color.Output, "\n%s\n", out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) DoWork() {
|
func (t *Terminal) DoWork() {
|
||||||
@ -84,6 +84,8 @@ func (t *Terminal) DoWork() {
|
|||||||
t.cfg.refreshActiveHostnames()
|
t.cfg.refreshActiveHostnames()
|
||||||
t.updateCertificates("")
|
t.updateCertificates("")
|
||||||
|
|
||||||
|
t.output("%s", t.sprintPhishletStatus(""))
|
||||||
|
|
||||||
for !do_quit {
|
for !do_quit {
|
||||||
line, err := t.rl.Readline()
|
line, err := t.rl.Readline()
|
||||||
if err == readline.ErrInterrupt {
|
if err == readline.ErrInterrupt {
|
||||||
@ -198,6 +200,7 @@ func (t *Terminal) handleSessions(args []string) error {
|
|||||||
lgreen := color.New(color.FgHiGreen)
|
lgreen := color.New(color.FgHiGreen)
|
||||||
yellow := color.New(color.FgYellow)
|
yellow := color.New(color.FgYellow)
|
||||||
lred := color.New(color.FgHiRed)
|
lred := color.New(color.FgHiRed)
|
||||||
|
cyan := color.New(color.FgCyan)
|
||||||
|
|
||||||
pn := len(args)
|
pn := len(args)
|
||||||
if pn == 0 {
|
if pn == 0 {
|
||||||
@ -250,12 +253,23 @@ func (t *Terminal) handleSessions(args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
keys := []string{"id", "phishlet", "username", "password", "tokens", "landing url", "user-agent", "remote ip", "create time", "update time"}
|
keys := []string{"id", "phishlet", "username", "password", "tokens", "landing url", "user-agent", "remote ip", "create time", "update time"}
|
||||||
vals := []string{strconv.Itoa(s.Id), lred.Sprintf(s.Phishlet), lblue.Sprintf(s.Username), lblue.Sprintf(s.Password), tcol, yellow.Sprintf(s.LandingURL), dgray.Sprintf(s.UserAgent), yellow.Sprintf(s.RemoteAddr), dgray.Sprintf(time.Unix(s.CreateTime, 0).Format("2006-01-02 15:04")), dgray.Sprintf(time.Unix(s.UpdateTime, 0).Format("2006-01-02 15:04"))}
|
vals := []string{strconv.Itoa(s.Id), lred.Sprint(s.Phishlet), lblue.Sprint(s.Username), lblue.Sprint(s.Password), tcol, yellow.Sprint(s.LandingURL), dgray.Sprint(s.UserAgent), yellow.Sprint(s.RemoteAddr), dgray.Sprint(time.Unix(s.CreateTime, 0).Format("2006-01-02 15:04")), dgray.Sprint(time.Unix(s.UpdateTime, 0).Format("2006-01-02 15:04"))}
|
||||||
log.Printf("\n%s\n", AsRows(keys, vals))
|
log.Printf("\n%s", AsRows(keys, vals))
|
||||||
|
|
||||||
|
if len(s.Custom) > 0 {
|
||||||
|
var ckeys []string = []string{"custom", "value"}
|
||||||
|
var cvals [][]string
|
||||||
|
for k, v := range s.Custom {
|
||||||
|
cvals = append(cvals, []string{dgray.Sprint(k), cyan.Sprint(v)})
|
||||||
|
}
|
||||||
|
log.Printf("\n%s", AsTable(ckeys, cvals))
|
||||||
|
}
|
||||||
|
|
||||||
if len(s.Tokens) > 0 {
|
if len(s.Tokens) > 0 {
|
||||||
json_tokens := t.tokensToJSON(pl, s.Tokens)
|
json_tokens := t.tokensToJSON(pl, s.Tokens)
|
||||||
t.output("%s", json_tokens)
|
t.output("%s\n", json_tokens)
|
||||||
|
} else {
|
||||||
|
t.output("\n")
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -392,7 +406,7 @@ func (t *Terminal) handlePhishlets(args []string) error {
|
|||||||
}
|
}
|
||||||
out += t.cfg.GetServerIP() + " " + h
|
out += t.cfg.GetServerIP() + " " + h
|
||||||
}
|
}
|
||||||
t.output("%s", out)
|
t.output("%s\n", out)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
} else if pn == 3 {
|
} else if pn == 3 {
|
||||||
@ -421,15 +435,15 @@ func (t *Terminal) handlePhishlets(args []string) error {
|
|||||||
}
|
}
|
||||||
out := ""
|
out := ""
|
||||||
n := 0
|
n := 0
|
||||||
yellow := color.New(color.FgYellow)
|
hblue := color.New(color.FgHiCyan)
|
||||||
for _, u := range urls {
|
for _, u := range urls {
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
out += "\n"
|
out += "\n"
|
||||||
}
|
}
|
||||||
out += yellow.Sprint(u)
|
out += hblue.Sprint(u)
|
||||||
n += 1
|
n += 1
|
||||||
}
|
}
|
||||||
t.output("%s", out)
|
t.output("%s\n", out)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,13 +558,14 @@ func (t *Terminal) updateCertificates(site string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) sprintPhishletStatus(site string) string {
|
func (t *Terminal) sprintPhishletStatus(site string) string {
|
||||||
ret := ""
|
|
||||||
higreen := color.New(color.FgHiGreen)
|
higreen := color.New(color.FgHiGreen)
|
||||||
hired := color.New(color.FgHiRed)
|
hired := color.New(color.FgHiRed)
|
||||||
hiblue := color.New(color.FgHiBlue)
|
hiblue := color.New(color.FgHiBlue)
|
||||||
yellow := color.New(color.FgYellow)
|
yellow := color.New(color.FgYellow)
|
||||||
hiwhite := color.New(color.FgHiWhite)
|
hiwhite := color.New(color.FgHiWhite)
|
||||||
n := 0
|
n := 0
|
||||||
|
cols := []string{"phishlet", "author", "active", "status", "hostname"}
|
||||||
|
var rows [][]string
|
||||||
for s, _ := range t.cfg.phishlets {
|
for s, _ := range t.cfg.phishlets {
|
||||||
if site == "" || s == site {
|
if site == "" || s == site {
|
||||||
pl, err := t.cfg.GetPhishlet(s)
|
pl, err := t.cfg.GetPhishlet(s)
|
||||||
@ -566,19 +581,13 @@ func (t *Terminal) sprintPhishletStatus(site string) string {
|
|||||||
if t.cfg.IsSiteHidden(s) {
|
if t.cfg.IsSiteHidden(s) {
|
||||||
hidden_status = hired.Sprint("hidden")
|
hidden_status = hired.Sprint("hidden")
|
||||||
}
|
}
|
||||||
if n > 0 {
|
|
||||||
ret += "\n\n"
|
|
||||||
}
|
|
||||||
ret += " phishlet: " + hiblue.Sprint(s) + "\n"
|
|
||||||
ret += " author: " + hiwhite.Sprint(pl.Author) + "\n"
|
|
||||||
ret += " active: " + status + "\n"
|
|
||||||
ret += " status: " + hidden_status + "\n"
|
|
||||||
domain, _ := t.cfg.GetSiteDomain(s)
|
domain, _ := t.cfg.GetSiteDomain(s)
|
||||||
ret += " hostname: " + yellow.Sprint(domain)
|
|
||||||
n += 1
|
n += 1
|
||||||
|
|
||||||
|
rows = append(rows, []string{hiblue.Sprint(s), hiwhite.Sprint(pl.Author), status, hidden_status, yellow.Sprint(domain)})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret
|
return AsTable(cols, rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) phishletPrefixCompleter(args string) []string {
|
func (t *Terminal) phishletPrefixCompleter(args string) []string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user