/* func: get a valid device */ unsigned short getOneValidDevice(void) { unsigned long lbus; unsigned long lslot; unsigned long lfunc = 0; unsigned short device; unsigned short vendor; unsigned long address; unsigned short class_sub; unsigned short progif_rev; unsigned short pin_line; unsigned long base_address; unsigned short cmd; unsigned short status; print_string(" VENDOR DEVICE CMD STATUS CLASS|SUB PROGIF|REV PIN|LINE BASE_ADDR"); print_return(); for (lbus =0; lbus < 256; lbus++) { for (lslot = 0; lslot < 32; lslot++) { for (lfunc = 0; lfunc < 8; lfunc++) { PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x00, address, vendor); /*vendor = pciConfigReadWord(bus, slot, 0, 0);*/ if(vendor != 0xFFFF) { /* device = pciConfigReadWord(bus, slot, 0, 2); */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x02, address, device); /* Class code|subclass */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x0a, address, class_sub); /* Command */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x04, address, cmd); /* Status */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x06, address, status); /* Prog IF| Revision ID */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x08, address, progif_rev); /* Interrupt PIN | Interrupt Line */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x3c, address, pin_line); /* base address #0 */ PCI_CONFIG_READ_DWORD(lbus, lslot, lfunc, 0x10, address, base_address); // netcard: intel e1000 if ((vendor == 0x8086) && (device == 0x100F)) { print_short(vendor); print_short(device); print_short(cmd); print_short(status); print_short(class_sub); print_short(progif_rev); print_short(pin_line); print_long(base_address & 0xFFFFFFFC); print_return(); } } } } } // print_string(" Today is 20130526, I'm coding for NetCard."); return 0; }
void print_python_syntax(struct list *payload){ payload_gadget_t *payload_node_ptr; struct Lnode *aux_ptr; char *str_ptr; int i; printf(VAR_NAME " = 'A' * " OFF_NAME ";\n"); for(aux_ptr = payload->head; aux_ptr != NULL; aux_ptr = aux_ptr->next){ payload_node_ptr = GETPOINTER(aux_ptr, payload_gadget_t); printf(VAR_NAME " += pack('<L', 0x%08x);", payload_node_ptr->value); if(payload_node_ptr->strings[0]){ printf(" ##"); for(i = 0; i <= 2; i++){ str_ptr = payload_node_ptr->strings[i]; if(str_ptr){ if(strstr(str_ptr, "pop")){ print_return(str_ptr); } else{ printf(" %s;", str_ptr); } } } } // Always // printf("\n"); } }
void produce_info(node_t *ptr) { if (!ptr) print_return("NULL"); ptr->val = 1; return; }
void consume_info_in_block(node_t *ptr) { if (!ptr) print_return("NULL"); ptr->val = 0; return; }
void use_block_x_to_pro_y(node_t *x, node_t *y) { if (!x || !y) print_return("NULL"); y->val = x->val; x->val = 0; return; }
std::ostream& node(const ast::abstract::Node& node) { switch(node) { case ast::ExternNode: print_extern(dynamic_cast<const ast::Extern&>(node)); break; case ast::FuncNode: print_func(dynamic_cast<const ast::Func&>(node)); break; case ast::VariableNode: print_variable(dynamic_cast<const ast::Variable&>(node)); break; case ast::ConstantNode: print_constant(dynamic_cast<const ast::Constant&>(node)); break; case ast::CastNode: print_cast(dynamic_cast<const ast::Cast&>(node)); break; case ast::UnOpNode: print_un_op(dynamic_cast<const ast::UnOp&>(node)); break; case ast::BinOpNode: print_bin_op(dynamic_cast<const ast::BinOp&>(node)); break; case ast::CallNode: print_call(dynamic_cast<const ast::Call&>(node)); break; case ast::ReturnNode: print_return(dynamic_cast<const ast::Return&>(node)); break; case ast::BranchNode: print_branch(dynamic_cast<const ast::Branch&>(node)); break; case ast::AssignmentNode: print_assignment(dynamic_cast<const ast::Assignment&>(node)); break; case ast::WhileNode: print_while(dynamic_cast<const ast::While&>(node)); break; case ast::VoidContextNode: print_void_context(dynamic_cast<const ast::VoidContext&>(node)); break; default: stream << "[Unknown Node] ??"; } return stream; }