天天看點

修改nw.js的exe檔案使其請求管理者權限

修改nw.js的exe檔案使其請求管理者權限

預設情況下,nw.js釋出的nw.exe檔案請求的是普通權限,當我們的應用需要通路一些特殊目錄或者系統資料庫等,就需要程式啟動的時候以管理者權限運作。那麼此時如何去修改nw.exe,使其啟動的時候請求admin權限呢? 首先我們找一款使用nw.js開發的軟體,這裡我推薦AxeSlide,首先去下載下傳軟體,安裝。

如果我們軟體安裝之後,使用的是非Administrator使用者登入的話,啟動軟體的時候,就會彈出UAC提升框,提醒我們該軟體請求以管理者身份運作,是否同意。那麼AxeSlide是如何做到的呢?

找一款PE檔案資源修改工具,這裡我使用的是一款名為resedit的小工具,這類工具很多,大家可以搜尋中文版的工具,用起來更順手一些。使用resedit打開axe.exe。 找到Manifest檔案

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="Intel.Software.node-webkit" type="win32">
</assemblyIdentity>
<description>node-webkit</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application><supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS><supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS><supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS><supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS><supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS></application></compatibility></assembly>
           

從上面的配置中找到security節。

<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
           

這裡requestedExecutionLevel就是配置的請求Administrator權限。 修改之後儲存就可以了。

nw.js,electron交流群 313717550。

作者:玄魂

出處:http://www.cnblogs.com/xuanhun/

原文連結:http://www.cnblogs.com/xuanhun/

更多内容,請通路我的個人站點 對程式設計,安全感興趣的,加qq群:hacking-1群:303242737,hacking-2群:147098303,nw.js,electron交流群 313717550。

本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接配接,否則保留追究法律責任的權利。

關注我:

繼續閱讀