Bump Lighty build to Argon
[transportpce.git] / debug_tools / netconf_TCP_SSH_hijackingproxy.pl
index 4efab85ae32ae9ab1aa61567c7fb2ebe89241307..e4799d66c30f68a916e739f67dbe1e9aa94ecf0a 100755 (executable)
@@ -7,7 +7,7 @@
 # and is available at http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
 #
 # and is available at http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
 #
-# debian dependecies: apt-get install libnet-openssh-perl libio-pty-perl
+# debian dependencies: apt-get install libnet-openssh-perl libio-pty-perl
 #
 
 use strict;
 #
 
 use strict;
@@ -37,10 +37,10 @@ Netconf SSH to TCP proxy to debug netconf exchanges.
 It listens to connections in clear TCP to the given port. When a TCP connection demand is received,
 it establishes a netconf SSH encrypted connection to the host in argument. Netconf rpcs and replies
 are then proxified between both ends.
 It listens to connections in clear TCP to the given port. When a TCP connection demand is received,
 it establishes a netconf SSH encrypted connection to the host in argument. Netconf rpcs and replies
 are then proxified between both ends.
-By default, exchanges are altered according to the rules specified inside this script and easily 
+By default, exchanges are altered according to the rules specified inside this script and easily
 modifiable. This behaviour can be disabled with the '-s' option.
 For more convenience, the server hello handshake can also alternatively be replaced by the content
 modifiable. This behaviour can be disabled with the '-s' option.
 For more convenience, the server hello handshake can also alternatively be replaced by the content
-of an external file rather instead of writing specific rules.
+of an external file instead of writing specific rules.
 
 OPTIONS :
 
 
 OPTIONS :
 
@@ -93,10 +93,10 @@ if ((!defined ($simpleproxy))&&(defined ($capabilities))) {
 # you can adapt it to your needs, some examples have been commented.
 my %regex_hash=(
 # replace oo-device v1.2 by v1.2.1
 # you can adapt it to your needs, some examples have been commented.
 my %regex_hash=(
 # replace oo-device v1.2 by v1.2.1
-#      'module=org-openroadm-device&amp;revision=2016-10-14.*<\/capability>'=>'s/&amp;revision=2016-10-14/&amp;revision=2017-02-06/',
+#   'module=org-openroadm-device&amp;revision=2016-10-14.*<\/capability>'=>'s/&amp;revision=2016-10-14/&amp;revision=2017-02-06/',
 #   '<schema><identifier>org-openroadm-device<\/identifier><version>2016-10-14'=>'s@<schema><identifier>org-openroadm-device</identifier><version>2016-10-14@<schema><identifier>org-openroadm-device</identifier><version>2017-02-06@',
 # remove all deviations found
 #   '<schema><identifier>org-openroadm-device<\/identifier><version>2016-10-14'=>'s@<schema><identifier>org-openroadm-device</identifier><version>2016-10-14@<schema><identifier>org-openroadm-device</identifier><version>2017-02-06@',
 # remove all deviations found
-#      '&amp;deviations=.*<\/capability>'=>'s@&amp;deviations=.*</capability>@</capability>@',
+#   '&amp;deviations=.*<\/capability>'=>'s@&amp;deviations=.*</capability>@</capability>@',
 # add the ietf-netconf capability to the hello handshake - without it, ODL netconf mountpoints can not work
 #    '<\/capabilities>'=>'s@</capabilities>@\n<capability>urn:ietf:params:xml:ns:yang:ietf-netconf?module=ietf-netconf&amp;revision=2011-06-01</capability>\n</capabilities>@',
 # add the right notifications capabilities to the hello handshake + provide another solution for the ietf-netconf capability
 # add the ietf-netconf capability to the hello handshake - without it, ODL netconf mountpoints can not work
 #    '<\/capabilities>'=>'s@</capabilities>@\n<capability>urn:ietf:params:xml:ns:yang:ietf-netconf?module=ietf-netconf&amp;revision=2011-06-01</capability>\n</capabilities>@',
 # add the right notifications capabilities to the hello handshake + provide another solution for the ietf-netconf capability
@@ -146,7 +146,7 @@ if (!$kidpid) {
 
     # copy the socket to standard output
     my $buf;
 
     # copy the socket to standard output
     my $buf;
-    
+
     if (defined ($hello_message)) {
         #retrieve the server hello but do not relay it
         while (my $nread = sysread($ssh_subsocket,$buf,400)) {
     if (defined ($hello_message)) {
         #retrieve the server hello but do not relay it
         while (my $nread = sysread($ssh_subsocket,$buf,400)) {
@@ -171,9 +171,9 @@ if (!$kidpid) {
         print $client $buf;
         $ssh_subsocket->flush();
         if (defined($verbose))  { print STDOUT  $buf; }
         print $client $buf;
         $ssh_subsocket->flush();
         if (defined($verbose))  { print STDOUT  $buf; }
-               
+
     };
     };
+
     kill("TERM", $kidpid);              # send SIGTERM to child
 }
 # the else{} block runs only in the child process (client input relayed to the server)
     kill("TERM", $kidpid);              # send SIGTERM to child
 }
 # the else{} block runs only in the child process (client input relayed to the server)