(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tid) op: assign_op.Equal rhs: {(DQ <'dynamic forwarding'>)} spids: [7] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FWDPORT) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<expr>} {($ Id.VSub_DollarName '$PORT')} {<Id.Lit_Other '+'>} {<1>}) ) } spids: [13] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<have_prog>} {<nc>}) (command.Pipeline children: [ (command.Simple words: [{<nc>} {<-h>}] redirects: [ (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) (command.Simple words: [{<grep>} {(DQ <'proxy address'>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) ] negated: F ) ] ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:proxycmd) op: assign_op.Equal rhs: {(DQ <'nc -x 127.0.0.1:'> ($ Id.VSub_DollarName '$FWDPORT') <' -X'>)} spids: [57] ) ] ) ] spids: [27 54] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<have_prog>} {<connect>}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:proxycmd) op: assign_op.Equal rhs: {(DQ <'connect -S 127.0.0.1:'> ($ Id.VSub_DollarName '$FWDPORT') <' -'>)} spids: [74] ) ] ) ] spids: [64 71] ) ] else_action: [ (C {<echo>} {(DQ <'skipped (no suitable ProxyCommand found)'>)}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] ) (C {<trace>} {(DQ <'will use ProxyCommand '> ($ Id.VSub_DollarName '$proxycmd'))}) (C {<start_sshd>}) (command.ForEach iter_name: p iter_words: [{(${ Id.VSub_Name SSH_PROTOCOLS)}] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:n) op: assign_op.Equal rhs: {<0>} spids: [122] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:error) op: assign_op.Equal rhs: {(DQ <1>)} spids: [126] ) ] ) (C {<trace>} {(DQ <'start dynamic forwarding, fork to background'>)}) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$error'))} {<-ne>} {<0>} {<-a>} {(DQ ($ Id.VSub_DollarName '$n'))} {<-lt>} {<3>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:n) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<expr>} {($ Id.VSub_DollarName '$n')} {<Id.Lit_Other '+'>} {<1>}) ) } spids: [167] ) ] ) (C {(${ Id.VSub_Name SSH)} {<-> ($ Id.VSub_DollarName '$p')} {<-F>} {($ Id.VSub_DollarName '$OBJ') <'/ssh_config'>} {<-f>} {<-D>} {($ Id.VSub_DollarName '$FWDPORT')} {<-q>} {<-oExitOnForwardFailure> <Id.Lit_Equals '='> <yes>} {<somehost>} {<exec>} {<sh>} {<-c>} {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (DQ <'echo '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ) <' > '> ($ Id.VSub_DollarName '$OBJ') <'/remote_pid; exec sleep 444'> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:error) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [229] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$error'))} {<-ne>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<trace>} { (DQ <'forward failed proto '> ($ Id.VSub_DollarName '$p') <' attempt '> ($ Id.VSub_DollarName '$n') <' err '> ($ Id.VSub_DollarName '$error') ) } ) (C {<sleep>} {($ Id.VSub_DollarName '$n')}) ] spids: [233 248] ) ] ) ] ) ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$error'))} {<-ne>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<fatal>} {(DQ <'failed to start dynamic forwarding proto '> ($ Id.VSub_DollarName '$p'))} ) ] spids: [274 289] ) ] ) (command.ForEach iter_name: s iter_words: [{<4>} {<5>}] do_arg_iter: F body: (command.DoGroup children: [ (command.ForEach iter_name: h iter_words: [{<127.0.0.1>} {<localhost>}] do_arg_iter: F body: (command.DoGroup children: [ (C {<trace>} { (DQ <'testing ssh protocol '> ($ Id.VSub_DollarName '$p') <' socks version '> ($ Id.VSub_DollarName '$s') <' host '> ($ Id.VSub_DollarName '$h') ) } ) (command.Simple words: [ {(${ Id.VSub_Name SSH)} {<-F>} {($ Id.VSub_DollarName '$OBJ') <'/ssh_config'>} {<-o>} { (DQ <'ProxyCommand '> (${ Id.VSub_Name proxycmd) (${ Id.VSub_Name s) <' '> ($ Id.VSub_DollarName '$h') <' '> ($ Id.VSub_DollarName '$PORT') ) } {<somehost>} {<cat>} {($ Id.VSub_DollarName '$DATA')} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$OBJ') <'/ls.copy'>} ) ] do_fork: T ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<test>} {<-f>} {($ Id.VSub_DollarName '$OBJ') <'/ls.copy'>}) (C {<fail>} {(DQ <'failed copy '> ($ Id.VSub_DollarName '$DATA'))}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cmp>} {($ Id.VSub_DollarName '$DATA')} {($ Id.VSub_DollarName '$OBJ') <'/ls.copy'>} ) (C {<fail>} {(DQ <'corrupted copy of '> ($ Id.VSub_DollarName '$DATA'))}) ] ) ] ) ) ] ) ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-f>} {($ Id.VSub_DollarName '$OBJ') <'/remote_pid'>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:remote) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {($ Id.VSub_DollarName '$OBJ') <'/remote_pid'>}) ) } spids: [441] ) ] ) (C {<trace>} {(DQ <'terminate remote shell, pid '> ($ Id.VSub_DollarName '$remote'))} ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$remote')} {<-gt>} {<1>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<kill>} {<-HUP>} {($ Id.VSub_DollarName '$remote')})] spids: [460 473] ) ] ) ] spids: [426 438] ) ] else_action: [ (C {<fail>} {(DQ <'no pid file: '> ($ Id.VSub_DollarName '$OBJ') <'/remote_pid'>)}) ] ) ] ) ) ] )