Last active
December 14, 2015 15:09
-
-
Save DeaR/5105751 to your computer and use it in GitHub Desktop.
NYAOSでUACを何とかしてみた
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if nyaos.create_object then | |
local major, minor, build = nyaos.eval(os.getenv('COMSPEC') .. ' /c ver'):match('(%d+).(%d+).(%d+)') | |
if tonumber(major) >= 6 then | |
function nyaos.command.sudo(...) | |
local t = os.tmpname() | |
t = os.getenv('TEMP') .. '/' .. table.concat({string.byte(t, 1, t:len())}) | |
nyaos.create_object('Shell.Application'):ShellExecute(nyaos.argv[0], '-e \034' .. table.concat({...}, ' ') .. ' > ' .. t .. ' ; echo \\nyaos_sudo_end\\ >> ' .. t .. '\034', nyaos.eval('pwd'), 'runas', 0) | |
local e | |
while e ~= '\\nyaos_sudo_end\\' do | |
f = io.open(t, 'r') | |
if f then | |
e = f:read('*a'):match('\\nyaos_sudo_end\\') | |
io.close(f) | |
end | |
end | |
for l in io.lines(t) do | |
if not l:match('\\nyaos_sudo_end\\') then | |
print(l) | |
end | |
end | |
os.remove(t) | |
end | |
end | |
end | |
-- 当然だが別ウィンドウで動くんで根本解決にはなっていない |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment