diff --git a/suicide.src b/suicide.src new file mode 100644 index 0000000000000000000000000000000000000000..f11bc20a2cf92170d3dd295c0b9ee122fbd7d7ed --- /dev/null +++ b/suicide.src @@ -0,0 +1,36 @@ +// @author: Flo de Qu'est-ce que tu GEEKes ? +// This suicid script removes scripts folder +// and kills connection + +program_name = program_path.split("/")[-1] + +if params.len < 1 or params[0] == "-h" or params[0] == "--help" then exit("<b>Usage: "+program_name+" [do|dry-run]</b>") + +this_shell=get_shell +this_computer=this_shell.host_computer + +script_folder = this_computer.File(this_computer.current_path) +if script_folder.has_permission("w") then + if "do" == params[0] then + script_folder.delete + else + print("Dry-Run mode!\n") + print("Delete folder: " + this_computer.current_path) + end if +else + print("permission denied") +end if + +procs = this_computer.show_procs +procs_lines = procs.split(char(10)) +for proc_line in procs_lines + proc_details = proc_line.split(" ") + if null != proc_details.indexOf("Terminal") and active_user == proc_details[proc_details.indexOf("Terminal") - 4] then + terminal_pid=proc_details[proc_details.indexOf("Terminal") - 3] + if "do" == params[0] then + print(this_computer.close_program(terminal_pid.to_int)) + else + print("Kill " + terminal_pid) + end if + end if +end for