st::asio::ip::tcp::socket&, boost::asio::ip::tcp::endpoint&)’: util/Destination.cpp:49:25: error: ‘boost::asio::ip::tcp::socket’ {aka ‘class boost::asio::basic_stream_socket<boost::asio::ip::tcp>’} has no member named ‘native’ ?
参考boost::asio::ip::tcp 'native' method replaced with 'native_handle' #3这个网站的做法,将native替换成native_handle 即可。
certificate/Certificate.hpp: In member function ‘void Certificate::parseCommonName(X509*)’: certificate/Certificate.hpp:95:39: error: invalid use of incomplete type ‘X509’ {aka ‘struct x509_st’} ? ? ?std::string distinguishedName(cert->altname); ?
参考Fix build with OpenSSL 1.1 #28改成如下形式即可
std::string distinguishedName(X509_NAME_oneline(X509_get_subject_name(cert), NULL, 0));
SessionCache.cpp:50:45: error: invalid use of incomplete type ‘SSL_SESSION’ {aka ‘struct ssl_session_st’} ? ?return setNewSessionId(s, session, session->session_id, session->session_id_length); 同样参考上面第二个的链接的修改方式。
/usr/bin/ld: AuthorityCertificateManager.o: undefined reference to symbol 'EVP_PKEY_new@@OPENSSL_1_1_0' /usr/bin/ld: //lib/x86_64-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [Makefile:401:sslsniff] 错误 1
在Makefile.am中的sslsniff_LDFLAGS中添加-lcrypto
即
sslsniff_LDFLAGS = -lssl -lboost_filesystem -lpthread -lboost_thread -llog4cpp -lcrypto
然后执行如下命令即可:
?autoconf
automake -a ?aclocal ?./configure
make
目的是重新生成make文件
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libboost_filesystem.so: undefined reference to symbol '_ZN5boost6system15system_categoryEv' /usr/bin/ld: //lib/x86_64-linux-gnu/libboost_system.so.1.67.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [Makefile:401:sslsniff] 错误 1 同理在Makefile.am中的sslsniff_LDFLAGS中添加-lcrypto
即
sslsniff_LDFLAGS = -lssl -lboost_filesystem -lpthread -lboost_thread -llog4cpp -lcrypto -lboost_system ?
运行时错误:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >' ? what(): ?resolve: Host not found (authoritative)
参考下面的操作即可解决此问题
Fix wildcard certificate detection #16
如果还是不行,则gdb调试运行,
例如:
(gdb) r -t -c /home/jack/code/ca_test/ -m /home/jack/code/ca_test/server.crt -w /home/jack/ssl.log -s 444
Starting program: /home/jack/code/sslsniff-master/sslsniff -t -c /home/jack/code/ca_test/ -m /home/jack/code/ca_test/server.crt -w /home/jack/ssl.log -s 444
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Enter PEM pass phrase:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
what(): resolve: Host not found (authoritative)
Program received signal SIGABRT, Aborted.
0x00007ffff6361438 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 0x00007ffff6361438 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007ffff636303a in __GI_abort () at abort.c:89
#2 0x00007ffff699b84d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff69996b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff6999701 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff6999919 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x0000000000419c52 in boost::throw_exception<boost::system::system_error> (e=...) at /usr/include/boost/throw_exception.hpp:69
#7 0x0000000000419d6e in boost::asio::detail::do_throw_error (err=..., location=location@entry=0x441b65 "resolve") at /usr/include/boost/asio/detail/impl/throw_error.ipp:38
#8 0x000000000042bde2 in boost::asio::detail::throw_error (location=0x441b65 "resolve", err=...) at /usr/include/boost/asio/detail/throw_error.hpp:42
#9 boost::asio::ip::basic_resolver<boost::asio::ip::tcp, boost::asio::ip::resolver_service<boost::asio::ip::tcp> >::resolve (q=..., this=0x7fffffffded0) at /usr/include/boost/asio/ip/basic_resolver.hpp:103
#10 Util::resolveName (name="aus2.mozilla.org", results=...) at certificate/../util/Util.hpp:84
#11 0x0000000000434ae6 in UpdateManager::initialize (this=0x6641e0, updatePath="", addonPath="", addonHash="") at UpdateManager.cpp:45
#12 0x000000000040d5c1 in main (argc=10, argv=<optimized out>) at sslsniff.cpp:135
分析可知,"aus2.mozilla.org"这个域名不能解析到。
所以,对应到代码为:
#define UPDATE_ADDRESS "aus2.mozilla.org"
#define ADDONS_ADDRESS "versioncheck.addons.mozilla.org"
void UpdateManager::initialize(std::string &updatePath, std::string &addonPath, std::string &addonHash) {
this->updatePath = updatePath;
this->addonPath = addonPath;
this->addonHash = addonHash;
std::string updateUrl(UPDATE_ADDRESS);
std::string addonsUrl(ADDONS_ADDRESS);
Util::resolveName(updateUrl, updateAddresses);
Util::resolveName(addonsUrl, addonsAddresses);
}
在初始的时候,会如下代码:
int main(int argc, char* argv[]) {
......
UpdateManager::getInstance()->initialize(options.updateLocation, options.addonLocation, options.addonHash);
......
return 1;
}
将对应行注释掉,重新编译即可。
terminate called after throwing an instance of 'BadCertificateException' ? what(): ?Could not parse certificate.
参考下面的操作即可解决此问题
terminate called after throwing an instance of 'BadCertificateException' #11
如果出现以下错误:
SSLConnectionManager.o: In function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o: In function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o:/usr/include/boost/asio/error.hpp:230: more undefined references to `boost::system::system_category()' follow
SSLConnectionManager.o: In function `boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf3<void, SSLConnectionManager, boost::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>, bool>, boost::_bi::list4<boost::_bi::value<SSLConnectionManager*>, boost::_bi::value<boost::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >, boost::_bi::value<boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> >, boost::_bi::value<bool> > > >::~thread_data()':
/usr/include/boost/thread/detail/thread.hpp:90: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/usr/include/boost/thread/detail/thread.hpp:90: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/usr/include/boost/thread/detail/thread.hpp:90: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
SSLConnectionManager.o: In function `boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf3<void, SSLConnectionManager, boost::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>, bool>, boost::_bi::list4<boost::_bi::value<SSLConnectionManager*>, boost::_bi::value<boost::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >, boost::_bi::value<boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> >, boost::_bi::value<bool> > > >::~thread_data()':
/usr/include/boost/thread/detail/thread.hpp:90: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/usr/include/boost/thread/detail/thread.hpp:90: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
SSLConnectionManager.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o: In function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o:/usr/include/boost/system/error_code.hpp:322: more undefined references to `boost::system::system_category()' follow
SSLConnectionManager.o: In function `boost::thread::~thread()':
/usr/include/boost/thread/detail/thread.hpp:254: undefined reference to `boost::thread::detach()'
SSLConnectionManager.o: In function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o: In function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o:/usr/include/boost/system/error_code.hpp:322: more undefined references to `boost::system::system_category()' follow
SSLConnectionManager.o: In function `boost::detail::thread_data_base::thread_data_base()':
/usr/include/boost/thread/pthread/thread_data.hpp:152: undefined reference to `vtable for boost::detail::thread_data_base'
SSLConnectionManager.o: In function `boost::thread::start_thread()':
/usr/include/boost/thread/detail/thread.hpp:179: undefined reference to `boost::thread::start_thread_noexcept()'
SSLConnectionManager.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o:/usr/include/boost/asio/error.hpp:230: more undefined references to `boost::system::system_category()' follow
SSLConnectionManager.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
SSLConnectionManager.o:(.rodata._ZTIN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf3Iv20SSLConnectionManagerNS_10shared_ptrINS_4asio19basic_stream_socketINS8_2ip3tcpENS8_21stream_socket_serviceISB_EEEEEENSA_14basic_endpointISB_EEbEENS2_5list4INS2_5valueIPS6_EENSK_ISF_EENSK_ISH_EENSK_IbEEEEEEEE[_ZTIN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf3Iv20SSLConnectionManagerNS_10shared_ptrINS_4asio19basic_stream_socketINS8_2ip3tcpENS8_21stream_socket_serviceISB_EEEEEENSA_14basic_endpointISB_EEbEENS2_5list4INS2_5valueIPS6_EENSK_ISF_EENSK_ISH_EENSK_IbEEEEEEEE]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
Destination.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
Destination.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
FirefoxUpdater.o: In function `FirefoxUpdater::readMetaUpdateRequest()':
/home/jack/code/sslsniff-master/FirefoxUpdater.cpp:95: undefined reference to `SSL_read'
FirefoxUpdater.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)':
/usr/include/boost/filesystem/operations.hpp:571: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
FirefoxUpdater.o: In function `FirefoxUpdater::sendMetaUpdateResponse()':
/home/jack/code/sslsniff-master/FirefoxUpdater.cpp:79: undefined reference to `SSL_write'
/home/jack/code/sslsniff-master/FirefoxUpdater.cpp:82: undefined reference to `SSL_write'
/home/jack/code/sslsniff-master/FirefoxUpdater.cpp:88: undefined reference to `SSL_write'
FirefoxUpdater.o: In function `FirefoxUpdater::close()':
/home/jack/code/sslsniff-master/FirefoxUpdater.cpp:109: undefined reference to `SSL_free'
FirefoxUpdater.o: In function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
FirefoxUpdater.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
/usr/include/boost/asio/error.hpp:230: undefined reference to `boost::system::system_category()'
FirefoxUpdater.o: In function `boost::system::error_code::error_code()':
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
FirefoxUpdater.o: In function `boost::asio::error::get_system_category()':
则参考这个链接undefined reference to boost::system::system_category() when compilingjj
即I replaced?sslsniff_LDFLAGS ?with?sslsniff_LDADD ?in Makefile.am and that did NOT work. Then I kept both?sslsniff_LDFLAGS ?and added?sslsniff_LDADD = -lboost_system -lssl -lboost_filesystem -lpthread -lboost_thread -llog4cpp . Then I was able to compile. Thank you for the help!
Makefile.am:
AM_CXXFLAGS = -ggdb
bin_PROGRAMS = sslsniff
sslsniff_SOURCES = Bridge.hpp SSLConnectionManager.cpp FingerprintManager.hpp FirefoxAddonUpdater.hpp FirefoxUpdater.hpp HTTPSBridge.hpp Logger.hpp RawBridge.hpp SessionCache.hpp SSLBridge.hpp SSLConnectionManager.hpp sslsniff.hpp UpdateManager.hpp certificate/AuthorityCertificateManager.hpp certificate/Certificate.hpp certificate/CertificateManager.hpp certificate/TargetedCertificateManager.hpp http/HttpBridge.hpp http/HttpConnectionManager.hpp http/HttpHeaders.hpp http/OCSPDenier.hpp util/Destination.cpp util/Destination.hpp util/Util.hpp FirefoxUpdater.cpp Logger.cpp SessionCache.cpp SSLBridge.cpp HTTPSBridge.cpp sslsniff.cpp FingerprintManager.cpp certificate/AuthorityCertificateManager.cpp certificate/TargetedCertificateManager.cpp certificate/CertificateManager.cpp http/HttpBridge.cpp http/HttpConnectionManager.cpp http/HttpHeaders.cpp UpdateManager.cpp http/OCSPDenier.cpp FirefoxAddonUpdater.cpp
sslsniff_LDFLAGS = -lssl -lboost_filesystem -lpthread -lboost_thread -llog4cpp -lboost_system -lcrypto
sslsniff_LDADD = -lboost_system -lssl -lboost_filesystem -lpthread -lboost_thread -llog4cpp -lcrypto
EXTRA_DIST = certs/wildcard IPSCACLASEA1.crt leafcert.pem updates/Darwin_Universal-gcc3.xml updates/Linux_x86-gcc3.xml updates/WINNT_x86-msvc.xml
|