Showing 7,361 of 22,177 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
public static short[] HexDecode(String s)
{
short[] data = new short[s.length()/2];
for (int i = 0; i < s.length(); i += 2)
- 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 140.
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
public static short[] HexDecode(String s)
{
short[] data = new short[s.length()/2];
for (int i = 0; i < s.length(); i += 2)
- 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 140.
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_scan_list
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_nessus_scan_list(*args)
search_term = nil
while (arg = args.shift)
case arg
when '-h', '--help'
Method on_client_data
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_client_data(c)
data = c.get_once
return unless data
num, cmd, arg = data.strip.split(/\s+/, 3)
cmd ||= ''
Method on_request_uri
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_request_uri(cli, request)
my_host = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
case request.method
when 'OPTIONS'
Method run
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, 'fm', 'fmrest', 'about', 'version'),
'method' => 'GET'
)
Method run
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
print_status("Grabbing the SQL Server name and domain...")
db_server_name = get_server_name
if db_server_name.nil?
print_error("Unable to grab the server name")
Method run
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
if session
set_mssql_session(session.client)
else
print_status("Attempting to connect to the database server at #{rhost}:#{rport} as #{datastore['USERNAME']}...")
Method run
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# Check connection and issue initial query
if session
set_mssql_session(session.client)
else
Method run_host
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_host(_ip)
soapenv = 'http://schemas.xmlsoap.org/soap/envelope/'
soapenvenc = 'http://schemas.xmlsoap.org/soap/encoding/'
xsi = 'http://www.w3.org/1999/XMLSchema-instance'
xsd = 'http://www.w3.org/1999/XMLSchema'
Method run
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
credentials = ::Aws::Credentials.new(datastore['ACCESS_KEY_ID'], datastore['SECRET_ACCESS_KEY'])
vprint_status "Checking #{datastore['REGION']}..."
client = ::Aws::SSM::Client.new(
region: datastore['REGION'],
Method run_host
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_host(ip)
cli = Rex::Proto::Http::Client.new(datastore['RHOSTS'], datastore['RPORT'], {}, datastore['SSL'], datastore['SSLVersion'], nil, '', '')
cli.set_config({ 'preferred_auth' => 'NTLM' })
cli.connect
Method run_host
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_host(ip)
uri = normalize_uri(target_uri.path)
print_status("Verifying login exists at #{target_url}")
begin
Method check_hku_entry
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_hku_entry(key, ip, smbshare, cmd, text, bat)
begin
key = key.split("HKEY_USERS\\")[1].chomp
command = "#{cmd} /C echo reg.exe QUERY \"HKU\\#{key}\\Volatile Environment\" ^> %SYSTEMDRIVE%#{text} > #{bat} & #{cmd} /C start cmd.exe /C #{bat}"
out = psexec(command)
Method smb_proto_info
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def smb_proto_info
info = {
capabilities: {},
versions: []
}
Method initialize
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'pfSense authenticated graph status RCE',
Method initialize
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Tiki Wiki unserialize() PHP Code Execution',
Method exploit
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
base = target_uri.path
@fname = rand_text_alphanumeric(rand(10) + 6) + '.php'
user = datastore['USERNAME']
pass = datastore['PASSWORD']
Method initialize
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(update_info(info,
'Name' => 'PHPMailer Sendmail Argument Injection',
'Description' => %q{
PHPMailer versions up to and including 5.2.19 are affected by a
Method initialize
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'SPIP Unauthenticated RCE via porte_plume Plugin',