Showing 22,177 of 22,177 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
[ 'Automatic', { } ],
#
# Individual targets
#
- Read upRead up
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 223.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
[ 'Automatic', { } ],
#
# Individual targets
#
- Read upRead up
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 223.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File weblogic_deserialize_marshalledobject.rb
has 452 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ManualRanking
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::JavaDeserialization
File xml.rb
has 452 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'base64'
module Msf::DBManager::Import::MetasploitFramework::XML
#
# CONSTANTS
#
Method generate_html
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_html(payload)
enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
custom_js = %Q|
function check(){
Exploit
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
public class Exploit extends Applet {
private static final long serialVersionUID = 2205862970052148546L;
@Override
Class MetasploitModule
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::EXE
File krb5_pac.rb
has 451 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'bindata'
require 'ruby_smb/dcerpc'
require 'rex/proto/ms_dtyp'
# full MIDL spec for PAC
Method dump_ntds_hashes
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dump_ntds_hashes
_machine_name, domain_name, dns_domain_name = get_machine_name_and_domain_info
return unless domain_name
print_status('Dumping Domain Credentials (domain\\uid:rid:lmhash:nthash)')
Method run
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# we have to overload the process_cracker_results from password_cracker.rb since LANMAN
# is a special case where we may need to do some combining
def process_cracker_results(results, cred)
return results if cred['core_id'].nil? # make sure we have good data
Method generate
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate(_opts = {})
dnsname = datastore['DNSZONE']
wType = 0x0010 #DNS_TYPE_TEXT (TEXT)
wTypeOffset = 0x1c
Method initialize
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(merge_info(info,
'Name' => 'Reverse TCP Stager',
'Description' => 'Connect back to the attacker',
'Author' => 'toto',
Method get_filezilla_creds
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_filezilla_creds(paths)
fs_xml = '' # FileZilla Server.xml - Settings for the local install
fsi_xml = '' # FileZilla Server Interface.xml - Last server used with the interface
credentials = Rex::Text::Table.new(
'Header' => 'FileZilla FTP Server Credentials',
File accounts.rb
has 450 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Msf
class Post
module Windows
module Accounts
include Msf::Post::Windows::Error
Method exploit_newuser
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit_newuser
# TODO: Check if option admin_role exists via admin/people/permissions/roles
# call login page to extract tokens
Method exploit
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
marker = rand_text_alpha(6)
sqli_rand = rand_text_numeric(4+rand(4))
sqli = "' and (select 1 from(select count(*),concat((select (select concat(0x#{marker.unpack('H*')[0]},Hex(cast(id as char)),0x#{marker.unpack('H*')[0]})) "
sqli << "from alienvault.sessions where login='admin' limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and '#{sqli_rand}'='#{sqli_rand}"
File driver.rb
has 448 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'find'
require 'erb'
require 'rexml/document'
require 'fileutils'
require 'digest/md5'
Method record_detection
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def record_detection(cli, request)
os_name = nil
os_flavor = nil
os_sp = nil
os_lang = nil
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method process_hash
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def process_hash(entry, attr)
service_details = {
workspace_id: myworkspace_id,
module_fullname: fullname,
origin_type: :service,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parse_users
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def parse_users(buff)
buff.each_line do |line|
uid = nil
next if line.strip.empty?
- Read upRead up
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"