hackedteam/fuzzer-windows

View on GitHub

Showing 193 of 193 total issues

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

            for i in range(0, header.numberOfCountours):
                self.endPtsOfCountour.append( unpack('>H', handle.read(2))[0] )
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 6 other locations - About 1 hr to fix
fontfuzzer/parsers/TTF.py on lines 1504..1506
fontfuzzer/parsers/TTF.py on lines 1645..1646
fontfuzzer/parsers/TTF.py on lines 1913..1914
fontfuzzer/parsers/TTF.py on lines 2185..2186
fontfuzzer/parsers/TTF.py on lines 2205..2206
fontfuzzer/parsers/TTF.py on lines 2234..2235

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 41.

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 generateTestCases has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def generateTestCases(fontSourceDir, dbConnection):
    fonts = {}
    testcasesFolder = 'testcases'

    print '[D] ', os.path.abspath( fontSourceDir )
Severity: Minor
Found in fontfuzzer/fuzzers/native.py - About 1 hr 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

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

            for i in range(0, self.length):
                self.string.append( unpack('>c', handle.read(1) ) [0] )
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 6 other locations - About 1 hr to fix
fontfuzzer/parsers/TTF.py on lines 1504..1506
fontfuzzer/parsers/TTF.py on lines 1627..1628
fontfuzzer/parsers/TTF.py on lines 1645..1646
fontfuzzer/parsers/TTF.py on lines 1913..1914
fontfuzzer/parsers/TTF.py on lines 2185..2186
fontfuzzer/parsers/TTF.py on lines 2234..2235

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 41.

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 __init__ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self, handle):

        self.version = unpack('>H', handle.read(2) )[0]
        self.xAvgCharWidth = unpack('>h', handle.read(2) )[0]
        self.usWeightClass = unpack('>H', handle.read(2) )[0]
Severity: Minor
Found in fontfuzzer/parsers/TTF.py - About 1 hr to fix

    Function __init__ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, filename, simpleParsing = False):
            font_handle = open(filename,'rb')
            self.filename = filename
            self.fontOffsetTable = FontOffsetTable(font_handle)
            self.fontOffsetTableLength = font_handle.tell()
    Severity: Minor
    Found in fontfuzzer/parsers/TTF.py - About 1 hr to fix

      Function get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, uri):
              
              uriFields = uri.split('/')
      
              if uri == '':
      Severity: Minor
      Found in fontfuzzer/serveragent.py - About 1 hr 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

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

              for i in range(0, numberOfInstructions):
                  self.instructions.append( unpack('>B', handle.read(1))[0])
      Severity: Major
      Found in fontfuzzer/parsers/TTF.py and 1 other location - About 1 hr to fix
      fontfuzzer/parsers/TTF.py on lines 1233..1235

      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 39.

      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 handler_breakpoint has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def handler_breakpoint(pydbg):
          f = open("iface_log", "a")
      
          # ignore the first windows driven breakpoint.
          if pydbg.first_breakpoint:
      Severity: Minor
      Found in ie_sandbox/broker_trace/ieuser_tracer.py - About 1 hr 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

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

              if self.isLong:
                  for i in range(0, numberOfRecords):
                      self.offsets.append( unpack('>L', handle.read(4) ) [0] )
      Severity: Major
      Found in fontfuzzer/parsers/TTF.py and 1 other location - About 1 hr to fix
      fontfuzzer/parsers/TTF.py on lines 1107..1108

      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 39.

      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 3 locations. Consider refactoring.
      Open

      class THREADENTRY32(Structure):
          _fields_ = [
              ('dwSize',             DWORD),
              ('cntUsage',           DWORD),
              ('th32ThreadID',       DWORD),
      Severity: Major
      Found in ie_sandbox/broker_trace/defines.py and 2 other locations - About 1 hr to fix
      ie_sandbox/grayhat/my_debugger_defines.py on lines 215..223
      ie_sandbox/grayhat/my_debugger_defines.py on lines 260..268

      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 38.

      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

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

          for x in range(length):
              fh.write("%c" % emu.get_memory(base + x, 1))
      Severity: Major
      Found in ie_sandbox/grayhat/upx_unpacker.py and 1 other location - About 1 hr to fix
      ie_sandbox/grayhat/upx_unpacker.py on lines 121..122

      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 38.

      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 3 locations. Consider refactoring.
      Open

      class MEMORY_BASIC_INFORMATION(Structure):
          _fields_ = [
              ("BaseAddress", PVOID),
              ("AllocationBase", PVOID),
              ("AllocationProtect", DWORD),
      Severity: Major
      Found in ie_sandbox/grayhat/my_debugger_defines.py and 2 other locations - About 1 hr to fix
      ie_sandbox/broker_trace/defines.py on lines 50..58
      ie_sandbox/grayhat/my_debugger_defines.py on lines 215..223

      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 38.

      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

      Consider simplifying this complex logical expression.
      Open

              if uriFields[0] == 'agents' and len(uriFields) == 3 and uriFields[2] != 'capabilities' \
                                                                  and uriFields[2] != 'jobs': #FIXME: awful, change negative check
      
                  # FIXME: nicer way to get localhost public ip
                  try:
      Severity: Major
      Found in fontfuzzer/serveragent.py - About 1 hr to fix

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

        class THREADENTRY32(Structure):
            _fields_ = [
                ("dwSize",             DWORD),
                ("cntUsage",           DWORD),
                ("th32ThreadID",       DWORD),
        Severity: Major
        Found in ie_sandbox/grayhat/my_debugger_defines.py and 2 other locations - About 1 hr to fix
        ie_sandbox/broker_trace/defines.py on lines 50..58
        ie_sandbox/grayhat/my_debugger_defines.py on lines 260..268

        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 38.

        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

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

            for x in range(length):
                fh.write("%c" % emu.get_memory(base + x, 1))
        Severity: Major
        Found in ie_sandbox/grayhat/upx_unpacker.py and 1 other location - About 1 hr to fix
        ie_sandbox/grayhat/upx_unpacker.py on lines 113..114

        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 38.

        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

                numwrites = random.randrange( math.ceil( (float(len(fileInMemory) ) / fuzzFactor) ) )  + 1
        Severity: Minor
        Found in fontfuzzer/parsers/TTF.py and 1 other location - About 55 mins to fix
        fontfuzzer/parsers/TTF.py on lines 655..655

        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 37.

        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 post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def post(self, uri):
        
                uriFields = uri.split('/')
                      
                # extract from json array the list of nodes
        Severity: Minor
        Found in fontfuzzer/serveragent.py - About 55 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 get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, uri):
                
                uriFields = uri.split('/')
                 
                if uri == '':
        Severity: Minor
        Found in fontfuzzer/hostagent.py - About 55 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 get_debug_event has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_debug_event(self):
                
                debug_event    = DEBUG_EVENT()
                continue_status = DBG_CONTINUE
                
        Severity: Minor
        Found in ie_sandbox/grayhat/my_debugger.py - About 55 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 get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, uri):
        
                uriFields = uri.split('/')
        
                # print the list of connected agents and let the user connect a new agent
        Severity: Minor
        Found in fontfuzzer/serveragent.py - About 55 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