BenIlies/NoPASARAN

View on GitHub

Showing 89 of 89 total issues

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

def set_TCP_automatic_packet_seq(packet):
    increase = 0
    if packet['TCP'].flags in ['S','F','SA','FA']:
        increase =  1
    elif packet['TCP'].flags in ['P','PA']:
Severity: Major
Found in nopasaran/utils.py and 1 other location - About 1 day to fix
nopasaran/utils.py on lines 71..81

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

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

def set_TCP_automatic_packet_ack(ack_packet, original_packet):
    increase = 0
    if original_packet['TCP'].flags in ['S','F','SA','FA']:
        increase =  1
    elif original_packet['TCP'].flags in ['P','PA']:
Severity: Major
Found in nopasaran/utils.py and 1 other location - About 1 day to fix
nopasaran/utils.py on lines 59..69

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

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

File dns_primitives.py has 459 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from scapy.all import IP, UDP, DNS, DNSQR, DNSRR
from nopasaran.decorators import parsing_decorator


class DNSPrimitives:
Severity: Minor
Found in nopasaran/primitives/action_primitives/dns_primitives.py - About 7 hrs to fix

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_IP_src(inputs, outputs, state_machine):
            """
            Set the source IP address of an IP packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/ip_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 183..210
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 239..270
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 554..586
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 618..650
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 43..75
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 142..174
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 37..69
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 72..104

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_DNS_transaction_id(inputs, outputs, state_machine):
            """
            Set the transaction ID in the DNS packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/dns_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 239..270
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 554..586
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 618..650
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 8..40
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 43..75
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 142..174
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 37..69
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 72..104

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_IP_dst(inputs, outputs, state_machine):
            """
            Set the destination IP address of an IP packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/ip_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 183..210
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 239..270
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 554..586
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 618..650
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 8..40
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 142..174
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 37..69
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 72..104

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_UDP_dport(inputs, outputs, state_machine):
            """
            Set the destination port of a UDP packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/udp_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 183..210
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 239..270
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 554..586
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 618..650
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 8..40
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 43..75
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 142..174
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 37..69

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def add_DNS_response_to_additional(inputs, outputs, state_machine):
            """
            Add a DNS response packet to the additional answer section of a DNS packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/dns_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 183..210
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 239..270
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 554..586
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 8..40
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 43..75
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 142..174
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 37..69
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 72..104

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_UDP_sport(inputs, outputs, state_machine):
            """
            Set the source port of a UDP packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/udp_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 183..210
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 239..270
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 554..586
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 618..650
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 8..40
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 43..75
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 142..174
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 72..104

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_IP_ttl(inputs, outputs, state_machine):
            """
            Set the TTL (Time To Live) value of an IP packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/ip_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 183..210
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 239..270
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 554..586
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 618..650
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 8..40
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 43..75
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 37..69
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 72..104

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def add_DNS_response_to_answer(inputs, outputs, state_machine):
            """
            Add a DNS response packet to the answer section of a DNS packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/dns_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 183..210
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 239..270
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 618..650
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 8..40
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 43..75
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 142..174
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 37..69
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 72..104

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def add_DNS_query_to_DNS_packet(inputs, outputs, state_machine):
            """
            Add a DNS query (DNSQR) to a DNS packet.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/dns_primitives.py and 8 other locations - About 5 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 183..210
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 554..586
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 618..650
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 8..40
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 43..75
    nopasaran/primitives/action_primitives/ip_primitives.py on lines 142..174
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 37..69
    nopasaran/primitives/action_primitives/udp_primitives.py on lines 72..104

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_TCP_seq(inputs, outputs, state_machine):
            """
            Set the sequence number of a TCP packet in the machine's state.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/tcp_primitives.py and 5 other locations - About 4 hrs to fix
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 36..61
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 63..88
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 143..168
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 170..195
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 197..222

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_TCP_flags(inputs, outputs, state_machine):
            """
            Set the TCP flags of a TCP packet in the machine's state.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/tcp_primitives.py and 5 other locations - About 4 hrs to fix
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 36..61
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 63..88
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 90..115
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 170..195
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 197..222

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_TCP_sport(inputs, outputs, state_machine):
            """
            Set the source port of a TCP packet in the machine's state.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/tcp_primitives.py and 5 other locations - About 4 hrs to fix
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 63..88
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 90..115
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 143..168
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 170..195
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 197..222

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_TCP_payload(inputs, outputs, state_machine):
            """
            Set the payload of a TCP packet in the machine's state.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/tcp_primitives.py and 5 other locations - About 4 hrs to fix
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 36..61
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 63..88
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 90..115
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 143..168
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 170..195

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_TCP_ack(inputs, outputs, state_machine):
            """
            Set the acknowledgment number of a TCP packet in the machine's state.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/tcp_primitives.py and 5 other locations - About 4 hrs to fix
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 36..61
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 63..88
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 90..115
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 143..168
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 197..222

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_TCP_dport(inputs, outputs, state_machine):
            """
            Set the destination port of a TCP packet in the machine's state.
    Severity: Major
    Found in nopasaran/primitives/action_primitives/tcp_primitives.py and 5 other locations - About 4 hrs to fix
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 36..61
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 90..115
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 143..168
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 170..195
    nopasaran/primitives/action_primitives/tcp_primitives.py on lines 197..222

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_query_name(inputs, outputs, state_machine):
            """
            Set the domain name (qname) of a DNS query (DNSQR).
    Severity: Major
    Found in nopasaran/primitives/action_primitives/dns_primitives.py and 5 other locations - About 4 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 362..391
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 393..422
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 452..484
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 486..518
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 520..552

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

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

        @staticmethod
        @parsing_decorator(input_args=2, output_args=1)
        def set_query_class(inputs, outputs, state_machine):
            """
            Set the query class (qclass) of a DNS query (DNSQR).
    Severity: Major
    Found in nopasaran/primitives/action_primitives/dns_primitives.py and 5 other locations - About 4 hrs to fix
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 302..331
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 362..391
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 452..484
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 486..518
    nopasaran/primitives/action_primitives/dns_primitives.py on lines 520..552

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

    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

    Severity
    Category
    Status
    Source
    Language