Resting state electromagnetic recordings have been analyzed in epilepsy patients aiding presurgical evaluation. However, it has been rarely explored how pathological networks can be separated and thus used for epileptogenic focus localization purpose. We proposed here a resting state EEG/MEG analysis framework, to disentangle brain functional networks represented by electrophysiological oscillations. Firstly, by using an Embedded Hidden Markov Model (EHMM), we constructed a state space for resting state recordings consisting of brain states with different spatiotemporal patterns. After that, functional connectivity analysis along with graph theory were applied on the extracted brain states to quantify the network features of the extracted brain states, and we determine the source location of pathological states based on these features. The EHMM model was rigorously evaluated using computer simulations. Our simulation results revealed the proposed framework can extract brain states with high accuracy regarding both spatial and temporal profiles. We than validated the entire framework as compared with clinical ground truth in 10 patients with drug-resistant focal epilepsy who underwent MEG recordings. We segmented the resting state MEG recordings into a few brain states with diverse connectivity patterns and extracted pathological brain states by applying graph theory on the constructed functional networks. We showed reasonable localization results using the extracted pathological brain states in 6/10 patients, as compared to the invasive clinical findings. The framework can serve as an objective tool in extracting brain functional networks from noninvasive resting state electromagnetic recordings. It promises to aid presurgical evaluation guiding intracranial EEG electrodes implantation.