How to find nearest neighbors in SMOTE
You need to compute the Euclidean distance between each point and sort theses distances.

That said, you can find an implementation in the imbalanced-learn toolbox. More precisely, you can see the different steps of the implementation that you mentioned: (i) fit a KNN, (ii) find the NN of each sample, (iii) generate a new samples.