parser.readStartTag(startTag);
private Packet setProtoProperties(XmlStartTag st, Packet currentPacket) throws XmlPullParserException { parser.readStartTag(st); XmlAttributesHashMap<String, String> attributes = new XmlAttributesHashMap<>(); for (int i = 0; i < st.getAttributeCount(); i++) { attributes.put(st.getAttributeLocalName(i).trim(), st.getAttributeValue(i).trim()); } protoStack.push(attributes.get("name")); //tcp if ( attributes.checkIfEqual("name", "geninfo") ) { currentPacket.setPacketSize(Integer.parseInt(attributes.get("size"))); } //geninfo else if ( attributes.checkIfEqual("name", "tcp") ) { currentPacket.setTcp(true); currentPacket.setTcpPayloadStart(Integer.parseInt(attributes.get("pos")) + (Integer.parseInt(attributes.get("size")))); } else if ( attributes.checkIfEqual("name", "fake-field-wrapper") ) { currentPacket.setFragmented(true); } else if ( attributes.checkIfEqual("name", "http")){ // don't set http if this packet is the last fragment of a fragmented HTTP request/response // because we have no logic to reassemble the packet content, and anyway we want the script // to maintain the original (fragmented) nature of the traffic if (!currentPacket.isFragmented()) { currentPacket.setHttp(true); } } return currentPacket; }
private Packet setHttpFieldProperties(XmlStartTag st, Packet currentPacket) throws XmlPullParserException { parser.readStartTag(st); XmlAttributesHashMap<String, String> attributes = new XmlAttributesHashMap<>(); for (int i = 0; i < st.getAttributeCount(); i++) { attributes.put(st.getAttributeLocalName(i).trim(), st.getAttributeValue(i).trim()); } // used for id if ( attributes.checkIfEqual("name", "http.request.method") ) { currentPacket.setHttpRequestType(Packet.RequestType.valueOf(attributes.get("show"))); } else if ( attributes.checkIfEqual("name", "http.request.uri") ) { currentPacket.setHttpRequestURI(attributes.get("show")); } // used for formatting of payload if(fieldStack.size() == 1){ String pos = attributes.get("pos"); String size = attributes.get("size"); // Some fields don't have pos and size, e.g. data field in http proto packet if (pos != null && size != null) { currentPacket.addHttpField(attributes.get("name"), attributes.get("show"), Integer.parseInt(pos) - currentPacket.getTcpPayloadStart(), Integer.parseInt(size)); } } return currentPacket; }
private Packet setFieldProperties(XmlStartTag st, Packet currentPacket) throws XmlPullParserException { parser.readStartTag(st); XmlAttributesHashMap<String, String> attributes = new XmlAttributesHashMap<>(); for (int i = 0; i < st.getAttributeCount(); i++) {
parser.readStartTag(startTag);
parser.readStartTag(startTag);
parser.readStartTag(startTag);
parser.readStartTag(startTag);
parser.readStartTag(startTag);
parser.readStartTag(startTag);
parser.readStartTag(startTag);
parser.readStartTag(startTag);