在我的 portscanner 程序中,我希望成功写入端口号、扫描方式和服务名称的输出。所以对于每个端口号、scannedby 和服务名称,我调用下面的 parseall 例程。
void parseall(int pid, char *scannedby, char *service){ // routine to add port, scannedby and service to xmlfile
xmlDocPtr doc; // pointer to parse xml Document
xmlNodePtr cur = NULL;// node pointer. It interacts with individual node
xmlAttrPtr attr; char portid[10];
sprintf (portid,"%d",pid); // converted int to string
doc = xmlParseFile(xmlFileName); //parse filename
cur = xmlDocGetRootElement(doc); // get rootnode
addnewportinfotag(cur,doc); // this routine adds new portid, scannedby and servicename tags to the xmlfile created
cur …Run Code Online (Sandbox Code Playgroud) c ×1