1 / 19

Computer Security Project Key Logger

Computer Security Project Key Logger. 2012/03/15. Project 1 : Windows Socket Programming Project 2 : Key Logger Project 3 : Key Logger and encrypted communication. Computer security. Project 1 : Windows Socket Programming. Requirement. You need to write a client side code

gamada
Download Presentation

Computer Security Project Key Logger

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Security Project Key Logger 2012/03/15

  2. Project 1 : Windows Socket Programming • Project 2 : Key Logger • Project 3 : Key Logger and encrypted communication

  3. Computer security Project 1 : Windows Socket Programming

  4. Requirement • You need to write a client side code • Your program must • Create two threads , one for read and one for write • Send your student ID to server(string format) • Receive response from server • Server ip: 140.113.216.151 port: 2000 • Check webpage to find your ID • Webpage will list all student IDs that already complete • http://bletchley.twbbs.org.tw/comsec/index.html

  5. Environment • OS: windows XP (Recommend) /Windows 7 • Language : C/C++ • IDE • Code Block (Recommend) • VS • Dev C++ • This project may modify OS , it’s recommend to write project in VM environment

  6. Work Flow Client creates a socket and connects to server Server accepts client connection Create two threads Write thread sends student ID Server receives student ID “9717001” Read thread receives and prints msg “congratulation!!” Server responses a msg to client

  7. Socketin Unix-like OS Server Client socket() socket() bind() listen() accept() connect() write() read() read() write() close() close()

  8. WinSock Server Client WSAStarup() WSAStarup() socket() socket() bind() listen() accept() connect() send() recv() recv() send() shutdown() shutdown() closesocket() closesocket() WSACleanup() WSACleanup()

  9. Initial winsock(1/2) • Links to the Winsock Library file Ws2_32.lib • Setting is different between each IDE • Code Block setting • http://bletchley.twbbs.org/wiki/index.php/CodeBlock_libws2_32_dll_link_config • The #pragma comment indicates to the linker that the Ws2_32.lib file is needed • #pragma comment(lib, "Ws2_32.lib") • Include • include <winsock2.h> • include <ws2tcpip.h>

  10. Initial winsock(2/2) • WSDATA • Information about the Windows Sockets implementation • WSAStartup() • Set version of winsock • Initiate the use of WS2_32.dll WSADATA wsaData; Result = WSAStartup(MAKEWORD(2,2), &wsaData);

  11. Create socket • getaddrinfo() • addrinfo is used to hold host address information • getaddrinfo() fill content of addrinfo • Use ip_address for client and null for server • socket() • Create socket for server/client structaddrinfo *result = NULL, *ptr = NULL, hints; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; getaddrinfo(ip_address, port, &hints, &result); ConnectSocket = socket(result->ai_family, result ->ai_socktype, result ->ai_protocol);

  12. Server Site • bind() • Associates a local address with a socket • listen() • Let server socket listens for any incoming connections • accept() • Start user connection bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen); listen( ListenSocket, SOMAXCONN ); ClientSocket = accept(ListenSocket, NULL, NULL);

  13. Client Site • connect() • Establishes a connection to server ConnectSocket = socket(result->ai_family, result ->ai_socktype, result ->ai_protocol); connect( ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen);

  14. Send/Receive Data • send() • sends data on a connected socket • recv() • receives data from a connected socket  send(CliSock,smsg,(int)strlen(smsg),0); recv(CliSock,rebuf,reclen,0);

  15. Clean Up Socket • shutdown() • Disables sends or receives on a socket • closesocket() • Closes an existing socket • WSACleanup() • Terminates the use of the Winsock 2 DLL (Ws2_32.dll) shutdown(ConnectSocket, SD_SEND); shutdown(ConnectSocket, SD_RECEIVE); closesocket(ConnectSocket); WSACleanup();

  16. Thread • CreateThread() • Creates a thread to execute within the virtual address space of the calling process CreateThread( NULL, // default security attributes 0, // use default stack size MyThreadFunction, // thread function name NULL,// argument to thread function 0, // use default creation flags NULL); // returns the thread identifier

  17. You need to… • Log in our server • Upload your work to e3 • Source code • Report • Explain source code • Introduction winsock • Introduction thread • Upload format: <Strudent ID>.zip • Ex: 9617000.zip

  18. Resource • TA provide server source code • http://bletchley.twbbs.org.tw/comsec/winsock.7z • MSDN winsock document • http://msdn.microsoft.com/en-us/library/windows/desktop/ms738545(v=vs.85).aspx • MSDNThread document • http://msdn.microsoft.com/en-us/library/windows/desktop/ms682516(v=vs.85).aspx

  19. Q&A

More Related