connectbot/sshlib

View on GitHub

Showing 415 of 415 total issues

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

while (true)
{
int c = is.read();
if (c < 0)
throw new IOException("Remote scp terminated unexpectedly.");
Severity: Major
Found in src/main/java/com/trilead/ssh2/SCPClient.java and 1 other location - About 1 hr to fix
src/main/java/com/trilead/ssh2/SCPClient.java on lines 257..282

Method initialize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public void initialize(CryptoWishList cwl, ServerHostKeyVerifier verifier, DHGexParameters dhgex,
int connectTimeout, SecureRandom rnd, ProxyData proxyData) throws IOException
{
/* First, establish the TCP connection to the SSH-2 server */
 
 
Severity: Minor
Found in src/main/java/com/trilead/ssh2/transport/TransportManager.java - About 1 hr to fix

    Method msgChannelOpenFailure has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

      {
      copylen = (stdoutAvail > len) ? len : stdoutAvail;
      System.arraycopy(c.stdoutBuffer, c.stdoutReadpos, target, off, copylen);
      c.stdoutReadpos += copylen;
       
       
      Severity: Major
      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 1 other location - About 1 hr to fix
      src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1070..1082

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

      {
      copylen = (stderrAvail > len) ? len : stderrAvail;
      System.arraycopy(c.stderrBuffer, c.stderrReadpos, target, off, copylen);
      c.stderrReadpos += copylen;
       
       
      Severity: Major
      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 1 other location - About 1 hr to fix
      src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1056..1068

      Method addHostkey has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public void addHostkey(String[] hostnames, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException
      {
      if (hostnames == null)
      throw new IllegalArgumentException("hostnames may not be null");
       
       
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

        Method processSignRequest has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        private void processSignRequest(TypesReader tr)
        {
        try
        {
        if (failWhenLocked())
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java - About 1 hr to fix

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

        public int read(SFTPv3FileHandle handle, long fileOffset, byte[] dst, int dstoff, int len) throws IOException
        {
        checkHandleValidAndOpen(handle);
         
        if ((len > 32768) || (len <= 0))
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

        Method msgChannelOpen has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        public void msgChannelOpen(byte[] msg, int msglen) throws IOException
        {
        TypesReader tr = new TypesReader(msg, 0, msglen);
         
        tr.readByte(); // skip packet type
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

        Method run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        public void run()
        {
        try
        {
        cm.registerThread(this);
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/channel/LocalAcceptThread.java - About 1 hr to fix

        Method verifyHostkey has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        public int verifyHostkey(String hostname, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException
        {
        PublicKey remoteKey = null;
         
        if (RSASHA1Verify.ID_SSH_RSA.equals(serverHostKeyAlgorithm) ||
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

        Method run has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        public void run()
        {
        try
        {
        c.cm.sendOpenConfirmation(c);
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.java - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

          if (tr.readByte() != 0x30 || // ASN.1 sequence
          tr.readByte() != ENCODED_SIZE - 2 || // Expected size
          tr.readByte() != 0x02 || // ASN.1 Integer
          tr.readByte() != 1 || // length
          tr.readByte() != 0 || // v1
          Severity: Critical
          Found in src/main/java/com/trilead/ssh2/crypto/keys/Ed25519PrivateKey.java - About 1 hr to fix

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

            synchronized (c)
            {
            if (c.state == Channel.STATE_CLOSED)
            return; // ignore
             
             
            Severity: Major
            Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 1 other location - About 1 hr to fix
            src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1153..1170

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

            synchronized (c)
            {
            if (c.state == Channel.STATE_CLOSED)
            return; // ignore
             
             
            Severity: Major
            Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 1 other location - About 1 hr to fix
            src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 899..917

            Method readAttrs has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            private SFTPv3FileAttributes readAttrs(TypesReader tr) throws IOException
            {
            /*
            * uint32 flags
            * uint64 size present only if flag SSH_FILEXFER_ATTR_SIZE
            Severity: Minor
            Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

              Method authenticateInteractive has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              public boolean authenticateInteractive(String user, String[] submethods, InteractiveCallback cb) throws IOException
              {
              try
              {
              initialize(user);
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java - About 1 hr to fix

                Method rawFingerPrint has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                private static byte[] rawFingerPrint(String type, String keyType, byte[] hostkey)
                {
                MessageDigest dig = null;
                 
                try {
                Severity: Minor
                Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

                  Method requestX11Forwarding has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  public void requestX11Forwarding(String hostname, int port, byte[] cookie, boolean singleConnection)
                  throws IOException
                  {
                  if (hostname == null)
                  throw new IllegalArgumentException("hostname argument may not be null");
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/Session.java - About 1 hr to fix

                    Method decodeSSHECDSASignature has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    private byte[] decodeSSHECDSASignature(byte[] sig) throws IOException {
                    byte[] rsArray;
                     
                    TypesReader tr = new TypesReader(sig);
                     
                     
                    Severity: Minor
                    Found in src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language