Giter Club home page Giter Club logo

doublepipe's Introduction

doublepipe

A terminal utility that allows to pipe remote session output to local resources.
This code based on: http://rachid.koucha.free.fr/tech_corner/pty_pdip.html - examples for psuedo terminals.

Compile with:  gcc -o dp dp.c 

Example:

 $./dp /bin/bash
 ssh myuser@router1
 Password: ********
 ROUTER1>sh tacacs||grep -i server
 Tacacs+ Server -  public  :
            Server address: 192.168.0.99
               Server port: 49
Tacacs+ Server -  public  :
            Server address: 192.168.0.100
               Server port: 49

        
ROUTER1>exit
$exit

How does this work?

The program spawns a psuedo terminal and parses the input sent from the user looking for a "double pipe". If a double pipe is encountered the program splits the command at the double pipe and only sends the first command while saving the second command in a buffer. When the output of the first command is returned from the remote session, the program opens a local pipe to send the returned output to the previously saved buffer command.

In the example above the command "show tacacs||grep -i server", the parser splits the input into two parts:

array[0] = "show tacacs"
array[1] = "grep -i server"

The first command "show tacacs" is sent to the far end and the output of that command is piped locally to "grep -i server".

This code is BETA release currently and needs to implement password hiding as well as more testing.

Tested on Ubuntu, Windows WSL Ubuntu 16.4, Windows 10/Cygwin64, Redhat 7.x, Linux Mint.

Need to work on the following:

  • Psuedo terminal shows password.
  • The terminal needs to interpret escape and control sequences.
  • The program currently writes to local files to pass data from the parent process to the child. Need to implement shared memory.
  • The parser needs its own object IE: typedef struct parser { .... }
  • Checks for failure to open files.
  • research as this could be re-developed using a legitimate terminal library versus the pseudo terminal since the PIPE code can be ported easily.

doublepipe's People

Contributors

elahtrebor avatar

Watchers

 avatar

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.