Skip to content

Commit

Permalink
update: shorter func
Browse files Browse the repository at this point in the history
  • Loading branch information
ANDRVV committed Nov 10, 2024
1 parent 4c797cd commit d92f7dd
Showing 1 changed file with 15 additions and 73 deletions.
88 changes: 15 additions & 73 deletions libs/libs.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,13 +766,25 @@ func fseqdata(color Colors, seqdata []InjectData, injdata INJTable) string {
// Get INJ Table row of gapcast software structure
func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst string, essid string, seqdata []InjectData, injerr int, injch string) (row string) {
var rowinj string

rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
switch graph {
case 0:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] ?\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
default:
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
}
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
switch graph {
case 10, 11:
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] FF:FF:FF:FF:FF:FF\n" + color.White
default:
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
}

switch graph {
case 0:
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | Select [" + color.Blue + "INJ" + color.White + "] :\n" + color.White
rowinj += color.White + " | \n" + color.White
Expand All @@ -782,11 +794,6 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case 1:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
if tableinj.INJ == "Beacon" {
rowinj += color.White + " | [" + color.Blue + "CHN" + color.White + "] " + ValidPositiveNumberTest(strconv.Itoa(tableinj.CHANNEL)) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "ESD" + color.White + "] " + StringEmptyTest(tableinj.ESSID) + "\n" + color.White
Expand All @@ -803,11 +810,6 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case 2:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
if tableinj.INJ == "Beacon" {
rowinj += color.White + " | [" + color.Blue + "CHN" + color.White + "] " + ValidPositiveNumberTest(strconv.Itoa(tableinj.CHANNEL)) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "ESD" + color.White + "] " + StringEmptyTest(tableinj.ESSID) + "\n" + color.White
Expand All @@ -825,11 +827,6 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case 3:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | Select [" + color.Blue + "DST" + color.White + "] :\n" + color.White
rowinj += color.White + " | \n" + color.White
Expand All @@ -842,11 +839,6 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case 4:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | Select [" + color.Blue + "DST" + color.White + "] :\n" + color.White
rowinj += color.White + " | \n" + color.White
Expand All @@ -856,11 +848,6 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case 5:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | Select another [" + color.Blue + "SRC" + color.White + "] ?\n" + color.White
rowinj += color.White + " | \n" + color.White
Expand All @@ -869,11 +856,6 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case 6:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | Select another [" + color.Blue + "DST" + color.White + "] ?\n" + color.White
rowinj += color.White + " | \n" + color.White
Expand All @@ -882,11 +864,6 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case 7:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
if tableinj.INJ == "Beacon" {
rowinj += color.White + " | [" + color.Blue + "CHN" + color.White + "] " + ValidPositiveNumberTest(strconv.Itoa(tableinj.CHANNEL)) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "ESD" + color.White + "] " + StringEmptyTest(tableinj.ESSID) + "\n" + color.White
Expand Down Expand Up @@ -918,21 +895,11 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
if injerr == 1 {
switch tableinj.INJ {
case "De-Auth":
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | [" + color.Red + "ERROR" + color.White + "] You cannot specify an [" + color.Blue + "SRC" + color.White + "] on De-Auth mode that has not been scanned.\n" + color.White
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case "Beacon":
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "CHN" + color.White + "] " + ValidPositiveNumberTest(strconv.Itoa(tableinj.CHANNEL)) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "ESD" + color.White + "] " + StringEmptyTest(tableinj.ESSID) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
Expand All @@ -941,47 +908,27 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case "EvilTwin":
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | [" + color.Red + "ERROR" + color.White + "] You cannot specify an [" + color.Blue + "SRC" + color.White + "] on Evil-Twin mode that has not been scanned.\n" + color.White
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
}
} else if injerr == 2 {
if tableinj.INJ == "Beacon" {
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "CHN" + color.White + "] " + ValidPositiveNumberTest(strconv.Itoa(tableinj.CHANNEL)) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "ESD" + color.White + "] " + StringEmptyTest(tableinj.ESSID) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | [" + color.Red + "ERROR" + color.White + "] The [" + color.Blue + "CHN" + color.White + "] is invalid, insert a valid channel.\n" + color.White
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
} else if tableinj.INJ == "De-Auth" {
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] " + fmaclist(tableinj.DST) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
rowinj += color.White + " | [" + color.Red + "ERROR" + color.White + "] The [" + color.Blue + "SRC" + color.White + "] stations were not found.\n" + color.White
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
}
}
case 10:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] FF:FF:FF:FF:FF:FF" + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "CHN" + color.White + "] " + ValidPositiveNumberTest(strconv.Itoa(tableinj.CHANNEL)) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "ESD" + color.White + "] " + StringEmptyTest(tableinj.ESSID) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
Expand All @@ -993,11 +940,6 @@ func GetINJTABLERow(color Colors, graph int, tableinj INJTable, src string, dst
rowinj += color.White + " \n" + color.White
rowinj += " ==================================" + color.Null + color.White + "\n\n"
case 11:
rowinj += "> ==================================" + color.Null + color.White + "\n"
rowinj += color.White + " \n" + color.White
rowinj += color.White + " | [" + color.Blue + "INJ" + color.White + "] " + tableinj.INJ + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "SRC" + color.White + "] " + fmaclist(tableinj.SRC) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "DST" + color.White + "] FF:FF:FF:FF:FF:FF" + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "CHN" + color.White + "] " + ValidPositiveNumberTest(strconv.Itoa(tableinj.CHANNEL)) + "\n" + color.White
rowinj += color.White + " | [" + color.Blue + "ESD" + color.White + "] " + StringEmptyTest(tableinj.ESSID) + "\n" + color.White
rowinj += color.White + " | \n" + color.White
Expand Down

0 comments on commit d92f7dd

Please sign in to comment.