connectbot/sshlib

View on GitHub

Showing 415 of 415 total issues

Method msgChannelData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

public void msgChannelData(byte[] msg, int msglen) throws IOException
{
if (msglen <= 9)
throw new IOException("SSH_MSG_CHANNEL_DATA message has wrong size (" + msglen + ")");
 
 
Severity: Minor
Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 35 mins to fix

Method receiveLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

private String receiveLine(InputStream is) throws IOException
{
StringBuffer sb = new StringBuffer(30);
 
while (true)
Severity: Minor
Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 35 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{
desFunc(key1, in, inOff, out, outOff);
desFunc(key2, out, outOff, out, outOff);
desFunc(key3, out, outOff, out, outOff);
}
Severity: Minor
Found in src/main/java/com/trilead/ssh2/crypto/cipher/DESede.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/crypto/cipher/DESede.java on lines 92..96

Similar blocks of code found in 2 locations. Consider refactoring.
Open

synchronized (this)
{
/* The following is just a nicer error, we would catch it anyway later in the channel code */
if (flag_closed)
throw new IOException("This session is closed.");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/Session.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/Session.java on lines 185..199

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if (!Arrays.equals(ED25519_OID, oid) ||
tr.readByte() != 0x04 || // ASN.1 octet string
tr.readByte() != KEY_BYTES_LENGTH + 2 || // length
tr.readByte() != 0x04 || // ASN.1 octet string
src/main/java/com/trilead/ssh2/crypto/keys/Ed25519PublicKey.java on lines 91..94

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if (signatureProxy != null)
{
rsa_sig_enc = signatureProxy.sign(msg, SignatureProxy.SHA512);
}
else
Severity: Minor
Found in src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java on lines 219..226

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{
desFunc(key3, in, inOff, out, outOff);
desFunc(key2, out, outOff, out, outOff);
desFunc(key1, out, outOff, out, outOff);
}
Severity: Minor
Found in src/main/java/com/trilead/ssh2/crypto/cipher/DESede.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/crypto/cipher/DESede.java on lines 86..90

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public synchronized LocalPortForwarder createLocalPortForwarder(InetSocketAddress addr, String host_to_connect,
int port_to_connect) throws IOException
{
if (tm == null)
throw new IllegalStateException("Cannot forward ports, you need to establish a connection first.");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/Connection.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/Connection.java on lines 831..841

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if (!Arrays.equals(oid, ED25519_OID) ||
tr.readByte() != 0x03 ||
tr.readByte() != KEY_BYTES_LENGTH + 1 ||
tr.readByte() != 0) {
src/main/java/com/trilead/ssh2/crypto/keys/Ed25519PrivateKey.java on lines 114..117

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if (signatureProxy != null)
{
ds_enc = signatureProxy.sign(msg, SignatureProxy.SHA1);
}
else
Severity: Minor
Found in src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java on lines 248..255

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public synchronized LocalPortForwarder createLocalPortForwarder(int local_port, String host_to_connect,
int port_to_connect) throws IOException
{
if (tm == null)
throw new IllegalStateException("Cannot forward ports, you need to establish a connection first.");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/Connection.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/Connection.java on lines 863..873

Similar blocks of code found in 2 locations. Consider refactoring.
Open

synchronized (this)
{
/* The following is just a nicer error, we would catch it anyway later in the channel code */
if (flag_closed)
throw new IOException("This session is closed.");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/Session.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/Session.java on lines 113..127

Similar blocks of code found in 2 locations. Consider refactoring.
Open

DynamicPortForwarder(ChannelManager cm, int local_port)
throws IOException
{
this.cm = cm;
 
 
Severity: Minor
Found in src/main/java/com/trilead/ssh2/DynamicPortForwarder.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/DynamicPortForwarder.java on lines 62..68

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public byte[] getClientString()
{
byte[] result;
 
try {
Severity: Minor
Found in src/main/java/com/trilead/ssh2/transport/ClientServerHello.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/transport/ClientServerHello.java on lines 115..126

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public byte[] getServerString()
{
byte[] result;
 
try {
Severity: Minor
Found in src/main/java/com/trilead/ssh2/transport/ClientServerHello.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/transport/ClientServerHello.java on lines 99..110

Similar blocks of code found in 2 locations. Consider refactoring.
Open

DynamicPortForwarder(ChannelManager cm, InetSocketAddress addr) throws IOException {
this.cm = cm;
 
dat = new DynamicAcceptThread(cm, addr);
dat.setDaemon(true);
Severity: Minor
Found in src/main/java/com/trilead/ssh2/DynamicPortForwarder.java and 1 other location - About 35 mins to fix
src/main/java/com/trilead/ssh2/DynamicPortForwarder.java on lines 52..60

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if (len != (msglen - 9))
throw new IOException("SSH_MSG_CHANNEL_DATA message has wrong len (calculated " + (msglen - 9) + ", got "
+ len + ")");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 1 other location - About 30 mins to fix
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 892..894

Identical blocks of code found in 2 locations. Consider refactoring.
Open

for (int i = 0; i < remainingMethods.length; i++)
{
if (remainingMethods[i].compareTo(methName) == 0)
return true;
}
Severity: Minor
Found in src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java and 1 other location - About 30 mins to fix
src/main/java/com/trilead/ssh2/Connection.java on lines 1127..1131

Identical blocks of code found in 2 locations. Consider refactoring.
Open

for (int i = 0; i < methods.length; i++)
{
if (methods[i].compareTo(method) == 0)
return true;
}
Severity: Minor
Found in src/main/java/com/trilead/ssh2/Connection.java and 1 other location - About 30 mins to fix
src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java on lines 72..76

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if (len != (msglen - 13))
throw new IOException("SSH_MSG_CHANNEL_EXTENDED_DATA message has wrong len (calculated " + (msglen - 13)
+ ", got " + len + ")");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 1 other location - About 30 mins to fix
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1146..1148
Severity
Category
Status
Source
Language