Showing 7,361 of 22,177 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
def setup_handler
if !datastore['Proxies'].blank? && !datastore['ReverseAllowProxy']
raise RuntimeError, "SCTP connect-back payloads cannot be used with Proxies. Use 'set ReverseAllowProxy true' to override this behaviour."
end
- 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 94.
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
Method cmd_nessus_report_host_details
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_nessus_report_host_details(*args)
search_term = nil
search_vuln = nil
scan_id = nil
host_id = nil
Method enum_viclient
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enum_viclient
print_status("Information about VMware VI Client:")
vi_pluggins = nil
begin
vi_version = registry_getvaldata("HKLM\\SOFTWARE\\VMware, Inc.\\VMware Virtual Infrastructure Client\\4.0","InstalledVersion")
Method get_indices
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_indices
vprint_status('Querying indices...')
request = {
'uri' => normalize_uri(target_uri.path, '_cat', 'indices/'),
'method' => 'GET',
Method run
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
begin
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(datastore['TARGETURI'], 'getGfiUpgradeFile'),
Method scanner_postscan
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scanner_postscan(batch)
print_status "No SSDP endpoints found." if @results.empty?
@results.each_pair do |skey,res|
sinfo = res[:service]
Method exec_command
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec_command(ip,data)
print_status("[SAP] #{ip}:#{rport} - sending SOAP SXPG_COMMAND_EXECUTE request")
begin
res = send_request_cgi({
'uri' => '/sap/bc/soap/rfc',
Method exec_command
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec_command(ip,data)
print_status("[SAP] #{ip}:#{rport} - sending SOAP SXPG_CALL_SYSTEM request")
begin
res = send_request_cgi({
'uri' => '/sap/bc/soap/rfc',
Method run
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
vprint_status('Checking if target is online and running Wordpress...')
if wordpress_and_online?.nil?
fail_with(Failure::BadConfig, 'The target is not online and running Wordpress')
end
Method scanner_postscan
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scanner_postscan(batch)
@results.keys.each do |k|
response_map = { @probe => @results[k][:messages] }
peer = "#{k}:#{rport}"
Method run_host
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_host(ip)
@ip = ip
print_brute :ip => ip, :msg => 'Starting bruteforce'
cred_collection = build_credential_collection(
Method run_host
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_host(ip)
begin
domain = nil
connect
Method initialize
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(update_info(info,
'Name' => 'Mac OS X mDNSResponder UPnP Location Overflow',
'Description' => %q{
This module exploits a buffer overflow that occurs when processing
Method exploit
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
mytarget = target
if (target.name =~ /Automatic/)
mytarget = auto_target
if (not mytarget)
Method initialize
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Openfire authentication bypass with RCE plugin',
Method initialize
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(update_info(info,
'Name' => 'vBulletin widgetConfig RCE',
'Description' => %q{
vBulletin 5.x through 5.5.4 allows remote command execution via the widgetConfig[code]
Method create_admin_account
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_admin_account(cookie, is_windows)
# This creates an administrator account with the required VFS setting for the exploit to work
admin_username = rand_text_hex(10)
admin_password = rand_text_hex(10)
user_xml = <<~XML.gsub!(/\n */, '')
Method initialize
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(update_info(info,
'Name' => 'Jenkins XStream Groovy classpath Deserialization Vulnerability',
'Description' => %q{
This module exploits CVE-2016-0792 a vulnerability in Jenkins versions older than 1.650 and Jenkins LTS versions
Method initialize
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Apache OFBiz forgotPassword/ProgramExport RCE',
Method initialize
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(update_info(info,
'Name' => 'PostgreSQL COPY FROM PROGRAM Command Execution',
'Description' => %q(
Installations running Postgres 9.3 and above have functionality which allows for the superuser