# Looking for an example of how to do ssh connect and some commands to embedded device

**URL:** <https://swi-prolog.discourse.group/t/looking-for-an-example-of-how-to-do-ssh-connect-and-some-commands-to-embedded-device/1998>\
**Category:** General\
**Created:** [March 11, 2020, 2:15pm UTC](https://swi-prolog.discourse.group/t/looking-for-an-example-of-how-to-do-ssh-connect-and-some-commands-to-embedded-device/1998 "2020-03-11T14:15:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joeuser](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@joeuser](https://swi-prolog.discourse.group/u/joeuser)\
**Post date:** [March 11, 2020, 2:15pm UTC](https://swi-prolog.discourse.group/t/looking-for-an-example-of-how-to-do-ssh-connect-and-some-commands-to-embedded-device/1998/1 "2020-03-11T14:15:38Z")

</div>

I am looking for an example of how to do _ssh_ connect and some commands to embedded device (totally unrelated to swipl as such).

In Python we have [paramiko](http://www.paramiko.org/) is there a similar library for swipl ?

Also would like to have [pexpect](https://pexpect.readthedocs.io/en/stable/) like library… Purpose would be to control embedded devices with ssh/telnet connections from a swipl script.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 11, 2020, 2:37pm UTC](https://swi-prolog.discourse.group/t/looking-for-an-example-of-how-to-do-ssh-connect-and-some-commands-to-embedded-device/1998/2 "2020-03-11T14:37:44Z")

</div>

> [@joeuser](#):
>
> is there a similar library for swipl

See [libssh pack](https://www.swi-prolog.org/pack/list?p=libssh). It currently only does the server side though. The client side is most likely simpler to do. Maybe an exercise 🙂 ? Seems you are looking for the client side? You can of course use library(process) and connect stdin and stdout from an `ssh` process.

I don’t think there is a ready to run pexpect alternative. Shouldn’t be very hard to write something like that in directly in Prolog and using DCGs it might even look pretty and be scalable.
