모든 네트워크 인터페이스의 MAC 주소 추출 @마크다운 #모든 네트워크 인터페이스의 MAC 주소 추출 리눅스 커널에서 제공하는 /sys 디렉토리를 통해 값을 편하게 얻어올 수 있다. ```DIR* nics = opendir("/sys/class/net");struct dirent* nic = NULL;char buf[20];while((nic = readdir(nics))) { if(nic->d_name[0] == '.' || strstr(nic->d_name, "lo")) continue; char path[PATH_MAX]; snprintf(path, sizeof(path), "/sys/class/net/%s/address", nic->d_name); int sysfile = open(path, 0); if(sysfile == -1) conti.. 더보기 이전 1 2 3 4 5 6 7 8 ··· 285 다음