#!/bin/bash
#
#清理邮箱的钥匙串
while :; do
sudo security find-generic-password -l Exchange
if [ $? = 0 ];then
sudo security delete-generic-password -l Exchange
else
break;
fi
done
#清理AAA-LLMST AAA-LLMYB 等网络的钥匙串,它们是 钥匙串里面的登录,不是本地项目,也不是系统
strings=("AAA-LLMST" "AAA-LLMYB" "AAA-KKST" "AAA-KKYB" "AAA-LLST" "AAA-LLYB" "AAA-VVPC" "AAA-WWice")
for string in "${strings[@]}"
do
sudo security find-generic-password -l "$string"
if [ $? = 0 ];then
# 在这里可以执行对每个字符串的操作
sudo security delete-generic-password -l "$string"
fi
done
#清空已记住的网络
enX=$(sudo /usr/sbin/networksetup -listallhardwareports | sudo /usr/bin/awk '/Wi-Fi|AirPort/ {getline; print $NF}')
sudo networksetup -listpreferredwirelessnetworks $enX | grep -iv "Preferred networks" | xargs -I {} sudo networksetup -removepreferredwirelessnetwork $enX {}
#清理公共共享盘的钥匙串,它们是 钥匙串里面的登录,不是本地项目,也不是系统
strings=( "192.168.18.10" "192.168.17.12" "192.168.18.4" "192.168.12.2" "192.168.12.3" "192.168.7.2" "192.168.7.3" "192.168.2.13" "192.168.2.17" "192.168.2.6" )
for string in "${strings[@]}"
do
sudo security find-internet-password -l "$string"
if [ $? = 0 ];then
# 在这里可以执行对每个字符串的操作
sudo security delete-internet-password -l "$string"
fi
done