Comments (7)
Thank you!
I hope it will become popular, it's already popular with me :)
On Aug 5, 2014 7:11 AM, "Nicolas Couture" [email protected] wrote:
https://pypi.python.org/pypi/MockSSH/1.3
—
Reply to this email directly or view it on GitHub
#2 (comment).
from mockssh.
This is not really production quality software, there are no unit tests and it has mostly been a toy project for me to play around and tests different ways to emulate SSH and commands so far.
What would be the advantage of having it in pypi?
from mockssh.
Well, I think having a way to mock SSH is helpful in building software for devops, mostly collection of data using ssh. It could, of course be mocked bypassing SSH entirely, but having a way to do it fast and from the code has a lot of value. Look, for example, at what fabric had to go through:
fabric/fabric#185
fabric/fabric#275
The only other available approach is build custom servers using paramiko.
There is also a library which does similar stuff:
https://github.com/simon-engledew/sshim
But your API , IMHO, is much much better.
from mockssh.
Testing SSH seems to be a problem shared by the unit tests of a set of networking libraries.
Looking at the referenced fabric tickets (fabric/fabric#185 fabric/fabric#275) I am also in favor programmatically spawning and defining SSH servers and supported commands from the unit tests during their execution over suggested alternatives.
The related fabric tickets reveals a few features they had to implement in their solution:
- SSH key forwarding (ssh-agent/SSH_AUTH_SOCK related?)
- Using ssh_config configuration files
- Changing the default ssh password prompt
Are these features that would be needed in MockSSH as well?
The reason I am asking this is that I would still like to know more about your personal interest in this issue is before considering packaging something that has no unit tests.
Do you think it would be possible to implement good unit test coverage of MockSSH (sshim has unit tests)?
Currently MockSSH supports:
- SSHCommand (outputs text via SSH when typing command name)
- PasswordPromptingCommand
- ArgumentValidatingCommand
Before packaging MockSSH I would like to:
- Rename PasswordPromptingCommand to PromptingCommand and make it more liberal to provide least-specific functionality
- Remove SSHCommand from all and rename as _SSHCommand)
- Rename ArgumentValidatingCommand as SSHCommand (all commands can and should be validating arguments, and be considered "validly typed" if their arguments are expected to be none)
- Update examples/mock_cisco.py and examples/mock_F5.py
Where are fabric's current ssh unit tests so we can have a look at what their current solution looks like?
self ~ $ git clone http://github.com/fabric/fabric
Cloning into 'fabric'...
remote: Reusing existing pack: 15313, done.
remote: Total 15313 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (15313/15313), 7.03 MiB | 697.00 KiB/s, done.
Resolving deltas: 100% (8854/8854), done.
Checking connectivity... done.
self ~ $ grep -lir 'import ssh|from ssh|paramiko' fabric/
self ~ $
Thanks for pointing to https://github.com/simon-engledew/sshim, it's interesting to compare projects with common goals.
from mockssh.
Hi.
I'm not a contributor to fabric - so I'm not familiar with their codebase, but the mock ssh implementation is here:
cd fabric/tests
tests❯ grep -i SSH server.py fabric/git/master
from fabric.network import disconnect_all, ssh
class TestServer(ssh.ServerInterface):
Test server implementing the 'ssh' lib's server interface parent class.
Mostly just handles the bare minimum necessary to handle SSH-level things
``serve_responses`` function and its ``SSHHandler`` class.
return ssh.OPEN_SUCCEEDED
return ssh.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
return ssh.AUTH_SUCCESSFUL if passed else ssh.AUTH_FAILED
return ssh.AUTH_SUCCESSFUL if self.pubkeys else ssh.AUTH_FAILED
As to my personal interest - I require only the ability to fire up an instance, pass it to paramiko, and define output as per input. Personally, for me what you already have would suffice fully.
Hopefully, your project would be useful to more people though - I see someone from Rackspace starring it, so maybe they've looked for something similar.
from mockssh.
Created:
- Rename PasswordPromptingCommand to PromptingCommand #3
- Rename ArgumentValidatingCommand as SSHCommand #4
- Implement unit tests #5
It's Friday night and I'm using Emoji on github 😿
from mockssh.
https://pypi.python.org/pypi/MockSSH/1.3
from mockssh.
Related Issues (17)
- Rename PasswordPromptingCommand to PromptingCommand
- Rename ArgumentValidatingCommand as SSHCommand HOT 1
- Implement unit tests HOT 4
- Rename new functions HOT 1
- mocksshy and command validation HOT 2
- When importing MockSSH: ImportError: No module named conch HOT 1
- Add instructions to generate primes and keys (and where to store them) HOT 1
- add support for Diffie-Hellman prime groups as required by twisted.conch.ssh.factory
- Add public key authentication for clients HOT 1
- Add optionnal banner while authenticating HOT 4
- Python3 support HOT 1
- execCommand support HOT 15
- support commands with PIPE HOT 4
- Question: How to run server that does not require password? HOT 1
- Getting OSError: [Errno 9] Bad file descriptor in tests HOT 1
- Python3 continued HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockssh.