Projects STRLCPY metabigor Commits de5aad6f
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    core/common.go
    skipped 9 lines
    10 10   // "github.com/Sirupsen/logrus"
    11 11   "github.com/fatih/color"
    12 12   "github.com/sirupsen/logrus"
     13 + prefixed "github.com/x-cray/logrus-prefixed-formatter"
    13 14  )
    14 15   
    15  -var log = logrus.New()
     16 +var logger = logrus.New()
    16 17   
    17 18  // InitLog init log
    18 19  func InitLog(options Options) {
    skipped 7 lines
    26 27   logFile := path.Join(logDir, "metabigor.log")
    27 28   f, err := os.OpenFile(logFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
    28 29   if err != nil {
    29  - log.Fatalf("error opening file: %v", err)
     30 + logger.Error("error opening file: %v", err)
    30 31   }
    31 32   
    32 33   // defer f.Close()
    33 34   mwr := io.MultiWriter(os.Stdout, f)
    34  - log.SetOutput(mwr)
     35 + 
     36 + logger.SetLevel(logrus.InfoLevel)
     37 + 
     38 + logger = &logrus.Logger{
     39 + Out: mwr,
     40 + Level: logrus.InfoLevel,
     41 + Formatter: &prefixed.TextFormatter{
     42 + ForceColors: true,
     43 + ForceFormatting: true,
     44 + },
     45 + }
    35 46   
    36 47   if options.Debug == true {
    37  - log.SetOutput(mwr)
    38  - log.SetLevel(logrus.DebugLevel)
     48 + logger.SetOutput(mwr)
     49 + logger.SetLevel(logrus.DebugLevel)
    39 50   } else if options.Verbose == true {
    40  - log.SetOutput(mwr)
    41  - log.SetLevel(logrus.InfoLevel)
     51 + logger.SetOutput(mwr)
     52 + logger.SetLevel(logrus.InfoLevel)
    42 53   } else {
    43  - log.SetOutput(ioutil.Discard)
     54 + logger.SetOutput(ioutil.Discard)
    44 55   }
    45  - log.Info(fmt.Sprintf("Store log file to: %v", logFile))
     56 + logger.Info(fmt.Sprintf("Store log file to: %v", logFile))
    46 57  }
    47 58   
    48 59  // GoodF print good message
    skipped 5 lines
    54 65  // BannerF print info message
    55 66  func BannerF(format string, data string) {
    56 67   banner := color.BlueString("[*] %v", format)
    57  - log.Info(fmt.Sprintf("%v%v", banner, color.HiGreenString(data)))
     68 + logger.Info(fmt.Sprintf("%v%v", banner, color.HiGreenString(data)))
    58 69  }
    59 70   
    60 71  // InforF print info message
    61 72  func InforF(format string, args ...interface{}) {
    62  - log.Info(fmt.Sprintf(format, args...))
     73 + logger.Info(fmt.Sprintf(format, args...))
    63 74  }
    64 75   
    65 76  // WarningF print good message
    skipped 4 lines
    70 81   
    71 82  // DebugF print debug message
    72 83  func DebugF(format string, args ...interface{}) {
    73  - log.Debug(fmt.Sprintf(format, args...))
     84 + logger.Debug(fmt.Sprintf(format, args...))
    74 85  }
    75 86   
    76 87  // ErrorF print good message
    skipped 5 lines
  • ■ ■ ■ ■
    core/version.go
    skipped 1 lines
    2 2   
    3 3  const (
    4 4   // VERSION current Jaeles version
    5  - VERSION = "beta v0.1"
     5 + VERSION = "beta v0.2"
    6 6   // AUTHOR author of this
    7 7   AUTHOR = "@j3ssiejjj"
    8 8  )
    skipped 1 lines
  • ■ ■ ■ ■ ■
    modules/scan.go
    skipped 19 lines
    20 20   }
    21 21   
    22 22   massOutput := options.Scan.TmpOutput
    23  - tmpFile, _ := ioutil.TempFile(os.TempDir(), "masscan-*.xml")
     23 + tmpFile, _ := ioutil.TempFile(os.TempDir(), "masscan-*.txt")
    24 24   if massOutput != "" {
    25  - tmpFile, _ = ioutil.TempFile(massOutput, fmt.Sprintf("masscan-%v-*.xml", core.StripPath(input)))
     25 + tmpFile, _ = ioutil.TempFile(massOutput, fmt.Sprintf("masscan-%v-*.txt", core.StripPath(input)))
    26 26   }
    27 27   massOutput = tmpFile.Name()
    28 28   
    29  - masscanCmd := fmt.Sprintf("sudo masscan --rate %v -p %v -oX %v %v", rate, ports, massOutput, input)
     29 + masscanCmd := fmt.Sprintf("sudo masscan --rate %v -p %v -oG %v %v", rate, ports, massOutput, input)
    30 30   core.DebugF("Execute: %v", masscanCmd)
    31 31   command := []string{
    32 32   "bash",
    skipped 71 lines
    104 104   
    105 105  // ParsingMasscan parse result from masscan XML format
    106 106  func ParsingMasscan(raw string) map[string][]string {
     107 + result := make(map[string][]string)
     108 + data := strings.Split(raw, "\n")
     109 + 
     110 + for _, line := range data {
     111 + if !strings.Contains(line, "Host: ") {
     112 + continue
     113 + }
     114 + rawResult := strings.Split(line, " ")
     115 + ip := rawResult[1]
     116 + port := strings.Split(rawResult[len(rawResult)-1], "/")[0]
     117 + result[ip] = append(result[ip], port)
     118 + }
     119 + 
     120 + return result
     121 +}
     122 + 
     123 +// ParsingMasscanXML parse result from masscan XML format
     124 +func ParsingMasscanXML(raw string) map[string][]string {
    107 125   result := make(map[string][]string)
    108 126   doc, err := goquery.NewDocumentFromReader(strings.NewReader(raw))
    109 127   if err != nil {
    skipped 38 lines
  • ■ ■ ■ ■ ■ ■
    modules/scan_test.go
    skipped 25 lines
    26 26   }
    27 27  }
    28 28   
     29 +func TestParseMassScan(t *testing.T) {
     30 + raw := core.GetFileContent("/tmp/ddemo")
     31 + result := ParsingMasscan(raw)
     32 + fmt.Println(result)
     33 + if len(result) == 0 {
     34 + t.Errorf("Error ParsingMasscan")
     35 + }
     36 +}
     37 + 
Please wait...
Page is in error, reload to recover