hackedteam/test-av2

View on GitHub
scripts/dvd_offline/build.py

Summary

Maintainability
D
2 days
Test Coverage

File build.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import re
import time
import socket
import urllib2
Severity: Minor
Found in scripts/dvd_offline/build.py - About 2 hrs to fix

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

        def execute_elite(self):
            """ build scout and upgrade it to elite """
            instance = self.execute_scout()
    
            if not instance:
    Severity: Minor
    Found in scripts/dvd_offline/build.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

    Function _create_new_factory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _create_new_factory(self, operation, target, factory, config):
            with connection() as c:
                operation_id, group_id = c.operation(operation)
                print "DBG type: ", self.ftype, " operation: " , operation, " target: ", target, " factory: ", factory
    
    
    Severity: Minor
    Found in scripts/dvd_offline/build.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, backend, frontend=None, platform='windows', kind='silent', hostname='noav', ftype='desktop', blacklist=[]):
    Severity: Major
    Found in scripts/dvd_offline/build.py - About 50 mins to fix

      Function execute_pull has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute_pull(self):
              """ build and execute the  """
              
              print "- Host: %s %s\n" % (self.hostname, time.ctime())
              operation = 'AVMonitor'
      Severity: Minor
      Found in scripts/dvd_offline/build.py - 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 execute_scout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute_scout(self):
              """ build and execute the  """
              factory_id, ident, exe = self.execute_pull()
      
              self._execute_build(exe)
      Severity: Minor
      Found in scripts/dvd_offline/build.py - 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

      Function _build_agent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _build_agent(self, factory, melt = None, demo = False, tries = 0):
              with connection() as c:
                  params = {}
                  params['blackberry'] = {'platform': 'blackberry',
                      'binary': {'demo': demo},
      Severity: Minor
      Found in scripts/dvd_offline/build.py - 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

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

                  params['exploit'] = {"generate": 
                      {"platforms": ["windows"], "binary": {"demo": False, "admin": False}, "exploit":"HT-2012-001", 
                      "melt":{"demo":False, "scout":True, "admin":False}}, "platform":"exploit", "deliver": {"user":"USERID"},
                      "melt":{"combo":"txt", "filename":"example.txt", "appname":"agent.exe", 
                      "input":"000"}, "factory":{"_id":"000"}
      Severity: Major
      Found in scripts/dvd_offline/build.py and 10 other locations - About 3 hrs to fix
      AVAgent/build.py on lines 1076..1082
      AVAgent/build.py on lines 1085..1091
      AVAgent/build.py on lines 1093..1099
      AVAgent/build.py on lines 1101..1107
      AVMaster/conf/params.py on lines 42..47
      AVMaster/conf/params.py on lines 50..56
      AVMaster/conf/params.py on lines 58..64
      AVMaster/conf/params.py on lines 66..72
      scripts/dvd_offline/build.py on lines 130..134
      scripts/dvd_offline/build.py on lines 136..140

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

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

                  params['exploit_docx'] = {"generate": 
                          {"platforms": ["windows"], "binary": {"demo": False, "admin": False}, "exploit":"HT-2013-002", 
                          "melt":{"demo":False, "scout":True, "admin":False}}, 
                      "platform":"exploit", "deliver": {"user":"USERID"},
                      "melt":{"filename":"example.docx", "appname":"APPNAME", "input":"000", "url":"http://HOSTNAME/APPNAME" }, "factory":{"_id":"000"}
      Severity: Major
      Found in scripts/dvd_offline/build.py and 10 other locations - About 3 hrs to fix
      AVAgent/build.py on lines 1076..1082
      AVAgent/build.py on lines 1085..1091
      AVAgent/build.py on lines 1093..1099
      AVAgent/build.py on lines 1101..1107
      AVMaster/conf/params.py on lines 42..47
      AVMaster/conf/params.py on lines 50..56
      AVMaster/conf/params.py on lines 58..64
      AVMaster/conf/params.py on lines 66..72
      scripts/dvd_offline/build.py on lines 123..127
      scripts/dvd_offline/build.py on lines 136..140

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

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

                  params['exploit_ppsx'] = {"generate": 
                          {"platforms": ["windows"], "binary": {"demo": False, "admin": False}, "exploit":"HT-2013-003", 
                          "melt":{"demo":False, "scout":True, "admin":False}}, 
                      "platform":"exploit", "deliver": {"user":"USERID"},
                      "melt":{"filename":"example.ppsx", "appname":"APPNAME", "input":"000", "url":"http://HOSTNAME/APPNAME" }, "factory":{"_id":"000"}
      Severity: Major
      Found in scripts/dvd_offline/build.py and 10 other locations - About 3 hrs to fix
      AVAgent/build.py on lines 1076..1082
      AVAgent/build.py on lines 1085..1091
      AVAgent/build.py on lines 1093..1099
      AVAgent/build.py on lines 1101..1107
      AVMaster/conf/params.py on lines 42..47
      AVMaster/conf/params.py on lines 50..56
      AVMaster/conf/params.py on lines 58..64
      AVMaster/conf/params.py on lines 66..72
      scripts/dvd_offline/build.py on lines 123..127
      scripts/dvd_offline/build.py on lines 130..134

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

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

                  params['blackberry'] = {'platform': 'blackberry',
                      'binary': {'demo': demo},
                      'melt': {'appname': 'facebook',
                          'name': 'Facebook Application',
                          'desc': 'Applicazione utilissima di social network',
      Severity: Major
      Found in scripts/dvd_offline/build.py and 2 other locations - About 1 hr to fix
      AVAgent/build.py on lines 1041..1049
      AVMaster/conf/params.py on lines 6..14

      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

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

              if not os.path.exists('build/%s' % self.platform):
                  os.mkdir('build/%s' % self.platform)
      Severity: Major
      Found in scripts/dvd_offline/build.py and 1 other location - About 1 hr to fix
      AVAgent/build.py on lines 705..706

      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

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

                  params['windows'] = { 'platform': 'windows',
                      'binary': { 'demo' : demo, 'admin' : False},
                      'melt' : {'scout' : True, 'admin' : False, 'bit64' : True, 'codec' : True },
                      'sign' : {}
      Severity: Major
      Found in scripts/dvd_offline/build.py and 2 other locations - About 55 mins to fix
      AVAgent/build.py on lines 1050..1054
      AVMaster/conf/params.py on lines 16..20

      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

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

              privs = ['ADMIN','ADMIN_USERS','ADMIN_OPERATIONS','ADMIN_TARGETS','ADMIN_AUDIT','ADMIN_LICENSE','SYS','SYS_FRONTEND','SYS_BACKEND','SYS_BACKUP','SYS_INJECTORS','SYS_CONNECTORS','TECH','TECH_FACTORIES','TECH_BUILD','TECH_CONFIG','TECH_EXEC','TECH_UPLOAD','TECH_IMPORT','TECH_NI_RULES','VIEW','VIEW_ALERTS','VIEW_FILESYSTEM','VIEW_EDIT','VIEW_DELETE','VIEW_EXPORT','VIEW_PROFILES'] 
      Severity: Major
      Found in scripts/dvd_offline/build.py and 3 other locations - About 35 mins to fix
      AVAgent/build.py on lines 424..430
      scripts/dvd_offline/rcs_client.py on lines 385..385
      tests_integration/test_rcs_client.py on lines 153..155

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

      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