I-bob. Axborot kommunikatsiya tizimlarida axborotning himoyalanganligini baholash usul va vositalari tahlili 8



Download 1,39 Mb.
bet24/24
Sana13.07.2022
Hajmi1,39 Mb.
#784573
1   ...   16   17   18   19   20   21   22   23   24
Bog'liq
Axborot xavfsiligini baholash

ILOVA


Dastur kodlari
Server kodi
//---------------------------------------------------------------------------

#include


#pragma hdrstop
#include "Unit1.h"
#include
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Chiqish1Click(TObject *Sender)


{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TreeView1Click(TObject *Sender)
{
Notebook1->PageIndex = TreeView1->Selected->Index;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::SpeedButton1Click(TObject *Sender)


{
ServerSocket1->Active = True;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ServerSocket1Listen(TObject *Sender,
TCustomWinSocket *Socket)
{
Memo1->Lines->Add("Server ishga tushdi!!!");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton2Click(TObject *Sender)
{
ServerSocket1->Active = false;
Memo1->Lines->Add("Server ishi to`xtatildi!!!");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ServerSocket1ClientConnect(TObject *Sender,
TCustomWinSocket *Socket)
{
Memo1->Lines->Add("Yangi kompyuter ulandi. \n IP = " + Socket->RemoteAddress);
ListView1->Items->BeginUpdate();
TListItem* item = ListView1->Items->Add();
item->ImageIndex = 0;
item->Caption = Socket->RemoteAddress;
ListView1->Items->EndUpdate();
sendList(Socket);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ServerSocket1ClientDisconnect(TObject *Sender,
TCustomWinSocket *Socket)
{
Memo1->Lines->Add("Kompyuter uzildi: IP = " + Socket->RemoteAddress);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ServerSocket1ClientError(TObject *Sender,
TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode)
{
ErrorCode = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ServerSocket1ClientRead(TObject *Sender,
TCustomWinSocket *Socket)
{
Memo1->Lines->Add(Socket->RemoteAddress + ": " + Socket->ReceiveText());
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton3Click(TObject *Sender)
{
AnsiString text = Edit1->Text;
if(text != "")
{
ListBox1->Items->Add(text);
Edit1->Text = "";
sendList(NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton4Click(TObject *Sender)
{
if( ListBox1->ItemIndex > -1 )
{
//int selected = ListBox1->ItemIndex;
ListBox1->DeleteSelected() ;
sendList(NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton5Click(TObject *Sender)
{
if( ListBox1->ItemIndex > -1 )
{
int selected = ListBox1->ItemIndex;
AnsiString text = ListBox1->Items->Strings[selected];
ListBox1->DeleteSelected() ;
Edit1->Text = text;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
char file_name[] = "denied.txt";
std::ifstream file;
file.open(file_name);
if(file)
{
file.close();
ListBox1->Items->LoadFromFile(file_name);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
char file_name[] = "denied.txt";
ListBox1->Items->SaveToFile(file_name);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::sendList(TCustomWinSocket *Socket)
{
//TODO: Add your source code here
AnsiString send = "#";
int cnt = ListBox1->Count;
send += IntToStr(cnt) + "#";
for(int i = 0 ; i < cnt; i ++)
{
send += ListBox1->Items->Strings[i] + "#";
}
if(Socket)
Socket->SendText(send);
else
{
int cnt = ServerSocket1->Socket->ActiveConnections;
for(int i = 0 ; i < cnt; i ++)
{
ServerSocket1->Socket->Connections[i]->SendText(send);
}
}
Agent kodi
#include
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::SpeedButton1Click(TObject *Sender)


{
ClientSocket1->Port = Edit2->Text.ToIntDef(8888);
ClientSocket1->Address = Edit1->Text;
ClientSocket1->Active = !ClientSocket1->Active;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ClientSocket1Connect(TObject *Sender,
TCustomWinSocket *Socket)
{
StatusBar1->Panels->Items[0]->Text = "Ulandi!";
StatusBar1->Panels->Items[1]->Text = "IP = " + Socket->RemoteAddress;
Memo1->Lines->Add("Serverga ulandi!");
Timer1->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ClientSocket1Read(TObject *Sender,
TCustomWinSocket *Socket)
{
AnsiString recv = Socket->ReceiveText();
ListBox1->Items->Clear();
recv.Delete(1, 1);
int cnt = recv.SubString(1, recv.Pos("#") - 1).ToIntDef(0);
recv.Delete(1, recv.Pos("#") - 1);
for(int i = 0 ; i < cnt; i ++)
{
recv.Delete(1, recv.Pos("#"));
ListBox1->Items->Add(recv.SubString(1, recv.Pos("#") - 1));

}


}
//---------------------------------------------------------------------------
void __fastcall TForm1::ClientSocket1Disconnect(TObject *Sender,
TCustomWinSocket *Socket)
{
StatusBar1->Panels->Items[0]->Text = "Uzildi!";
StatusBar1->Panels->Items[1]->Text = "IP = " + Socket->RemoteAddress;
Memo1->Lines->Add("Serverdan uzildi!");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{

TList *List = new TList;


HWND h = Handle;
char buf[128];
List->Clear();
do {
h = GetNextWindow(h, GW_HWNDNEXT);
GetWindowText(h, buf, 128);
AnsiString procces = AnsiString(buf);
if("PotPlayer" == "PotPlayer") Memo1->Lines->Add(Now());
if(ListBox1->Items->IndexOf(procces) > -1) {
ClientSocket1->Socket->SendText("Mijoz qoidani buzdi!!!");
List->Add(h);
DWORD PID;
GetWindowThreadProcessId(h, &PID);
DWORD ExitCode;
HANDLE hp;
bool ret = true;
if(PID)
{
hp = OpenProcess(PROCESS_ALL_ACCESS, true, PID);
if (hp)
{
GetExitCodeProcess(hp, &ExitCode);
ret = TerminateProcess(hp, ExitCode);
CloseHandle(hp);
}
}
}
else
{
}
} while (h != NULL);
}
//---------------------------------------------------------------------------
Netlogo dastur kodlari
turtles-own
[
infected? ;; if true, the turtle is infectious
resistant? ;; if true, the turtle can't be infected
virus-check-timer ;; number of ticks since this turtle's last virus-check]
to setup
clear-all
setup-nodes
setup-spatially-clustered-network
ask n-of dastlabki-zararlar-soni turtles
[ become-infected ]
ask links [ set color white ]
reset-ticks
end
to setup-nodes
set-default-shape turtles "circle"
create-turtles tugunlar-soni
[; for visual reasons, we don't put any nodes *too* close to the edges
setxy (random-xcor * 0.95) (random-ycor * 0.95)
become-susceptible
set virus-check-timer random virusni-tekshirish-chastotasi ]
end
to setup-spatially-clustered-network
let num-links (ortacha-qirralar-soni * tugunlar-soni) / 2
while [count links < num-links ]
[
ask one-of turtles
[
let choice (min-one-of (other turtles with [not link-neighbor? myself])
[distance myself])
if choice != nobody [ create-link-with choice ]
]
]
; make the network look a little prettier
repeat 10
[
layout-spring turtles links 0.3 (world-width / (sqrt tugunlar-soni)) 1
]
end
to go
if all? turtles [not infected?]
[ stop ]
ask turtles
[ set virus-check-timer virus-check-timer + 1
if virus-check-timer >= virusni-tekshirish-chastotasi
[ set virus-check-timer 0 ]
] spread-virus
do-virus-checks
tick
end
to become-infected ;; turtle procedure
set infected? true
set resistant? false
set color red
end
to become-susceptible ;; turtle procedure
set infected? false
set resistant? false
set color blue
end
to become-resistant ;; turtle procedure
set infected? false
set resistant? true
set color gray
ask my-links [ set color gray - 2 ]
end
to spread-virus
ask turtles with [infected?]
[ ask link-neighbors with [not resistant?]
[ if random-float 100 < virus-tarqalish-imkoniyati
[ become-infected ] ] ]
end
to do-virus-checks
ask turtles with [infected? and virus-check-timer = 0]
[
if random 100 < tiklash-imkoniyati
[
ifelse random 100 < chidamlilik-imkoniyati
[ become-resistant ]
[ become-susceptible ]
]
]
end


Download 1,39 Mb.

Do'stlaringiz bilan baham:
1   ...   16   17   18   19   20   21   22   23   24




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish