Showing 22,177 of 22,177 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
def exploit
peer = "#{rhost}:#{rport}"
print_status "Ping host..."
- 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 170.
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 run
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
fake_host = datastore['FAKEHOST'] || datastore['HOST']
fake_port = datastore['FAKEPORT'] || datastore['PORT']
host = datastore['HOST']
local_host = datastore['SRVHOST']
Method arp_poisoning
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
def arp_poisoning
lsmac = datastore['LOCALSMAC'] || @smac
raise 'Local Source Mac is not in correct format' unless is_mac?(lsmac)
dhosts_range = Rex::Socket::RangeWalker.new(datastore['DHOSTS'])
Method run_host
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_host(ip)
if datastore['RPORT'].blank? || datastore['RPORT'] == 0
smb_services = [
{ port: 445, direct: true },
{ port: 139, direct: false }
File vbulletin_vote_sqli_exec.rb
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
File kiwi.rb
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rex/post/meterpreter/extensions/kiwi/tlv'
require 'rex/post/meterpreter/extensions/kiwi/command_ids'
require 'rexml/document'
require 'set'
Method run
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
if !datastore['SSLServerNameIndication'].nil?
sni = datastore['SSLServerNameIndication']
print_status("Connecting to #{rhost}:#{rport} SNI:#{sni}")
else
Method run
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
def check_results(passwords, results, hash_type, method)
passwords.each do |password_line|
password_line.chomp!
next if password_line.blank?
Method run
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
def check_results(passwords, results, hash_type, method)
passwords.each do |password_line|
password_line.chomp!
next if password_line.blank?
Method add_constants
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.add_constants(const_mgr)
const_mgr.add_const('MAP_FILE', 0x00)
const_mgr.add_const('MAP_SHARED', 0x01)
const_mgr.add_const('MAP_PRIVATE', 0x02)
const_mgr.add_const('MAP_FIXED', 0x10)
File adobe_cooltype_sing.rb
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'zlib'
class MetasploitModule < Msf::Exploit::Remote
Rank = GreatRanking # aslr+dep bypass, js heap spray, rop, stack bof
File smart_hashdump.rb
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Post
include Msf::Post::File
include Msf::Post::Windows::Priv
include Msf::Post::Windows::Registry
include Msf::Post::Windows::Accounts
File client_request.rb
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri'
require 'rex/mime'
require 'rex/socket'
require 'rex/text'
File platform.rb
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'abbrev'
#
# This is the definitions of which Platforms the framework knows about. The
# relative ranks are used to support ranges, and the Short names are used to
Method run
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
packet = prepare_packet(true)
sock = connect
if sock.nil?
Method exploit
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
# Request using a non-existing table first, to retrieve the table prefix
res = sqli(rand_text_alphanumeric(rand(10)+6))
File nimcontroller_bof.rb
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::Tcp
prepend Msf::Exploit::Remote::AutoCheck
Method make_js
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_js(encoded_payload)
# The following executes a ret2lib using BIB.dll
# The effect is to bypass DEP and execute the shellcode in an indirect way
stack_data = [
Method exploit
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
data = fake_login
print_status("Sending fake login request...")
res = send_request_cgi(
File ms10_046_shortcut_icon_dllloader.rb
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
#
# This module acts as an HTTP server