/* * Print a list of traced processes and their call status. We must not * interfere with actual process output, so perform out-of-band printing * (with info lines rather than lines prefixed by each process's PID). */ static void list_info(void) { struct trace_proc *proc; int no_call, in_call; put_newline(); for (proc = proc_next(NULL); proc != NULL; proc = proc_next(proc)) { /* * When attaching to an existing process, there is no way to * find out whether the process is in a system call or not. */ no_call = (proc->trace_flags & TF_NOCALL); in_call = (proc->trace_flags & TF_INCALL); assert(!in_call || !no_call); put_fmt(NULL, "Tracing %s (pid %d), %s%s%s", proc->name, proc->pid, no_call ? "call status unknown" : (in_call ? "in a " : "not in a call"), in_call ? call_name(proc) : "", in_call ? " call" : ""); put_newline(); } }
int main() { fprintf(stdout, "DBus testing 123\n" ); DBusConnection* session_bus; session_bus = get_session_connected(); request_name_for_connection( session_bus ); //call_name( session_bus, "com.avengergear.PushServer.Proxy" ); call_name( session_bus, "com.avengergear.PushServer.Proxy.TypeTest" ); return 0; }
int main() { fprintf(stdout, "DBus testing 123\n" ); DBusConnection* session_bus; session_bus = get_session_connected(); request_name_for_connection( session_bus ); //call_name( session_bus, "com.novell.PushServer.Proxy" ); call_name( session_bus, "org.gnome.GConf" ); return 0; }
// TODO: split this function into smaller parts static void trace_child(traced_program *p) { p->counter = 0; p->in_call = false; /* * continue to stop, wait and release until * the child is finished; wait_val != 1407 * Low=0177L and High=05 (SIGTRAP) */ while (p->status == 1407 ) { p->counter++; if (ptrace(PTRACE_SYSCALL, p->pid, 0, 0) != 0) perror(NHEAD "ptrace"); wait(&p->status); p->in_call = !p->in_call; struct user_regs_struct r; if (ptrace(PTRACE_GETREGS, p->pid, 0, &r) != 0) perror(NHEAD "ptracer (TODO:pair)"); else { int nbuff=0x100; char buff[nbuff]; int syscall = r.orig_eax; // TODO: duely process each syscall (white/black list) if (!syscall) exit(69); if (syscall == __NR_exit) continue; long ebx = r.ebx; long ecx = r.ecx; long edx = r.edx; struct one_call *call = global_call_list + syscall; char *callname = call->name; if (callname && p->in_call) { call->numcalls += 1; debug("syscall %s(%d) [b,c,d]=[%lx,%lx,%lx] (%d of %d)\n", callname+5, syscall, ebx, ecx, edx, call->numcalls, call->maxcalls ); if (syscall == __NR_open) { strnchild(p, buff, (char *)ebx, nbuff); debug("ebx = %lx \"%s\"\n", ebx, buff); } if (syscall == __NR_write) { strnchild(p, buff, (char *)ecx, nbuff); char buff2[nbuff]; stringshot(buff2, buff, edx, 40); debug("ebx = %lx \"%s\"\n", ecx, buff2); } if (call->maxcalls >= 0 && call->numcalls > call->maxcalls) { ptrace(PTRACE_KILL, p->pid, 0, 0); debug("DIAG too much %d-calls (%s), " "killing...\n", syscall, 5+ call_name(syscall) ); } //if (syscall == __NR_fork) //{ // ptrace(PTRACE_KILL, p->pid, 0, 0); // debug("invalid syscall, killing..."); //} } if (callname && !p->in_call) { debug("syscall %s(%d) returned %lx\n", callname+5, syscall, r.eax); } } } debug("counter (syscalls) = %d\n", p->counter); }