connectbot/sshlib

View on GitHub

Showing 415 of 415 total issues

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

static int[] SP1 = { 0x01010400, 0x00000000, 0x00010000, 0x01010404, 0x01010004, 0x00010404, 0x00000004,
0x00010000, 0x00000400, 0x01010400, 0x01010404, 0x00000400, 0x01000404, 0x01010004, 0x01000000, 0x00000004,
0x00000404, 0x01000400, 0x01000400, 0x00010400, 0x00010400, 0x01010000, 0x01010000, 0x01000404, 0x00010004,
0x01000004, 0x01000004, 0x00010004, 0x00000000, 0x00000404, 0x00010404, 0x01000000, 0x00010000, 0x01010404,
0x00000004, 0x01010000, 0x01010400, 0x01000000, 0x01000000, 0x00000400, 0x01010004, 0x00010000, 0x00010400,
Severity: Major
Found in src/main/java/com/trilead/ssh2/crypto/cipher/DES.java and 7 other locations - About 2 hrs to fix
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 121..128
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 130..137
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 139..146
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 148..155
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 157..164
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 166..173
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 175..182

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

 
package com.trilead.ssh2.packets;
 
/**
* PacketGlobalForwardRequest.
src/main/java/com/trilead/ssh2/packets/PacketGlobalCancelForwardRequest.java on lines 1..42

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

 
package com.trilead.ssh2.packets;
 
/**
* PacketGlobalCancelForwardRequest.
src/main/java/com/trilead/ssh2/packets/PacketGlobalForwardRequest.java on lines 1..41

Method processSignRequest has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Consider simplifying this complex logical expression.
    Open

    if (kxs.np.kex_algo.equals(Curve25519Exchange.NAME)
    || kxs.np.kex_algo.equals(Curve25519Exchange.ALT_NAME)
    || kxs.np.kex_algo.equals("ecdh-sha2-nistp521")
    || kxs.np.kex_algo.equals("ecdh-sha2-nistp384")
    || kxs.np.kex_algo.equals("ecdh-sha2-nistp256")
    Severity: Critical
    Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

      if (kxs.np.kex_algo.equals("diffie-hellman-group1-sha1")
      || kxs.np.kex_algo.equals("diffie-hellman-group14-sha1")
      || kxs.np.kex_algo.equals("diffie-hellman-group14-sha256")
      || kxs.np.kex_algo.equals("diffie-hellman-group16-sha512")
      || kxs.np.kex_algo.equals("diffie-hellman-group18-sha512")
      Severity: Critical
      Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 2 hrs to fix

        Method decodeSignature has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        private byte[] decodeSignature(byte[] sig) throws IOException
        {
        byte[] rsArray = null;
         
        if (sig.length == 40)
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/signature/DSASHA1Verify.java - About 2 hrs to fix

          Method hostnameMatches has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          private final boolean hostnameMatches(String[] hostpatterns, String hostname)
          {
          boolean isMatch = false;
          boolean negate = false;
           
           
          Severity: Minor
          Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 2 hrs to fix

            Method receiveFiles has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            private void receiveFiles(Session sess, OutputStream[] targets) throws IOException
            {
            byte[] buffer = new byte[8192];
             
            OutputStream os = new BufferedOutputStream(sess.getStdin(), 512);
            Severity: Minor
            Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 1 hr to fix

              Method waitForCondition has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              public int waitForCondition(Channel c, long timeout, int condition_mask)
              {
              long end_time = 0;
              boolean end_time_set = false;
               
               
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

                Method verifyHostkey has 49 lines of code (exceeds 25 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 scanDirectory has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  private final Vector scanDirectory(byte[] handle) throws IOException
                  {
                  Vector files = new Vector();
                   
                  while (true)
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

                    Method receiveMessage has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    public int receiveMessage(byte[] buffer, int off, int len) throws IOException
                    {
                    final int packetLength;
                    final int payloadLength;
                     
                     
                    Severity: Minor
                    Found in src/main/java/com/trilead/ssh2/transport/TransportConnection.java - About 1 hr to fix

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

                      public void run()
                      {
                      byte[] buff = new byte[8192];
                       
                      while (true)
                      Severity: Minor
                      Found in src/main/java/com/trilead/ssh2/StreamGobbler.java - About 1 hr to fix

                        Method removeDuplicates has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                        private String[] removeDuplicates(String[] list)
                        {
                        if ((list == null) || (list.length < 2))
                        return list;
                         
                         
                        Severity: Minor
                        Found in src/main/java/com/trilead/ssh2/Connection.java - About 1 hr to fix

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

                        public PacketChannelWindowAdjust(byte payload[], int off, int len) throws IOException
                        {
                        this.payload = new byte[len];
                        System.arraycopy(payload, off, this.payload, 0, len);
                         
                         
                        src/main/java/com/trilead/ssh2/packets/PacketKexDhGexGroup.java on lines 20..39
                        src/main/java/com/trilead/ssh2/packets/PacketUserauthFailure.java on lines 25..42

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

                        public PacketKexDhGexGroup(byte payload[], int off, int len) throws IOException
                        {
                        this.payload = new byte[len];
                        System.arraycopy(payload, off, this.payload, 0, len);
                         
                         
                        src/main/java/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java on lines 24..43
                        src/main/java/com/trilead/ssh2/packets/PacketUserauthFailure.java on lines 25..42

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

                        public PacketUserauthFailure(byte payload[], int off, int len) throws IOException
                        {
                        this.payload = new byte[len];
                        System.arraycopy(payload, off, this.payload, 0, len);
                         
                         
                        src/main/java/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java on lines 24..43
                        src/main/java/com/trilead/ssh2/packets/PacketKexDhGexGroup.java on lines 20..39

                        Method read has 47 lines of code (exceeds 25 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

                          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 330..355
                          Severity
                          Category
                          Status
                          Source
                          Language