/*************************************************************************** queue a DNS query ****************************************************************************/ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question, struct name_record **n) { if (in_dns || fd_in == -1) return False; if (!dns_current) { if (!write_child(p)) { DEBUG(3,("failed to send DNS query to child!\n")); return False; } dns_current = p; p->locked = True; } else { p->locked = True; p->next = dns_queue; p->prev = NULL; if (p->next) p->next->prev = p; dns_queue = p; } DEBUG(3,("added DNS query for %s\n", nmb_namestr(question))); return True; }
/* Un-patch code. This means restore the instruction under any "Int 3" that was patched-in by previous function. */ void Debugger::DeactivateBreakpoints() { int b; BP_ENTRY *bep; for(b=0, bep=breakpoint_table; b < breakpoint_count; b++, bep++) if(!bep->disabled && bep->saved) write_child(bep->addr, &bep->savedbyte, 1); }
int mut(char *file_path,int new_obj_id) { char *new_buff; int new_buff_size; int mut_choice=0; char *fn_temp = (char*)malloc(sizeof(char)*256); /* Get new buffer */ if(mut_choice==0) { //new neur strcpy(fn_temp,file_path); strcat(fn_temp,".des"); //printf(" :::::::::::::::ID-FILE:::%d:%s::::\n",new_obj_id,fn_temp); new_neur(fn_temp,&new_buff,&new_buff_size); //uncomment for prod } /* write buffer to new file */ int len = strlen(file_path); memset(fn_temp,'\0',256); get_childname(file_path,len,fn_temp,new_obj_id); //printf(" DEBUG:MUT: FILE_PATH:%s:FN_TEMP:%s\n",file_path,fn_temp); if(mut_choice==0) { //TEST //copy_des(file_path,fn_temp); //TEST if(copy_io(file_path,fn_temp)+copy_con(file_path,fn_temp)!=0) { printf(" ERROR: error copying parent files. Exiting mutation.\n"); return -1; } strcat(fn_temp,".des"); } //printf(" Writing child: %s\n",fn_temp); write_child(fn_temp,new_buff_size,new_buff); //uncomment for not testing free(new_buff); //uncomment for not testing return 0; }
void Debugger::ActivateBreakpoints() { int b, no; BP_ENTRY *bep; no = 4; // disable hardware breakpoints. edi.dr[7] = 0; // First handle data breakpoints. for(b=0, bep=breakpoint_table; b < breakpoint_count; b++, bep++) if(!bep->disabled && no <= 3 && bep->type != BP_Code) { bep->saved = 0; edi.dr[7] |= ((bep->type + ((bep->length-1) << 2)) << (16+4*no) | (2 << (2*no))); edi.dr[no] = bep->addr; no++; } // Now handle code breakpoints. for(b=0, bep=breakpoint_table; b < breakpoint_count; b++, bep++) if (!bep->disabled && bep->type == BP_Code) { if (no <= 3) { bep->saved = 0; edi.dr[7] |= ((BP_Code << (16+4*no)) | (2 << (2*no))); edi.dr[no] = bep->addr; no++; edi.dr[7] |= 0x00000300L; // For 386s we set GE & LE bits. } else { bep->saved = IsValidAddr(bep->addr, 1); if(bep->saved) { read_child(bep->addr, &bep->savedbyte, 1); write_child(bep->addr, (void *)&int03, 1); } } } }
/*************************************************************************** check the DNS queue ****************************************************************************/ void run_dns_queue(void) { struct query_record r; struct packet_struct *p, *p2; struct name_record *namerec; int size; if (fd_in == -1) return; /* Allow SIGTERM to kill us. */ BlockSignals(False, SIGTERM); if (!process_exists(child_pid)) { close(fd_in); start_async_dns(); } if ((size=read_data(fd_in, (char *)&r, sizeof(r))) != sizeof(r)) { if (size) { DEBUG(0,("Incomplete DNS answer from child!\n")); fd_in = -1; } BlockSignals(True, SIGTERM); return; } BlockSignals(True, SIGTERM); namerec = add_dns_result(&r.name, r.result); if (dns_current) { if (query_current(&r)) { DEBUG(3,("DNS calling send_wins_name_query_response\n")); in_dns = 1; if(namerec == NULL) send_wins_name_query_response(NAM_ERR, dns_current, NULL); else send_wins_name_query_response(0,dns_current,namerec); in_dns = 0; } dns_current->locked = False; free_packet(dns_current); dns_current = NULL; } /* loop over the whole dns queue looking for entries that match the result we just got */ for (p = dns_queue; p;) { struct nmb_packet *nmb = &p->packet.nmb; struct nmb_name *question = &nmb->question.question_name; if (nmb_name_equal(question, &r.name)) { DEBUG(3,("DNS calling send_wins_name_query_response\n")); in_dns = 1; if(namerec == NULL) send_wins_name_query_response(NAM_ERR, p, NULL); else send_wins_name_query_response(0,p,namerec); in_dns = 0; p->locked = False; if (p->prev) p->prev->next = p->next; else dns_queue = p->next; if (p->next) p->next->prev = p->prev; p2 = p->next; free_packet(p); p = p2; } else { p = p->next; } } if (dns_queue) { dns_current = dns_queue; dns_queue = dns_queue->next; if (dns_queue) dns_queue->prev = NULL; dns_current->next = NULL; if (!write_child(dns_current)) { DEBUG(3,("failed to send DNS query to child!\n")); return; } } }