"Reality is merely an illusion, albeit a very persistent one."
~ Albert Einstein
FakeNOS created to simulate Network Operating Systems interactions.
Install GIT, next install from master:
python3 -m pip install git+https://github.com/dmulyalin/fakenos
This code starts two devices listening for SSH connections on 127.0.0.1 address
ports 6001 and 6002 named router1
and router2
respectively:
from fakenos import FakeNOS
network = FakeNOS()
Initiate SSH connection using default username user
and password user
:
ssh 127.0.0.1 -l user -p 6001
Files that need to updated are:
1) Add the code for your vendor to fakenos/plugins/nos/your_plugin.py
2) Add the import in fakenos/plugins/nos/__init__.py
3) Update nos_plugins
dictionary in fakenos/plugins/nos/__init__.py
from fakenos import FakeNOS
network = FakeNOS(
hosts = {
"router1": {"nos": "cisco_ios", "port": 6002},
"nid1": {"nos": "accedian", "port": 6003},
}
)
By default FakeNOS uses SSH private key embedded with the package, making that key publicly available, which is insecure. Instead, FakeNos can use locally generated SSH key.
Linux
Use the command ssh-keygen -A
in terminal to generate all of your SSH keys. Once the command is run,
you can find the RSA key in the following location: ~/.ssh/id_rsa
a.k.a. /home/username/.ssh/id_rsa
.
Supply above path as ssh_key_file
argument to FakeNOS server configuration.
Alternatively can use ckeygen -t rsa -f ssh-keys/ssh_host_rsa_key
command to generate private key.
Windows 10
Press Windows Key, type Manage Optional Features
. If OpenSSH Client & Server is in the list, you're all set.
If either is not, click on "Add a feature" and search for OpenSSH
, click on them to install.
Next, open cmd as administrator. Enter the command ssh-keygen
and follow the on screen prompts.
The location of the key will be displayed. Supply displayed path as ssh_key_file
argument to FakeNOS
server configuration. If you put a password, include it as the ssh_key_file_password
parameter.
- sshim - library for testing and debugging SSH automation clients
- PythonSSHServerTutorial - tutorial on creating paramiko based SSH server
- fake-switches - pluggable switch/router command-line simulator
- ncs-netsim - tool to simulate a network of devices
- cisshgo - concurrent SSH server to emulate network equipment for testing purposes