sshexec

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2018 License: BSD-2-Clause Imports: 7 Imported by: 0

README

Proof of Concept (PoC) ssh-client

SSH Client to access network equipment and run cmd's

PoC Target:

Creating a program to access brocade / extreme network (NetIron OS) devices via ssh "Password Auth" and run a command like "sh run" or "sh arp". Record the output into a logfile.

Extending the program to run this commands on many devices in parallel.

The program must run under Windows and should run under linux.

Usage

The program flags are based on plink (putts) flags. Use -h do see flags or look into the source.

The program can remotely excute commands just like plink can do right now.

Reasoning

  1. This program will be part of a toolchain (closed source) which uses go to get information of netdevices and create some meaningful output lists.

  2. I could have used plink but I want to have direct control over the connection. See also Reason 3

  3. If you connect to a device via ssh and give a command to execute, then SSH_MSG_CHANNEL_REQUEST (CHREQ) is set to "exec" and the command is sent over and gets executed. In contrast to that if you have to command specified the CHREQ will be set to "shell" and the users shell and users enviroment gets executed. (Open questions is about TTY / PTY and PTS ) This is the default behavior and so plink works like this too.

The NetIron accepts as sole command "scp -t" or "scp -f" after CHREQ "exec". So you cannot just call the cmd. You have to create an interactive shell and then talk to it.

Current Problem to be solved

  • The prog is able to connect to vyos and NetIron systems via "exec"(only vyos), "shell" and "pty-req,shell" (shell-pty). And is able to execute commands on vyos.
  • With shell-pty the envoriment and vyos is working as expected. So Mode shell-pty will be the default mode.
  • Without user environment yu have to call the shell vbash in interactive mode (vbash -i) to access vyos specified commands.
  • NetIron can't use "exec" at all and respons only with prompt in "shell" and "shell-pty" mode. The commands are not execute.
  • NetIron needs to receive a "\n" first and at least 200 ms delay to be ready to receive the cmds.

###Problem Solved

Input Readings

Basics
Examples
Source I started with
More Source

TODO

Next Steps
  • Currently the ssh.Stdoutpipe doesn't wait for "EOF" so you don't get the hole output. This will be fixed.
Next to look at

Documentation

Overview

Proof of Conncept

Proof of Conncept

Proof of Conncept

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL