Skip to content

sasukepn1999/Creating-modules-and-Hooking-syscalls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Creating-modules-and-Hooking-syscalls

Creating modules

A kernel module create character device for process in user space read a random integer

Environment: Virtual Box with Ubuntu 18.04 (64 bit), kernel version 5.0.0-32-generic.

Setup

  • Open 2 terminal windows.

  • On the first terminal:

    • Compile main.c

      $ gcc -o main main.c
    • Build module hung_chrdev

      $ make
    • Insert moudule into Kernel.

      $ sudo insmod hung_chrdev.ko
    • Run main

      $ ./main
  • On the second terminal: see messages on the logging.

    $ sudo dmesg -c
    $ sudo dmesg -wH
  • Remove module from kernel on the first terminal.

    $ sudo rmmod hung_chrdev

Hooking syscalls

A kernel module hooking onto sys_write and sys_open.

Created in Zorin 12.4 on 64 bit, with kernel version 4.15.0-30-generic.

Setup

  • Open 2 terminals.

  • On the first terminal:

    • Compile test.c.

      $ gcc test.c -o test
    • Compile module hook.

      $ make
    • Insert moudule into Kernel.

      $ sudo insmod hook.ko
    • Run test.

      $ ./test
  • On the second terminal: see messages on the logging.

    $ sudo dmesg -c
    $ sudo dmesg -wH
  • Remove module from kernel on the first terminal.

    $ rm hook

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published