-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathssh
More file actions
executable file
·29 lines (27 loc) · 738 Bytes
/
ssh
File metadata and controls
executable file
·29 lines (27 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/ruby
fifo = `a=$(mktemp); rm $a; mkfifo $a; echo $a`.chomp
p fifo
fork {
cmd = ""
logging = false
File.open("data.txt", "a") { |f|
f.sync = true
File.open(fifo, "r").each { |line|
if (m = line.match(/^([^ ]+) read\((.).*"(.*)".* ([0-9]+)$/))
if m[2] == "4" && m[4].length == 1
if m[3] == "\\r"
logging = true if cmd.match(/#START/)
logging = false if cmd.match(/#STOP/)
cmd = ""
else
cmd += m[3]
end
f.write "#{m[1]} KEY '#{m[3]}'\n" if logging
elsif m[2] == "3"
f.write "#{m[1]} DATA #{m[4]}\n" if logging
end
end
}
}
}
exec("strace","-ttt","-o",fifo,"--","ssh",*ARGV)