0%

Mac OS使用过程中遇到的问题

记录使用mac时遇到的问题。

查看端口占用

1
2
3
4
5
netstat -an -p tcp
# 要等很久- -
sudo lsof -i -P | grep -i "LISTEN"

sudo netstat -an|grep "LISTEN"

homebrew

用brew安装的软件记录

  • rustscan
  • Feroxbuster
  • gobuster
  • Freerdp
  • Hydra
  • upic(brew install –cask upic)
  • p7zip
  • curl
  • wget
  • Foremost(CTF分离隐藏图片用)
  • pngcheck(CTF用)
  • exiftool(CTF用)
  • ip2routemac(ip a)
  • tmux
  • aria2c
  • Swaks
  • gnupg
  • Awscli

打开终端时出现compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_cask

问题

打开终端时有时候会出现

1
2
3
Last login: Fri Mar 19 18:44:46 on ttys004
compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_cask
compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_cask
修复方法
1
brew clenup

或者

手动修复这两个符号文件的链接地址。

来源:compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew #9602

brew update无法更新

错误提示

1
2
3
4
brew update
Error: Fetching /usr/local/Homebrew failed!
homebrew/homebrew-core does not exist! Run `brew untap homebrew/homebrew-core` to remove it.
homebrew/homebrew-cask does not exist! Run `brew untap homebrew/homebrew-cask` to remove it.

其实这里是两个问题了,我这里原本是打算一个个慢慢解决。

1
brew untap homebrew/homebrew-cask

如果先前没有使用cask安装过软件的话,应该可以正常运行,如果安装过了则要先brew rm掉才行,执行untap之后。

1
brew reinstall cask

再update,只剩下core的错误提示了

1
homebrew/homebrew-core does not exist! Run `brew untap homebrew/homebrew-core` to remove it.

但是,untap core是不允许的。

1
Error: Untapping homebrew/core is not allowed

所以这时候我的想法是,破罐子破摔,干脆卸载重新安装brew算了。(((代价极大,我这大部分软件都得重新安装了,不建议直接卸载brew。)))

当我执行安装脚本的时候,也同样出现了 brew update faild失败的问题,这个坎是绕不过去了。。但是我看到错误提示是访问homebrew-core的git库失败。根据brew网站给出的安装文档,可以指定homebrew-core和homebrew的目录环境变量来加速安装,于是

1
2
gcl https://github.com/Homebrew/homebrew-core
export HOMEBREW_CORE_GIT_REMOTE=/tmp/homebrew-core

再次update,正常了。

1
2
brew update
Already up-to-date.

参考

metasploit

msfupdate

某次用msfupdate升级后出现以下错误

问题详情: expected file /opt/metasploit-framework/embedded/framework/lib/rex/time.rb to define constant Rex::Time, but didn’t (Zeitwerk::NameError) #14796

我的修复方法

1
2
msfremove
brew install metasploit-framework

1
2
3
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
chmod 755 msfinstall && \
./msfinstall

Msf db init 失败

1
No local database connected, meaning some Metasploit features will not be available. A full list of the affected features & database setup instructions can be found here: https://github.com/rapid7/metasploit-framework/wiki/msfdb:-Database-Features-&-How-to-Set-up-a-Database-for-Metasploit
1
2
msfdb reinit
输入用户名,密码。

msf打开提示office365userenum模块加载失败

1
2
3
[!] The following modules could not be loaded!..|
[!] /opt/metasploit-framework/embedded/framework/modules/auxiliary/gather/office365userenum.py
[!] Please see /Users/atsud0/.msf4/logs/framework.log for details.

可以看到这是一个python文件。

手动查看office365userenum.py文件,发现文件头用的是python2

image-20210514123815531

手动执行提示缺库

1
2
python2 /opt/metasploit-framework/embedded/framework/modules/auxiliary/gather/office365userenum.py
Missing Dependency! python-requests required!

解决:(具体见系统,我是把python3设置成了默认所以要指定一个pip2)

1
sudo pip2 install python-requests

mactex

安装mactex后还是出现pdflatex not found.

重启终端。

1
2
$ which pdflatex
/Library/TeX/texbin/pdflatex