cea-sec/miasm

View on GitHub
miasm/loader/elf.py

Summary

Maintainability
F
4 days
Test Coverage

File elf.py has 1349 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python

from miasm.loader.cstruct import CStruct

class Ehdr(CStruct):
Severity: Major
Found in miasm/loader/elf.py - About 3 days to fix

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

    class Shdr(CStruct):
        _fields = [ ("name","u32"),
                    ("type","u32"),
                    ("flags","ptr"),
                    ("addr","ptr"),
    Severity: Major
    Found in miasm/loader/elf.py and 2 other locations - About 1 hr to fix
    miasm/loader/minidump.py on lines 160..169
    miasm/loader/pe.py on lines 132..141

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

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

    class Phdr(CStruct):
        _fields = [ ("type","u32"),
                    ("offset","u32"),
                    ("vaddr","u32"),
                    ("paddr","u32"),
    Severity: Major
    Found in miasm/loader/elf.py and 3 other locations - About 1 hr to fix
    miasm/loader/elf.py on lines 44..52
    miasm/loader/pe.py on lines 93..101
    miasm/loader/pe.py on lines 839..847

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

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

    class Phdr64(CStruct):
        _fields = [ ("type","u32"),
                    ("flags","u32"),
                    ("offset","ptr"),
                    ("vaddr","ptr"),
    Severity: Major
    Found in miasm/loader/elf.py and 3 other locations - About 1 hr to fix
    miasm/loader/elf.py on lines 34..42
    miasm/loader/pe.py on lines 93..101
    miasm/loader/pe.py on lines 839..847

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

    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 Sym32(CStruct):
        _fields = [ ("name","u32"),
                    ("value","u32"),
                    ("size","u32"),
                    ("info","u08"),
    Severity: Major
    Found in miasm/loader/elf.py and 2 other locations - About 40 mins to fix
    miasm/loader/elf.py on lines 68..74
    miasm/loader/pe.py on lines 1506..1512

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

    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 Sym64(CStruct):
        _fields = [ ("name","u32"),
                    ("info","u08"),
                    ("other","u08"),
                    ("shndx","u16"),
    Severity: Major
    Found in miasm/loader/elf.py and 2 other locations - About 40 mins to fix
    miasm/loader/elf.py on lines 60..66
    miasm/loader/pe.py on lines 1506..1512

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

    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

    There are no issues that match your filters.

    Category
    Status