In the process of Global Positioning System (GPS) modernization, M-code signals with better immunity to interference have been proposed and used in place of P(Y) signals as new authorization signals. A typical positioning, navigation, and timing (PNT) service is based on the local interrelation operation between the reference signal and the received signal. To obtain a PNT, the receiver should generate replicas of the pseudorandom code for acquisition and tracking. However, due to the use of an encryption algorithm, the receiver cannot use the M-code signal under noncooperative conditions. This paper presents an algorithm for estimating M-code sequences without prior knowledge. This algorithm adopts a waveform matching technique and a time domain filtering method to extract M-code from the in-phase channel and quadrature channel of the GPS L1 band. A high-gain antenna is used to receive GPS signals to keep the signal from being drowned out by noise. The experimental results show the feasibility of the method. Therefore, it is helpful for studying and evaluating the performance achieved without prior knowledge of the GPS signals.