connectbot/sshlib

View on GitHub

Showing 244 of 412 total issues

Method init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void init() throws IOException
    {
        /* Send SSH_FXP_INIT (version 3) */

        final int client_version = 3;
Severity: Minor
Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

    Method decodePublicKey has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public PublicKey decodePublicKey(byte[] key) throws IOException {
            TypesReader tr = new TypesReader(key);
    
            String key_format = tr.readString();
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java - About 1 hr to fix

      Method generateKeyFromPasswordSaltWithMD5 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static byte[] generateKeyFromPasswordSaltWithMD5(byte[] password, byte[] salt, int keyLen)
                  throws IOException
          {
              if (salt.length < 8)
                  throw new IllegalArgumentException("Salt needs to be at least 8 bytes for key generation.");
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java - About 1 hr to fix

        Method onConnect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                private void onConnect(Socks5Server server) throws IOException {
                    final Channel cn;
        
                    String destHost = server.getHostName();
                    if (destHost == null) {
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/channel/DynamicAcceptThread.java - About 1 hr to fix

          Method waitForChannelRequestResult has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private boolean waitForChannelRequestResult(Channel c) throws IOException
              {
                  synchronized (c)
                  {
                      while ((c.successCounter == 0) && (c.failedCounter == 0))
          Severity: Minor
          Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

            Method put has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void put(byte[] data, String remoteFileName, String remoteTargetDirectory, String mode) throws IOException
                {
                    Session sess = null;
            
                    if ((remoteFileName == null) || (remoteTargetDirectory == null) || (mode == null))
            Severity: Minor
            Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 1 hr to fix

              Method requestX11 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void requestX11(Channel c, boolean singleConnection, String x11AuthenticationProtocol,
                          String x11AuthenticationCookie, int x11ScreenNumber) throws IOException
                  {
                      PacketSessionX11Request psr;
              
              
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

                Method recommendHostkeyAlgorithms has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private String[] recommendHostkeyAlgorithms(String hostname) {
                        List<String> preferredAlgos = new ArrayList<>();
                
                        List<PublicKey> keys = getAllKeys(hostname);
                
                
                Severity: Minor
                Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

                  Method generateKeyFromPasswordSaltWithMD5 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static byte[] generateKeyFromPasswordSaltWithMD5(byte[] password, byte[] salt, int keyLen)
                              throws IOException
                      {
                          if (salt.length < 8)
                              throw new IllegalArgumentException("Salt needs to be at least 8 bytes for key generation.");
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java - About 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method getFirstMatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private String getFirstMatch(String[] client, String[] server) throws NegotiateException
                      {
                          if (client == null || server == null)
                              throw new IllegalArgumentException();
                  
                  
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method requestPTY has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public void requestPTY(String term, int term_width_characters, int term_height_characters, int term_width_pixels,
                              int term_height_pixels, byte[] terminal_modes) throws IOException
                      {
                          if (term == null)
                              throw new IllegalArgumentException("TERM cannot be null.");
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/Session.java - About 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method put has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public void put(byte[] data, String remoteFileName, String remoteTargetDirectory, String mode) throws IOException
                      {
                          Session sess = null;
                  
                          if ((remoteFileName == null) || (remoteTargetDirectory == null) || (mode == null))
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method addHostkey has a Cognitive Complexity of 9 (exceeds 5 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 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method parseCLine has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private LenNamePair parseCLine(String line) throws IOException
                      {
                          /* Minimum line: "xxxx y z" ---> 8 chars */
                  
                          long len;
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method requestPTY has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public void requestPTY(Channel c, String term, int term_width_characters, int term_height_characters,
                              int term_width_pixels, int term_height_pixels, byte[] terminal_modes) throws IOException
                  Severity: Major
                  Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 50 mins to fix

                    Method calculateH has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public byte[] calculateH(String hashAlgo, byte[] clientversion, byte[] serverversion,
                                byte[] clientKexPayload, byte[] serverKexPayload, byte[] hostKey, DHGexParameters para)
                    Severity: Major
                    Found in src/main/java/com/trilead/ssh2/crypto/dh/DhGroupExchange.java - About 50 mins to fix

                      Method init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private void init() throws IOException
                          {
                              /* Send SSH_FXP_INIT (version 3) */
                      
                              final int client_version = 3;
                      Severity: Minor
                      Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 45 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Avoid deeply nested control flow statements.
                      Open

                                              if ((c >= 32) && (c <= 126))
                                                  continue;
                      Severity: Major
                      Found in src/main/java/com/trilead/ssh2/transport/TransportManager.java - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (capableAlgo.equals(knownAlgo)) {
                                                    filteredAlgorithms.add(knownAlgo);
                                                }
                        Severity: Major
                        Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 45 mins to fix

                          Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public void initialize(CryptoWishList cwl, ServerHostKeyVerifier verifier, DHGexParameters dhgex,
                                      int connectTimeout, SecureRandom rnd, ProxyData proxyData) throws IOException
                          Severity: Minor
                          Found in src/main/java/com/trilead/ssh2/transport/TransportManager.java - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language