what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

uname_lkm.c

uname_lkm.c
Posted Jul 26, 2004
Authored by Bugghy | Site vaida.bogdan.googlepages.com

Linux kernel module that will fake uname output for the 2.4 kernel series.

tags | kernel
systems | linux
SHA-256 | d20de33de4d5fa22a3db75f01fb41451871e54126d92a933a2f391636e6d7d5a

uname_lkm.c

Change Mirror Download
//                      uname faker
// v1.0a (24 Jul)
// by bugghy (bugghy@rootshell.be)

// Kernel module used to fake uname output for 2.4 kernels

// gcc -isystem /lib/modules/`uname -r`/build/include -O2 -DMODULE -D__KERNEL__ -c uname.c
// insmod uname.o

// You can add an -EFAULT return in case the buffer got corrupted (man 2 uname)

// Uses:
// 1. fun
// 2. start lkm programming
// 3. recompile a new kernel without shellusers noticing

#if CONFIG_MODVERSIONS==1 // was it defined in kernel ?
#define MODVERSIONS
#include <linux/modversions.h>
#endif

#include <linux/kernel.h> // we're in kernel mode
#include <linux/module.h> // we code a module
#include <sys/syscall.h> // syscall table
#include <sys/utsname.h> // struct utsname
#include <asm/uaccess.h> // copy_to_user

MODULE_AUTHOR("bugghy");
MODULE_DESCRIPTION("uname faker");
MODULE_LICENSE("Dual BSD/GPL");


#define SYSNAME "Plan9"
#define NODENAME "hellboy"
#define RELEASE "0.0.0"
#define VERSION "#0 Fri Aug 13 13:13:13 PPP 6969"
#define MACHINE "x0w33d"

extern void *sys_call_table[];

int (*o_uname) (struct utsname *buf);

int h_uname(struct utsname *buf){

int x;

x = o_uname(buf);

#ifdef SYSNAME
copy_to_user(buf->sysname, SYSNAME, sizeof buf->sysname);
#endif

#ifdef NODENAME
copy_to_user(buf->nodename, NODENAME, sizeof buf->nodename);
#endif

#ifdef RELEASE
copy_to_user(buf->release, RELEASE, sizeof buf->release);
#endif

#ifdef VERSION
copy_to_user(buf->version, VERSION, sizeof buf->version);
#endif

#ifdef MACHINE
copy_to_user(buf->machine, MACHINE, sizeof buf->machine);
#endif

return x;
}

int init_module(void) // replace original uname with hacked one
{
o_uname = sys_call_table[SYS_uname];
sys_call_table[SYS_uname] = h_uname;
return 0;
}

void cleanup_module(void) // replace hacked uname with original one
{
sys_call_table[SYS_uname] = o_uname;
}

Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    0 Files
  • 8
    May 8th
    0 Files
  • 9
    May 9th
    0 Files
  • 10
    May 10th
    0 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close