From 59b40280428ea7d26cd1e13629fd236e35376315 Mon Sep 17 00:00:00 2001 From: bpmcdevitt Date: Thu, 6 Aug 2020 18:36:02 -0500 Subject: [PATCH] make strace parser use slop for command line options --- strace_parser/strace_parser.rb | 6 ------ strace_parser/stracer.rb | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100755 strace_parser/stracer.rb diff --git a/strace_parser/strace_parser.rb b/strace_parser/strace_parser.rb index 0ad6ef6..26d6780 100755 --- a/strace_parser/strace_parser.rb +++ b/strace_parser/strace_parser.rb @@ -29,9 +29,3 @@ class StraceParser def write_sys_calls end end - -# to test - why is my dbb-app segfaulting on my manjaro linux install? -# something to do with qt5 but lets see if we can write a better tool to help -filepath = './strace.out' -parser = StraceParser.new(filepath) -binding.pry diff --git a/strace_parser/stracer.rb b/strace_parser/stracer.rb new file mode 100755 index 0000000..8f87b95 --- /dev/null +++ b/strace_parser/stracer.rb @@ -0,0 +1,24 @@ +require './strace_parser.rb' +require 'slop' + +opts = Slop.parse do |o| + o.string '-f', '--file', 'a filename to read' + o.bool '-c', '--count', 'enable count of systemcall output' + #puts Slop::VERSION + #exit + end + +ARGV #=> --filename /path/to/strace_file.out + +hash = opts.to_hash #=> { host: "192.168.0.1", login: "alice", port: 80, verbose: true, quiet: false, check_ssl_certificate: true } + +file = hash[:file] +count = hash[:count] + +parser = StraceParser.new(file) + +#binding.pry + +if count + puts parser.sys_call_counts +end