Meterpreter source code is part of the metasploit-payloads repository, hosted at
https://github.com/rapid7/metasploit-payloads