void collectData(string& content) { content.append(Html::h2("Operating System")); content.append(Html::table_open()); content.append(Html::tr(Html::td2("Operating system information"))); content.append(Html::tr(Html::td("Machine name") + Html::td(computerName()))); content.append(Html::tr(Html::td("Full name") + Html::td(osName()))); content.append(Html::tr(Html::td("Root directory") + Html::td(osRootDir()))); content.append(Html::tr(Html::td("Language") + Html::td(OsLanguage()))); content.append(Html::tr(Html::td("Locale") + Html::td(getLocale()))); content.append(Html::tr(Html::td("Is OS Virtualized?") + Html::td(""))); content.append(Html::tr(Html::td("Is 3GB switch enabled?") + Html::td(""))); content.append(Html::tr(Html::td("Data Execution Prevention") + Html::td(DepInfo()))); content.append(Html::tr(Html::td("User Account Control") + Html::td(UAC()))); content.append(Html::tr(Html::td("Is user Admin?") + Html::td(Html::boolToYesNo(IsUserAdmin())))); content.append(Html::tr(Html::td("Is user connected remotely?") + Html::td(""))); content.append(Html::tr(Html::td("Is Windows firewall enabled?") + Html::td(WindowsFirewall()))); content.append(Html::tr(Html::td("Is secondary logon enabled?") + Html::td(""))); content.append(Html::tr(Html::td2("Environment information"))); content.append(Html::tr(Html::td("System environment variables") + Html::td(get_os_env_vars()))); content.append(Html::tr(Html::td("User environment variables") + Html::td(UserEnvVars()))); content.append(Html::tr(Html::td("Kerberos configuration") + Html::td(""))); content.append(Html::tr(Html::td("Layered Service Providers") + Html::td(""))); content.append(Html::tr(Html::td("AppInit_DLLs registry value") + Html::td(get_AppInit_DLLs()))); content.append(Html::tr(Html::td("LoadAppInit_DLLs registry value") + Html::td(get_LoadAppInit_DLLs()))); content.append(Html::table_close); }
void HttpRequestHandler::processRequest() { HttpRequest httpRequest(m_dataInput); httpRequest.readHeader(); StringStorage request; request.fromAnsiString(httpRequest.getRequest()); if (!httpRequest.parseHeader()) { Log::warning(_T("invalid http request from %s"), m_peerHost.getString()); return ; } request.replaceChar(_T('\n'), _T(' ')); request.replaceChar(_T('\t'), _T(' ')); Log::message(_T("\"%s\" from %s"), request.getString(), m_peerHost.getString()); HttpReply reply(m_dataOutput); bool pageFound = false; if (strcmp(httpRequest.getFilename(), "/") == 0) { CharString paramsString("\n"); bool isAppletArgsValid = true; bool paramsInUrlIsEnabled = Configurator::getInstance()->getServerConfig()->isAppletParamInUrlEnabled(); if (httpRequest.hasArguments() && paramsInUrlIsEnabled) { ArgList *args = httpRequest.getArguments(); for (size_t i = 0; i < args->getCount(); i++) { const char *key = args->getKey(i); AppletParameter parameter(key, args->getValue(key)); if (!parameter.isValid()) { isAppletArgsValid = false; break; } paramsString.format("%s%s", paramsString.getString(), parameter.getFormattedString()); } } reply.send200(); if (!isAppletArgsValid) { m_dataOutput->writeFully(HTTP_MSG_BADPARAMS, strlen(HTTP_MSG_BADPARAMS)); } else { CharString page; StringStorage computerName(_T("TightVNC Server")); Environment::getComputerName(&computerName); size_t computerNameANSILength = computerName.getLength() + 1; char *computerNameANSI = new char[computerNameANSILength]; computerName.toAnsiString(computerNameANSI, computerNameANSILength); page.format(HTTP_INDEX_PAGE_FORMAT, computerNameANSI, Configurator::getInstance()->getServerConfig()->getRfbPort(), paramsString.getString()); delete[] computerNameANSI; m_dataOutput->writeFully(page.getString(), page.getLength()); } pageFound = true; } else if ((strcmp(httpRequest.getFilename(), "/VncViewer.jar") == 0)) { reply.send200(); m_dataOutput->writeFully(VNC_VIEWER_JAR_BODY, sizeof(VNC_VIEWER_JAR_BODY)); pageFound = true; } if (!pageFound) { reply.send404(); } }