Giter Site home page Giter Site logo

shiftmediaproject / libssh Goto Github PK

View Code? Open in Web Editor NEW
28.0 10.0 25.0 7.7 MB

Unofficial LibSSH with added custom native Visual Studio project build tools. LibSSH: Mulitplatform C library implementing the SSHv2 and SSHv1 protocol for client and server implementations.

Home Page: http://www.libssh.org/

License: Other

C 94.83% Shell 0.08% C++ 0.57% Python 0.01% CMake 4.22% Batchfile 0.29%
libssh visualstudio visual-studio msvc

libssh's Introduction

ShiftMediaProject libssh

Build status Github All Releases GitHub release GitHub issues license donate

ShiftMediaProject

Shift Media Project aims to provide native Windows development libraries for libssh and associated dependencies to support simpler creation and debugging of rich media content directly within Visual Studio. https://shiftmediaproject.github.io/

libssh

Mulitplatform C library implementing the SSHv2 and SSHv1 protocol for client and server implementations. https://www.libssh.org/

Downloads

Development libraries are available from the releases page. These libraries are available for each supported Visual Studio version with a different download for each version. Each download contains both static and dynamic libraries to choose from in both 32bit and 64bit versions.

Code

This repository contains code from the corresponding upstream project with additional modifications to allow it to be compiled with Visual Studio. New custom Visual Studio projects are provided within the 'SMP' sub-directory. Refer to the 'readme' contained within the 'SMP' directory for further details.

Issues

Any issues related to the ShiftMediaProject specific changes should be sent to the issues page for the repository. Any issues related to the upstream project should be sent upstream directly (see the issues information of the upstream repository for more details).

License

ShiftMediaProject original code is released under LGPLv2.1. All code from the upstream repository remains under its original license (see the license information of the upstream repository for more details).

Copyright

As this repository includes code from upstream project(s) it includes many copyright owners. ShiftMediaProject makes NO claim of copyright on any upstream code. However, all original ShiftMediaProject authored code is copyright ShiftMediaProject. For a complete copyright list please checkout the source code to examine license headers. Unless expressly stated otherwise all code submitted to the ShiftMediaProject project (in any form) is licensed under LGPLv2.1 and copyright is donated to ShiftMediaProject. If you submit code that is not your own work it is your responsibility to place a header stating the copyright.

Contributing

Patches related to the ShiftMediaProject specific changes should be sent as pull requests to the main repository. Any changes related to the upstream project should be sent upstream directly (see the contributing information of the upstream repository for more details).

libssh's People

Contributors

albaguirre avatar amdunn avatar ansasaki avatar arisada avatar audriusbutkevicius avatar btoews avatar cgwalters avatar cryptomilk avatar davidwed avatar dbussink avatar fidencio avatar firewave avatar gaaf avatar giga avatar jakuje avatar jogme avatar kevinmkane avatar lperkov avatar mengtan avatar neheb avatar nviennot avatar petervo avatar rofl0r avatar sibras avatar simo5 avatar simonsj avatar tnafele avatar worr avatar xiaoxiang781216 avatar xiw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libssh's Issues

libssh 0.8.0 update with libssh 0.10.5 (latest)

Hello,
I have an old project started in 2018, using libssh 0.8.0 and still working.
It's a kind of tutorial trying to connect like telnet does, but with ssh and port 22.
I try to update it by using libssh 0.10.5 (the latest), but I got surprising issues.
terminal_libssh_trace.log
Terminal.cpp.log

Context

The source code is in Terminal.cpp.log (remove .log, you got the cpp)

Expected Behavior

Should works like the 0.8.0 version.

It outputs that:
Host: xxx
Login: xxx
Password: xxx
Session...
Connecting...
Password Autentication...
Channel...
Opening...
Info libssh version "0.7.90/gnutls/zlib"
Info SSH 2
Info OpenSSH version 0x00080000
Info Server banner"SSH-2.0-OpenSSH_8.0"
Info Banner "(null)"
Info Key exchange algo. "curve25519-sha256"
Info Cipher in "aes256-ctr"
Info Cipher out "aes256-ctr"
Info HMAC in "hmac-sha2-256"
Info HMAC out "hmac-sha2-256"

xxx

Last login: Wed Nov 22 11:40:04 2023 from xxx
%

got the login !

Actual Behavior

ssh_connect() returns -1

Host: xxx
Login: xxx
Password: xxx
Session...
Connecting...
Error: Failed to verify server hostkey signature
Press a key...

Steps to Reproduce

  1. linux server with a sshd (like redhat 8)
  2. include the libssh.lib in the properties manager of the Visual Studio 2022
  3. compile the Terminal.cpp as a console project with Visual Studio 2022
  4. launch it in debug, and input the server name, login and password.

Your Environment

  • Version Used: libssh.lib x86 from libssh_libssh-0.10.5_msvc17.zip
  • Operating System and Version: Windows 10
  • Compiler and Version(s): Visual Studio 2022

Possible Fix

The logs show something around the known_hosts file, that it doesn't care in the 0.8.0 version.

A working tutorial, or a workaround is welcome.
Thanks.
.

ssh_pki_import_pubkey_blob: Unknown key type found

I am using the libssh and Visual C++ 2015 to create a SSH client ( x64) . I can compiled the code without error. But when I run it on a Windows server 2019 and tried to connect to a SSH server. It prompt Unknown key type found error.

Context

  1. ssh.dll ( x64) is copied to the same folder as executable.
  2. Visual c++ 2015 runtime distribution is installed on the Windows server 2019

Expected Behavior

It should establish the connection to the SSH server

Actual Behavior

D:\Temp>testssh.exe
start the program
[2020/08/10 18:58:19.335610, 2] ssh_connect: libssh 0.9.3 (c) 2003-2019 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_winlock
[2020/08/10 18:58:19.351540, 2] ssh_socket_connect: Nonblocking connection socket: 476
[2020/08/10 18:58:19.355521, 2] ssh_connect: Socket connecting, now waiting for the callbacks to work
[2020/08/10 18:58:19.360498, 1] socket_callback_connected: Socket connection callback: 1 (0)
[2020/08/10 18:58:19.365477, 2] ssh_client_connection_callback: SSH server banner: SSH-2.0-Mocana SSH
[2020/08/10 18:58:19.369458, 2] ssh_analyze_banner: Analyzing banner: SSH-2.0-Mocana SSH
[2020/08/10 18:58:19.395347, 1] ssh_known_hosts_read_entries: Failed to open the known_hosts file '/etc/ssh/ssh_known_hosts': No such file or directory
[2020/08/10 18:58:19.401319, 2] ssh_kex_select_methods: Negotiated diffie-hellman-group-exchange-sha256,rsa-sha2-256,aes256-ctr,aes256-ctr,hmac-sha2-256,hmac-sha2-256,none,none,,
[2020/08/10 18:58:22.937087, 2] ssh_packet_client_dhgex_group: SSH_MSG_KEX_DH_GEX_GROUP received
[2020/08/10 18:58:29.313973, 2] ssh_packet_client_dhgex_reply: SSH_MSG_KEX_DH_GEX_REPLY received
[2020/08/10 18:58:29.317924, 1] ssh_pki_import_pubkey_blob: Unknown key type found!
Error connecting to 10.148.118.220:

Steps to Reproduce

  1. Setup the directories for include and lib in VC++ 2015 project properties

  2. Compiled the source code in VC++ 2015

  3. The begining of source code
    // Open session and set options
    my_ssh_session = ssh_new();
    if (my_ssh_session == NULL)
    exit(-1);
    ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "10.148.118.220");
    ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
    ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, "admin");
    // Connect to server
    rc = ssh_connect(my_ssh_session);
    if (rc != SSH_OK)
    {
    fprintf(stderr, "Error connecting to 10.148.118.220: %s\n", ssh_get_error(my_ssh_session));
    ssh_free(my_ssh_session);
    exit(-1);
    }

  4. It failed at rc = ssh_connect(my_ssh_session);

Your Environment

  • Version Used:libssh 0.9.3
  • Operating System and Version: Windwos server 2019
  • Compiler and Version(s):Visual C++ 2015

Possible Fix

Built application does not embed dll

Hello and thanks for your project.

I tried to add you static .lib file to another Visual Studio project and building it succeeds. However the resulting executable still needs the ssh.dll in order to work.

Can you tell me how I can built an application with one static executable which contains the needed ssh.dll?

some way to tell if the file is a symbolic link with ssh_scp_request_get_permissions or another function

some way to tell if the file is a symbolic link with ssh_scp_request_get_permissions or another function?

I'm currently using this libssh in an open source project I'm developing, a linux server backup system, which runs on windows with Flutter, I made a dart ffi binding with this lib and it works fine. but I end up copying everything with the scp function even the files and folders with symbolic link, I wanted to ignore the files with symbolic link, for that I needed a function to return the permission string that has the first character that defines if it is directory, file or symbolic link.

This permission lrwxrwxrwx => is a symbolic link as it starts with the letter 'L'

var scp = ssh_scp_new(
        session, SSH_SCP_READ | SSH_SCP_RECURSIVE, remoteDirectoryPath);
    if (scp == nullptr) {
      throw Exception(
          'Error allocating scp directory session: ${ssh_get_error(session.cast()).cast<Utf8>().toDartString()}');
    }
    var rc = ssh_scp_init(scp);
    if (rc != SSH_OK) {
      ssh_scp_free(scp);
      throw Exception(
          "Error initializing scp directory session: ${ssh_get_error(session.cast()).cast<Utf8>().toDartString()}");
    }
 do {
      rc = ssh_scp_pull_request(scp);
      if (exitLoop) {
        break;
      }
     switch (rc) {
        case ssh_scp_request_types.SSH_SCP_REQUEST_NEWFILE:
             var rawFilename = ssh_scp_request_get_filename(scp);
            //some way to tell if the file is a symbolic
             break;
         case SSH_ERROR:
        ...
        }
 }
.......
    } while (true);

https://github.com/insinfo/fsbackup

"Couldn't apply options" on a minimal test case console app

Running a console application with libssh doesn't ssh_connect, rather returns "Couldn't apply options" - which isn't very informative.

Context

I tried to run the following code:

int main()
{
  ssh_session my_ssh_session = ssh_new();
  if (my_ssh_session == NULL)
    return -1;

  int verbosity = SSH_LOG_PROTOCOL;
  int port = 22;

  int rc = ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "192.168.15.1");
  rc = ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
  rc = ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);

  rc = ssh_connect(my_ssh_session);
  if (rc != SSH_OK)
  {
    fprintf(stderr, "Error connecting to localhost: %s\n",
      ssh_get_error(my_ssh_session));
    exit(-1);
  }

  ssh_free(my_ssh_session);

  return 0;
}

But it returns "Couldn't apply options" error to ssh_connect(), all the ssh_options_set work (return a value of 0)

Expected Behavior

Connect to the SSH server

Actual Behavior

Returns an error

Steps to Reproduce

  1. Take the above code
  2. Compile it as a Console Application, x86, Multibyte (I also tried Unicode)
  3. Run

Your Environment

  • Version Used: 0.8.7
  • Operating System and Version: Windows 10 RS5 (1903)
  • Compiler and Version(s): Visual Studio 2015

Possible Fix

:Shrug:

ssh_get_user_home_dir(), ssh_get_local_username() and ssh_getpass() return NULL

ssh_get_user_home_dir(), ssh_get_local_username() and ssh_getpass() return NULL no matter what WINAPI_FAMILY is defined as, but shouldn't.

For instance, when WINAPI_FAMILY is defined as WINAPI_FAMILY_DESKTOP_APP the code should be valid and not return NULL.

Context

ssh_get_user_home_dir(), ssh_get_local_username() and ssh_getpass() return NULL no matter what WINAPI_FAMILY is defined as, but shouldn't.

For instance, when WINAPI_FAMILY is defined as WINAPI_FAMILY_DESKTOP_APP the code should be valid and not return NULL.

Expected Behavior

When WINAPI_FAMILY is defined as WINAPI_FAMILY_DESKTOP_APP the code should be valid and return valid values.

Actual Behavior

The code returns NULL.

Steps to Reproduce

Run the code and it fails to start as a Windows desktop program.

Your Environment

  • Version Used:
  • Operating System and Version: Windows 10
  • Compiler and Version(s): Visual Studio 2015

Possible Fix

The code should probably read:

#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)

instead of

#if defined(WINAPI_FAMILY) || (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.