[技术]metasploit-framework安装后报告HOME environment variable 解决方法
在Windows上安装好metasploit-framework后,当启动的时候却出现主要错误,如下:
HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory (RuntimeError)
中文翻译
必须设置HOME环境变量(或HOMEDRIVE和HOMEPATH)并指向目录(RuntimeError)
详细错误如下:
C:\metasploit-framework\bin>msfconsole.bat Traceback (most recent call last): 20: from C:/metasploit-framework/bin/../embedded/framework/msfconsole:49:in `<main>' 19: from C:/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in `start' 18: from C:/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:48:in `start' 17: from C:/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:62:in `driver' 16: from C:/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:62:in `new' 15: from C:/metasploit-framework/embedded/framework/lib/msf/ui/console/driver.rb:74:in `initialize' 14: from C:/metasploit-framework/embedded/framework/lib/msf/ui/console/driver.rb:632:in `choose_readline' 13: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require' 12: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in `load_dependency' 11: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `block in require' 10: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in `require_with_backports' 9: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in `require' 8: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/rb-readline-0.5.5/lib/readline.rb:8:in `<top (required)>' 7: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/rb-readline-0.5.5/lib/readline.rb:10:in `<module:Readline>' 6: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require' 5: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in `load_dependency' 4: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `block in require' 3: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in `require_with_backports' 2: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in `require' 1: from C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/rb-readline-0.5.5/lib/rbreadline.rb:17:in `<top (required)>' C:/metasploit-framework/embedded/lib/ruby/gems/2.5.0/gems/rb-readline-0.5.5/lib/rbreadline.rb:1097:in `<module:RbReadline>': HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory (RuntimeError)
解决方法
从报错可以清楚的得到这样一个原因:我们没有正确设置HOME环境变量(HOMEDRIVE和HOMEPATH)并指向目录。
Windows可以在cmd命令窗口用“set HOME”查看是否设置正确?正确的效果如下:
C:\Users\fujie>set HOME HOMEDRIVE=C: HOMEPATH=\Users\刘大硕
原因1:是因为“HOMEPATH=\Users\刘大硕”,后面是中文,因为ruby不支持中文路径导致的问题。我
如何正确设置自己的HOME、HOEMDRIVE以及HOMEPATH呢?只需要在cmd命令窗口输入以下命令:
SETX HOMEDRIVE %SYSTEMDRIVE% - m SETX HOMEPATH \Users\%username% - m SET HOME=%SYSTEMDRIVE%\Users\%USERNAME% SETX HOME "%HOME%" SET TEMP=%HOME%\Local Settings\Temp SETX TEMP "%TEMP%" SETX TMP "%TEMP%"
注释:环境变量与对应的路径
环境变量与对应的路径 %ALLUSERSPROFILE% C:\ProgramData %APPDATA% C:\Users\用户名\AppData\Roaming %COMMONPROGRAMFILES% C:\Program Files\Common Files %COMMONPROGRAMFILES(x86)% C:\Program Files (x86)\Common Files %COMSPEC% C:\Windows\System32\cmd.exe %HOMEDRIVE%和%SystemDrive% C:\ %HOMEPATH% C:\Users\用户名 %LOCALAPPDATA% C:\Users\用户名\AppData\Local %PROGRAMDATA% C:\ProgramData %PROGRAMFILES% C:\Program Files %PROGRAMFILES(X86)% C:\Program Files (x86) %PUBLIC% C:\UsersPublic %SystemRoot% C:\Windows %TEMP%和%TMP% C:\Users\用户名\AppData\LocalTemp %USERPROFILE% C:\Users用户名 %WINDIR% C:\Window
Win10怎么将中文登录用户文件夹名改为英文名
刚安装了win10系统,在注册微软账号的时候,填写了中文姓名,而Win10在联网安装或升级安装的时候,微软会默认用户使用的微软的账户进行登录Windows,当用户使用的微软账号登录,则Win10就会以这个中文名建立用户的文件夹。那么问题来了,少数软件安装或使用过程中,路径不支持中文,无法使用,如Java类。需要将用户文件夹名改为英文。那么Win10怎么将中文登录用户文件夹名改为英文名?
1、首先你需要确保系统中Administrator账户是否已启用,如果没有,先启用Administrator;如果已启用,skip... 2、在当前用户:Windows键+X→关机或注销→注销。 3、切换到Administrator用户登录 4、登录后,点击此电脑,进入“文件资源管理器”(或者win+E) 5、进入C盘用户,可看到中文用户的文件夹名,打开进入检查是不是中文用户名用的资料。 6、确认是后,选中右键→重命名(或F2),将中文名改为英文名 7、Windows键+R打开运行,输入regedit,点击确定打开Windows注册表管理器。 8、依次展开HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Profilelist,在Profilelist下的文件夹对应系统中用户,而文件夹中ProfileImagePath值是指向每个用户文件夹的地址,一个个点击查看,找到中文名用户的对应所在的ProfileImagePath值。 9、修改ProfileImagePath的值,将地址改为修改成英文的文件夹名。与C盘的文件夹名一致。 10、再次注销,完成登录用户文件夹名更改。
原因2:如果你发现你在cmd窗口下用了“set home"命令,设置也是正确的话,那么,请查看你是否是以管理员身份登陆的?可以用命令“net user" 和 “net user 用户名“来具体看详情。
Win10系统会以“WDAGUtilityAccount账户”登陆的,根本不是“Administrator管理员”身份。切换至Administrator账户即可。