Re: Executing command over forwarded port

2015-07-16 Thread Raghaw Shukla
In point C the new session should be from local PC to Remote PC?

On Wed, Jul 15, 2015 at 5:21 PM, Andreas Schneider a...@cryptomilk.org
wrote:

 On Wednesday 15 July 2015 16:12:26 Raghaw Shukla wrote:
  Hi,
 
  Can any body please tellme how to execute a command over a forwarded port
  .ie on Remote PC which is at other side of tunnel.Please provide some
  example.

 a) Create a session
 b) create a channel and forward a port
 c) create a new session
 d) connect to the forwared port

 --
 Andreas Schneider   GPG-ID: CC014E3D
 www.cryptomilk.orga...@cryptomilk.org





-- 
Raghaw Shukla
Software Engineer(AutoPilot Development Team)
Aurora Integrated Systems,Bangalore.
Email:raghaw.shu...@aurora-is.com
Mobile:9972580305


Re: Executing command over forwarded port

2015-07-16 Thread Raghaw Shukla
Thanks Andreas.But this iam implementing on Windows which does not
support socketpair().

On Thu, Jul 16, 2015 at 1:11 PM, Andreas Schneider a...@cryptomilk.org
wrote:

 On Thursday 16 July 2015 12:07:06 Raghaw Shukla wrote:
  In point C the new session should be from local PC to Remote PC?

 Here is a step by step description how I would implement it.

 a) Create a ssh session and connect
 b) Create a forward channel
 c) Create a socketpair()
 d) One end of the socketpair() is used to read data and write it to the
forward channel, and vice versa.
 e) Create a new ssh session
 f) Set the other fd of the socketpair() as the fd for the new session
 g) Connect and exec ...

 It should work just fine with a socketpair() but you can also create a tcp
 socket and connect to the port on localhost. I suggest you read the SSH
 RFC to
 understand port forwarding better and read the manpages about sockets and
 socketpair.

 --
 Andreas Schneider   GPG-ID: CC014E3D
 www.cryptomilk.orga...@cryptomilk.org





-- 
Raghaw Shukla
Software Engineer(AutoPilot Development Team)
Aurora Integrated Systems,Bangalore.
Email:raghaw.shu...@aurora-is.com
Mobile:9972580305


Re: Executing command over forwarded port

2015-07-16 Thread Andreas Schneider
On Thursday 16 July 2015 12:07:06 Raghaw Shukla wrote:
 In point C the new session should be from local PC to Remote PC?

Here is a step by step description how I would implement it.

a) Create a ssh session and connect
b) Create a forward channel
c) Create a socketpair()
d) One end of the socketpair() is used to read data and write it to the
   forward channel, and vice versa.
e) Create a new ssh session
f) Set the other fd of the socketpair() as the fd for the new session
g) Connect and exec ...

It should work just fine with a socketpair() but you can also create a tcp 
socket and connect to the port on localhost. I suggest you read the SSH RFC to 
understand port forwarding better and read the manpages about sockets and 
socketpair.

-- 
Andreas Schneider   GPG-ID: CC014E3D
www.cryptomilk.orga...@cryptomilk.org




Re: Executing command over forwarded port

2015-07-15 Thread Andreas Schneider
On Wednesday 15 July 2015 19:09:58 Raghaw Shukla wrote:
 And one more question how to connect to a forwarded port.

The same as you would connect to a normal port?!?

-- 
Andreas Schneider   GPG-ID: CC014E3D
www.cryptomilk.orga...@cryptomilk.org




Re: Executing command over forwarded port

2015-07-15 Thread Andreas Schneider
On Wednesday 15 July 2015 18:54:55 Raghaw Shukla wrote:
 Hi Andreas,
 
 How to read back what has been executed on shell over REmote.?

Take a look at the exec example included in the sources ...

-- 
Andreas Schneider   GPG-ID: CC014E3D
www.cryptomilk.orga...@cryptomilk.org




Re: Executing command over forwarded port

2015-07-15 Thread Andreas Schneider
On Wednesday 15 July 2015 16:12:26 Raghaw Shukla wrote:
 Hi,
 
 Can any body please tellme how to execute a command over a forwarded port
 .ie on Remote PC which is at other side of tunnel.Please provide some
 example.

a) Create a session
b) create a channel and forward a port
c) create a new session
d) connect to the forwared port

-- 
Andreas Schneider   GPG-ID: CC014E3D
www.cryptomilk.orga...@cryptomilk.org




Re: Executing command over forwarded port

2015-07-15 Thread Raghaw Shukla
Hi Andreas,

How to read back what has been executed on shell over REmote.?

On Wed, Jul 15, 2015 at 5:21 PM, Andreas Schneider a...@cryptomilk.org
wrote:

 On Wednesday 15 July 2015 16:12:26 Raghaw Shukla wrote:
  Hi,
 
  Can any body please tellme how to execute a command over a forwarded port
  .ie on Remote PC which is at other side of tunnel.Please provide some
  example.

 a) Create a session
 b) create a channel and forward a port
 c) create a new session
 d) connect to the forwared port

 --
 Andreas Schneider   GPG-ID: CC014E3D
 www.cryptomilk.orga...@cryptomilk.org





-- 
Raghaw Shukla
Software Engineer(AutoPilot Development Team)
Aurora Integrated Systems,Bangalore.
Email:raghaw.shu...@aurora-is.com
Mobile:9972580305


Re: Executing command over forwarded port

2015-07-15 Thread Raghaw Shukla
And one more question how to connect to a forwarded port.

On Wed, Jul 15, 2015 at 5:21 PM, Andreas Schneider a...@cryptomilk.org
wrote:

 On Wednesday 15 July 2015 16:12:26 Raghaw Shukla wrote:
  Hi,
 
  Can any body please tellme how to execute a command over a forwarded port
  .ie on Remote PC which is at other side of tunnel.Please provide some
  example.

 a) Create a session
 b) create a channel and forward a port
 c) create a new session
 d) connect to the forwared port

 --
 Andreas Schneider   GPG-ID: CC014E3D
 www.cryptomilk.orga...@cryptomilk.org





-- 
Raghaw Shukla
Software Engineer(AutoPilot Development Team)
Aurora Integrated Systems,Bangalore.
Email:raghaw.shu...@aurora-is.com
Mobile:9972580305