What should I implement?#

The requirements are:

  • Suppress keyboard inputs as ALT+Tab.
  • Log copy and paste events.
  • Send the logs to the proctor.

The implementation plan!#

.
├── clipboard.c
├── hook.c
├── log.c
├── main.c
├── parse.c
├── policy.c
├── queue.c
└── tree.c

This is the project tree, only containing .c files.

First, in main.c, parse() function in parse.c is called to parse the command line arguments into struct ARGS. This struct is passed to initialization functions in other .c files.

void init(LPARGS pa)
{
	setlocale(LC_ALL, "ko-kr");

	InitLog(pa);
	InitPolicy(pa);
	InitHook(pa);

	StartupLog(pa);
}

In policy.c, which keyboard shortcuts are allowed or banned is decided. It is put inside a trie. The function CheckPolicy() is called when the hook which is set by hook.c is triggered.

The information about pressed keys is passed to the CheckPolicy() function, and it is checked against the trie made before. If the keyboard shortcut is banned, a thread is created. This thread will send the log to the server, which is not implemented at the moment.

By the way, if the shortcut CTRL+V is pressed, the most recent content of the clipboard is copied into the memory, and then logged.

Plans for the future?#

  • Change the action of RunGUID() function.
  • Implement the part where logs are sent to the server.
  • Make some watchdogs that prevents the main watchdog being closed.