Showing 7,361 of 22,177 total issues
Method initialize
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
{
Method initialize
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'ManageEngine ADAudit Plus Authenticated File Write RCE',
Method initialize
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Microsoft Exchange Server DlpUtils AddTenantDlpPolicy RCE',
Method initialize
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(update_info(info,
'Name' => 'MS11-006 Microsoft Windows CreateSizedDIBSECTION Stack Buffer Overflow',
'Description' => %q{
This module exploits a stack-based buffer overflow in the handling of thumbnails
Method exploit
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
pl = generate_payload_exe
exe_path = "#{datastore['WritableDir']}/.#{rand_text_alphanumeric 5..10}"
print_status("Writing payload executable to '#{exe_path}'")
Method initialize
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'F5 BIG-IP TMUI Directory Traversal and File Upload RCE',
Method initialize
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'VMware vRealize Log Insight Unauthenticated RCE',
Method initialize
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'TAR Path Traversal in Zimbra (CVE-2022-41352)',
Method run
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# setup creds for making IAM API calls
creds = metadata_creds
if datastore['AccessKeyId'].empty?
unless creds.include?('AccessKeyId')
Method parse_accounts
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_accounts(data)
creds = []
doc = begin
REXML::Document.new(data).root
Method run
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
unless is_root?
fail_with Failure::NoAccess, 'This module requires root permissions.'
end
Method run
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# syinfo is only on meterpreter sessions
print_status("Running module against #{sysinfo['Computer']}") if !sysinfo.nil?
# Set variables
Method cmd_isotpsend
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_isotpsend(*args)
bus = ''
id = ''
ret = ''
data = ''
Method create_library
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_library(constant_manager, library_path = 'winspool.drv')
dll = Library.new(library_path, constant_manager)
dll.add_function('AddPrinterA', 'HANDLE',[
["PCHAR","pName","in"],
Method generate
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.generate(cmd)
inner = GadgetChains::TextFormattingRunProperties.generate(cmd)
system_data = Assemblies::VERSIONS['4.0.0.0'].fetch('System.Data')
library = Types::RecordValues::BinaryLibrary.new(
library_id: 3,
Method cmd_grep
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_grep(*args)
match_mods = {:insensitive => false}
output_mods = {:count => false, :invert => false}
opts = OptionParser.new do |opts|
Method import_qualys_scan_xml
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_qualys_scan_xml(args={}, &block)
data = args[:data]
wspace = Msf::Util::DBManager.process_opts_workspace(args, framework).name
bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
Method adaudit_plus_grab_configured_domains
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def adaudit_plus_grab_configured_domains(adapcsrf_cookie, only_get_cookie = false)
vprint_status('Attempting to obtain the list of configured domains...') unless only_get_cookie
res = send_request_cgi({
'uri' => adaudit_plus_configured_domains_uri,
Method asm_reverse_tcp_dns
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def asm_reverse_tcp_dns(opts={})
retry_count = [opts[:retry_count].to_i, 1].max
encoded_port = "0x%.8x" % [opts[:port].to_i,2].pack("vn").unpack("N").first
Identical blocks of code found in 2 locations. Consider refactoring. Open
def on_request_uri(cli, request)
mytarget = target
if target.name == 'Automatic'
mytarget = auto_target(cli, request)
- 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 106.
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