All pastes #728292 Raw Edit

Untitled

public c v1 · immutable
·published 2007-10-06 21:16 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <fcntl.h>//unsigned char ORIG[] = "1";//unsigned char PATCH[] = "0";unsigned char b=0;int main(int argc, char **argv) {        int mem;        char data[1];        int i;        mem = open("/dev/kmem", O_RDWR);        if (mem<0) {                printf("Oops !\n");                return 0;        }        if (lseek(mem, (off_t)0xC01C412C, SEEK_SET) != 0xC01C412C) {                perror("lseek");                return 1;        }        if (read(mem, data, 1) != 1) {                perror("read");                printf("secure_kern:  %.2x ", data[i]);        }        printf("\n");        printf("Data match :  %d\n",data);        //exit(1);        lseek(mem, (off_t)0xC01C412C, SEEK_SET);        if (write(mem, &b, 1) != 1) {                perror("write");                return 1;        }        close(mem);        return 1;}