Coherent optical control within or through scattering media via wavefront shaping has seen broad applications since its invention around 2007. Wavefront shaping is aimed at overcoming the strong scattering, featured by random interference, namely speckle patterns. This randomness occurs due to the refractive index inhomogeneity in complex media like biological tissue or the modal dispersion in multimode fiber, yet this randomness is actually deterministic and potentially can be time reversal or precompensated. Various wavefront shaping approaches, such as optical phase conjugation, iterative optimization, and transmission matrix measurement, have been developed to generate tight and intense optical delivery or high-resolution image of an optical object behind or within a scattering medium. The performance of these modulations, however, is far from satisfaction. Most recently, artificial intelligence has brought new inspirations to this field, providing exciting hopes to tackle the challenges by mapping the input and output optical patterns and building a neuron network that inherently links them. In this paper, we survey the developments to date on this topic and briefly discuss our views on how to harness machine learning (deep learning in particular) for further advancements in the field.