owasp-amass/resolve

View on GitHub

Showing 15 of 15 total issues

Method Resolvers.ClientSubnetCheck has 52 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (r *Resolvers) ClientSubnetCheck() {
    all := r.pool.AllResolvers()
    alen := len(all)
    ch := make(chan *dns.Msg, alen)
    var msglock sync.Mutex
Severity: Minor
Found in ecs.go - About 1 hr to fix

    Method Resolvers.ClientSubnetCheck has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
    Open

    func (r *Resolvers) ClientSubnetCheck() {
        all := r.pool.AllResolvers()
        alen := len(all)
        ch := make(chan *dns.Msg, alen)
        var msglock sync.Mutex
    Severity: Minor
    Found in ecs.go - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function sendInitialRequests has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func sendInitialRequests(ctx context.Context, name string, queries map[string]int, responses chan *dns.Msg, p *params) {
    Severity: Minor
    Found in cmd/resolve/main.go - About 35 mins to fix

      Function processResponse has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func processResponse(ctx context.Context, name string, resp *dns.Msg, out queue.Queue, p *params) {
      Severity: Minor
      Found in cmd/resolve/main.go - About 35 mins to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        func parseAType(rr dns.RR) string {
            var value string
            if t, ok := rr.(*dns.A); ok {
                if ip := net.ParseIP(t.A.String()); ip != nil {
                    value = ip.String()
        Severity: Minor
        Found in msgs.go and 1 other location - About 35 mins to fix
        msgs.go on lines 141..149

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 106.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        func parseAAAAType(rr dns.RR) string {
            var value string
            if t, ok := rr.(*dns.AAAA); ok {
                if ip := net.ParseIP(t.AAAA.String()); ip != nil {
                    value = ip.String()
        Severity: Minor
        Found in msgs.go and 1 other location - About 35 mins to fix
        msgs.go on lines 131..139

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 106.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function EventLoop has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
        Open

        func EventLoop(p *params) {
            var avg float32 = 1.0
            var count, persec, processing int
            finished := queue.NewQueue()
            responses := make(chan *dns.Msg, p.QPS*2)
        Severity: Minor
        Found in cmd/resolve/main.go - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function ObtainParams has 5 return statements (exceeds 4 allowed).
        Open

        func ObtainParams(args []string) (*params, *bytes.Buffer, error) {
            var timeout int
            var queryTypes, rlist CommaSep
            var rpath, ipath, lpath, opath, detector string
        
        
        Severity: Major
        Found in cmd/resolve/main.go - About 35 mins to fix

          Similar blocks of code found in 5 locations. Consider refactoring.
          Open

          func parseCNAMEType(rr dns.RR) string {
              var value string
              if t, ok := rr.(*dns.CNAME); ok {
                  name := RemoveLastDot(t.Target)
          
          
          Severity: Major
          Found in msgs.go and 4 other locations - About 30 mins to fix
          msgs.go on lines 163..173
          msgs.go on lines 175..185
          msgs.go on lines 187..197
          msgs.go on lines 215..225

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 5 locations. Consider refactoring.
          Open

          func parseSRVType(rr dns.RR) string {
              var value string
              if t, ok := rr.(*dns.SRV); ok {
                  name := RemoveLastDot(t.Target)
          
          
          Severity: Major
          Found in msgs.go and 4 other locations - About 30 mins to fix
          msgs.go on lines 151..161
          msgs.go on lines 163..173
          msgs.go on lines 175..185
          msgs.go on lines 187..197

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 5 locations. Consider refactoring.
          Open

          func parseMXType(rr dns.RR) string {
              var value string
              if t, ok := rr.(*dns.MX); ok {
                  name := RemoveLastDot(t.Mx)
          
          
          Severity: Major
          Found in msgs.go and 4 other locations - About 30 mins to fix
          msgs.go on lines 151..161
          msgs.go on lines 163..173
          msgs.go on lines 175..185
          msgs.go on lines 215..225

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 5 locations. Consider refactoring.
          Open

          func parsePTRType(rr dns.RR) string {
              var value string
              if t, ok := rr.(*dns.PTR); ok {
                  name := RemoveLastDot(t.Ptr)
          
          
          Severity: Major
          Found in msgs.go and 4 other locations - About 30 mins to fix
          msgs.go on lines 151..161
          msgs.go on lines 175..185
          msgs.go on lines 187..197
          msgs.go on lines 215..225

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 5 locations. Consider refactoring.
          Open

          func parseNSType(rr dns.RR) string {
              var value string
              if t, ok := rr.(*dns.NS); ok {
                  name := RemoveLastDot(t.Ns)
          
          
          Severity: Major
          Found in msgs.go and 4 other locations - About 30 mins to fix
          msgs.go on lines 151..161
          msgs.go on lines 163..173
          msgs.go on lines 187..197
          msgs.go on lines 215..225

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function FirstProperSubdomain has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
          Open

          func FirstProperSubdomain(ctx context.Context, r *Resolvers, name string) string {
              var domain string
              // Obtain all parts of the subdomain name
              labels := strings.Split(strings.TrimSpace(name), ".")
          loop:
          Severity: Minor
          Found in sub.go - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method Resolvers.enforceMaxQPS has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
          Open

          func (r *Resolvers) enforceMaxQPS() {
          loop:
              for {
                  select {
                  case <-r.done:
          Severity: Minor
          Found in resolvers.go - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language