Package org.owasp.webscarab.model

Examples of org.owasp.webscarab.model.ConversationModel


    public void run() {
        _runThread = Thread.currentThread();
        _model.setRunning(true);
        int count = 0;
        ConversationID id = null;
        ConversationModel cmodel = _model.getConversationModel();
        while (!_model.isStopping()) {
            try {
                synchronized(_lock) {
                    _lock.wait();
                }
                if (id != _selected) {
                    id = _selected;
                    _model.setBusy(true);
                    HttpUrl baseUrl = cmodel.getRequestUrl(id);
                    if (baseUrl.getQuery() != null)
                      baseUrl = baseUrl.getParentUrl();
                    Response baseResponse = cmodel.getResponse(id);
                    byte[] baseBytes = baseResponse.getContent();
                    String type = baseResponse.getHeader("Content-Type");
                    if (type == null || !type.startsWith("text")) {
                        _logger.warning("Base response is not text, skipping!");
                        return;
                    }
                    List baseline = tokenize(baseBytes);
                    _diff = new LevenshteinDistance(baseline);
                   
                    count = cmodel.getConversationCount();
                    _logger.info("Checking " + count + " conversaitons");
                    for (int i=0; i<count; i++) {
                        ConversationID cid = cmodel.getConversationAt(i);
                        HttpUrl curl = cmodel.getRequestUrl(cid);
                        if (curl.getQuery() != null)
                          curl = curl.getParentUrl();
                        if (!curl.equals(baseUrl))
                          continue;
                        _logger.info("Checking conversation " + i + " == " + cid);
                        if (cid.equals(id)) {
                            _model.setDistance(cid, 0);
                        } else {
                            Response response = cmodel.getResponse(cid);
                            String ctype = response.getHeader("Content-Type");
                            _logger.info("Content-type is " + ctype);
                            if (ctype != null && ctype.startsWith("text")) {
                                byte[] bytes = response.getContent();
                                List target = tokenize(bytes);
View Full Code Here


        saveSearches();
    }
   
    public void removeSearch(String description) {
        _model.removeSearch(description);
        ConversationModel cmodel = _frameworkModel.getConversationModel();
        int count = cmodel.getConversationCount();
        for (int i=0; i<count; i++) {
            ConversationID id = cmodel.getConversationAt(i);
            _model.setSearchMatch(id, description, false);
        }
        saveSearches();
    }
View Full Code Here

   
    public void reload(String description) {
        ConversationID id = null;
        try {
            String expr = _model.getSearchExpression(description);
            ConversationModel cmodel = _frameworkModel.getConversationModel();
            int count = cmodel.getConversationCount();
            for (int i=0; i<count; i++) {
                id = cmodel.getConversationAt(i);
                Request request = cmodel.getRequest(id);
                Response response = cmodel.getResponse(id);
                String origin = cmodel.getConversationOrigin(id);
                boolean matches = matches(id, request, response, origin, expr);
                _model.setSearchMatch(id, description, matches);
            }
        } catch (Exception e) {
            _logger.log(Level.WARNING,"Evaluation error for conversation " + id,e);
View Full Code Here

        String samlMessage = this.model.getConversationProperty(id, "SAML-MESSAGE");
        return samlMessage;
    }

    public ConversationID findCorrespondingHTMLFormConversation(ConversationID samlId) {
        ConversationModel conversationModel = this.model.getConversationModel();
        HttpUrl samlHttpUrl = conversationModel.getRequestUrl(samlId);
        int samlConversationIndex = conversationModel.getIndexOfConversation(samlId);
        for (int conversationIndex = samlConversationIndex - 1; conversationIndex >= 0; conversationIndex--) {
            ConversationID id = conversationModel.getConversationAt(conversationIndex);
            Response response = conversationModel.getResponse(id);
            HttpUrl httpUrl = conversationModel.getRequestUrl(id);
            Object parsedContent = Parser.parse(httpUrl, response);
            if (null == parsedContent) {
                continue;
            }
            if (false == parsedContent instanceof org.htmlparser.util.NodeList) {
View Full Code Here

        }
        return null;
    }

    public byte[] getResponseContent(ConversationID id) {
        ConversationModel conversationModel = this.model.getConversationModel();
        Response response = conversationModel.getResponse(id);
        byte[] content = response.getContent();
        return content;
    }
View Full Code Here

        byte[] content = response.getContent();
        return content;
    }

    public boolean isOverSSL(ConversationID id) {
        ConversationModel conversationModel = this.model.getConversationModel();
        HttpUrl httpUrl = conversationModel.getRequestUrl(id);
        String scheme = httpUrl.getScheme();
        if ("https".equals(scheme)) {
            return true;
        }
        return false;
View Full Code Here

TOP

Related Classes of org.owasp.webscarab.model.ConversationModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.