connectbot/sshlib

View on GitHub

Showing 412 of 412 total issues

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

synchronized (c.channelSendLock) {
if (c.closeMessageSent)
throw new IOException("Cannot request PTY on this channel ("
+ c.getReasonClosed() + ")");
tm.sendMessage(spr.getPayload());
Severity: Major
Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 6 other locations - About 30 mins to fix
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 661..666
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 697..702
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 755..760
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 790..795
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 822..827
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 857..862

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

synchronized (c.channelSendLock)
{
if (c.closeMessageSent)
throw new IOException("Cannot request PTY on this channel (" + c.getReasonClosed() + ")");
tm.sendMessage(spr.getPayload());
Severity: Major
Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 6 other locations - About 30 mins to fix
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 661..666
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 730..735
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 755..760
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 790..795
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 822..827
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 857..862

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

synchronized (c.channelSendLock)
{
if (c.closeMessageSent)
throw new IOException("Cannot request X11 on this channel (" + c.getReasonClosed() + ")");
tm.sendMessage(psr.getPayload());
Severity: Major
Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 6 other locations - About 30 mins to fix
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 661..666
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 697..702
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 730..735
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 790..795
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 822..827
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 857..862

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

synchronized (c.channelSendLock)
{
if (c.closeMessageSent)
throw new IOException("Cannot execute command on this channel (" + c.getReasonClosed() + ")");
tm.sendMessage(sm.getPayload());
Severity: Major
Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 6 other locations - About 30 mins to fix
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 661..666
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 697..702
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 730..735
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 755..760
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 790..795
src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 857..862

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

for (int i = 0; i < mode.length(); i++)
if (!Character.isDigit(mode.charAt(i)))
throw new IllegalArgumentException("Invalid mode.");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/SCPClient.java and 1 other location - About 30 mins to fix
src/main/java/com/trilead/ssh2/SCPClient.java on lines 524..526

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

for (int i = 0; i < mode.length(); i++)
if (!Character.isDigit(mode.charAt(i)))
throw new IllegalArgumentException("Invalid mode.");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/SCPClient.java and 1 other location - About 30 mins to fix
src/main/java/com/trilead/ssh2/SCPClient.java on lines 584..586

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

if (msg[0] == Packets.SSH_MSG_USERAUTH_SUCCESS)
{
authenticated = true;
tm.removeMessageHandler(this, 0, 255);
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/auth/AuthenticationManager.java on lines 481..486

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

if (ar[0] == Packets.SSH_MSG_USERAUTH_SUCCESS)
{
authenticated = true;
tm.removeMessageHandler(this, 0, 255);
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/auth/AuthenticationManager.java on lines 149..154

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

while (true)
{
int len = fr.read(buff);
if (len < 0)
break;
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/KnownHosts.java on lines 474..480

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

while (true)
{
int len = fr.read(buff);
if (len < 0)
break;
Severity: Minor
Found in src/main/java/com/trilead/ssh2/KnownHosts.java and 1 other location - About 30 mins to fix
src/main/java/com/trilead/ssh2/Connection.java on lines 418..424

Method decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

private static byte[] decode(byte[] input) throws InvalidKeySpecException {
if (input.length != ENCODED_SIZE) {
throw new InvalidKeySpecException("Key is not of correct size");
}
 
 
Severity: Minor
Found in src/main/java/com/trilead/ssh2/crypto/keys/Ed25519PublicKey.java - About 25 mins to fix

Method removeIdentity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

private void removeIdentity(TypesReader tr) {
try
{
if (failWhenLocked())
return;
Severity: Minor
Found in src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java - About 25 mins to fix

Method compareFirstOfNameList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

private boolean compareFirstOfNameList(String[] a, String[] b)
{
if (a == null || b == null)
throw new IllegalArgumentException();
 
 
Severity: Minor
Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 25 mins to fix

Method read has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

public int read(byte[] b, int off, int len) throws IOException
{
if (b == null)
throw new NullPointerException();
 
 
Severity: Minor
Found in src/main/java/com/trilead/ssh2/channel/ChannelInputStream.java - About 25 mins to fix

Method openDirectory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

private final byte[] openDirectory(String path) throws IOException
{
int req_id = generateNextRequestID();
 
TypesWriter tw = new TypesWriter();
Severity: Minor
Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 25 mins to fix

Method readBytes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

private final void readBytes(byte[] buff, int pos, int len) throws IOException
{
while (len > 0)
{
int count = is.read(buff, pos, len);
Severity: Minor
Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 25 mins to fix

Method openFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

private SFTPv3FileHandle openFile(String fileName, int flags, SFTPv3FileAttributes attr) throws IOException
{
int req_id = generateNextRequestID();
 
TypesWriter tw = new TypesWriter();
Severity: Minor
Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 25 mins to fix

Method hexToInt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

private static int hexToInt(char c)
{
if ((c >= 'a') && (c <= 'f'))
{
return (c - 'a') + 10;
Severity: Minor
Found in src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java - About 25 mins to fix

Method decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

private static byte[] decode(PKCS8EncodedKeySpec keySpec) throws InvalidKeySpecException {
byte[] encoded = keySpec.getEncoded();
if (encoded.length != ENCODED_SIZE) {
throw new InvalidKeySpecException("Key spec is of invalid size");
}
Severity: Minor
Found in src/main/java/com/trilead/ssh2/crypto/keys/Ed25519PrivateKey.java - About 25 mins to fix

Method isPEMEncrypted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

public static final boolean isPEMEncrypted(PEMStructure ps) throws IOException
{
if (ps.pemType == PEM_OPENSSH_PRIVATE_KEY) {
TypesReader tr = new TypesReader(ps.data);
byte[] magic = tr.readBytes(OPENSSH_V1_MAGIC.length);
Severity: Minor
Found in src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java - About 25 mins to fix
Severity
Category
Status
Source
Language