WifiUtils.cs 816 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace ShareWifi.Utils.Net
  7. {
  8. class WifiUtils
  9. {
  10. /// <summary>
  11. /// 获取WIFI SSID
  12. /// </summary>
  13. /// <returns></returns>
  14. public static string getSSID()
  15. {
  16. string v = Shell.RunCmd("netsh wlan show interfaces | findstr SSID");
  17. return v;
  18. }
  19. /// <summary>
  20. /// 根据SSID获取密码
  21. /// </summary>
  22. /// <param name="ssid">SSID</param>
  23. /// <returns></returns>
  24. public static string getSSDIPassword(string ssid)
  25. {
  26. string v = Shell.RunCmd("netsh wlan show profile name=" + ssid + " key=clear | findstr Key");
  27. return v;
  28. }
  29. }
  30. }