1 /* 2 ** load.c for elfsh 3 ** 4 ** Started on Sat Jan 25 11:21:18 2003 mayhem 5 ** Last update Mon Apr 21 00:16:26 2003 mayhem 6 */ 7 #include "elfsh.h" 8 9 10 11 12 /* Insert an object in the list of opened elfsh descriptors */ cmd_load()13int cmd_load() 14 { 15 elfshobj_t *new; 16 17 /* Map the standard ELF object */ 18 new = elfsh_map_obj(world.args.param[0]); 19 if (NULL == new) 20 { 21 fprintf(stderr, "\n [!] Cannot load object "); 22 PERROR_RET(world.args.param[0], -1); 23 } 24 25 /* Print a msg if not in quiet mode */ 26 new->loadtime = time(&new->loadtime); 27 if (!world.state.vm_quiet) 28 printf("\n [*] New object %s loaded on %s \n\n", 29 world.args.param[0], ctime(&new->loadtime)); 30 31 /* Add the object to the list of opened objects */ 32 new->id = ++world.state.lastid; 33 world.current = new; 34 new->next = world.list; 35 world.list = new; 36 37 /* Add an entry into the loaded files hashtable */ 38 hash_add(&file_hash, new->name, (void *) new); 39 return (0); 40 } 41 42 43