Search in sources :

Example 11 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class SessionStructureUnitTest method setUp.

@BeforeEach
void setUp() throws Exception {
    WithConfigsTest.setUpConstantMessages();
    factory = new VariantFactory();
    model = mock(Model.class);
    session = new Session(model);
    given(model.getSession()).willReturn(session);
    given(model.getVariantFactory()).willReturn(factory);
    Control.initSingletonForTesting(model);
    msg = new HttpMessage();
}
Also used : VariantFactory(org.zaproxy.zap.extension.ascan.VariantFactory) Model(org.parosproxy.paros.model.Model) HttpMessage(org.parosproxy.paros.network.HttpMessage) Session(org.parosproxy.paros.model.Session) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class Control method runCommandLineOpenSession.

public void runCommandLineOpenSession(String fileName) throws Exception {
    log.debug("runCommandLineOpenSession " + fileName);
    getExtensionLoader().sessionAboutToChangeAllPlugin(null);
    Session session = Model.getSingleton().getSession();
    Model.getSingleton().openSession(fileName);
    log.info("Session file opened");
    control.getExtensionLoader().databaseOpen(model.getDb());
    control.getExtensionLoader().sessionChangedAllPlugin(session);
}
Also used : Session(org.parosproxy.paros.model.Session)

Example 13 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class MenuFileControl method saveSession.

public void saveSession() {
    Session session = model.getSession();
    if (session.isNewState()) {
        view.showWarningDialog("Please use Save As...");
        return;
    }
    try {
        waitMessageDialog = view.getWaitMessageDialog(// ZAP: i18n
        Constant.messages.getString("menu.file.savingSession"));
        control.saveSession(session.getFileName(), this);
        log.info("saving session file " + session.getFileName());
        // ZAP: If the save is quick the dialog can already be null here
        if (waitMessageDialog != null) {
            waitMessageDialog.setVisible(true);
        }
    } catch (Exception e) {
        view.showWarningDialog(// ZAP: i18n
        Constant.messages.getString("menu.file.savingSession.error"));
        log.error("error saving session file " + session.getFileName());
        log.error(e.getMessage(), e);
    }
}
Also used : IllegalContextNameException(org.zaproxy.zap.model.IllegalContextNameException) DatabaseException(org.parosproxy.paros.db.DatabaseException) Session(org.parosproxy.paros.model.Session) RecordSession(org.parosproxy.paros.db.RecordSession)

Example 14 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class SessionGeneralPanel method saveParam.

@Override
public void saveParam(Object obj) throws Exception {
    Session session = (Session) obj;
    boolean changed = false;
    if (!getTxtSessionName().getText().equals(session.getSessionName())) {
        session.setSessionName(getTxtSessionName().getText());
        changed = true;
    }
    if (!getTxtDescription().getText().equals(session.getSessionDesc())) {
        session.setSessionDesc(getTxtDescription().getText());
        changed = true;
    }
    if (changed) {
        try {
            Control.getSingleton().persistSessionProperties();
        } catch (Exception e) {
            LOGGER.error("Failed to persist the session properties:", e);
            throw new Exception(Constant.messages.getString("session.general.error.persist.session.props"));
        }
    }
}
Also used : Session(org.parosproxy.paros.model.Session)

Example 15 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class SessionGeneralPanel method initParam.

@Override
public void initParam(Object obj) {
    Session session = (Session) obj;
    getTxtSessionName().setText(session.getSessionName());
    getTxtSessionName().discardAllEdits();
    getTxtDescription().setText(session.getSessionDesc());
    getTxtDescription().discardAllEdits();
    if (session.getFileName() != null) {
        getSessionLocation().setText(session.getFileName());
        // In case its really long
        getSessionLocation().setToolTipText(session.getFileName());
    }
}
Also used : Session(org.parosproxy.paros.model.Session)

Aggregations

Session (org.parosproxy.paros.model.Session)51 DatabaseException (org.parosproxy.paros.db.DatabaseException)18 Context (org.zaproxy.zap.model.Context)14 ArrayList (java.util.ArrayList)8 JMenuItem (javax.swing.JMenuItem)7 ExtensionPopupMenuItem (org.parosproxy.paros.extension.ExtensionPopupMenuItem)7 File (java.io.File)5 SiteNode (org.parosproxy.paros.model.SiteNode)5 HttpMalformedHeaderException (org.parosproxy.paros.network.HttpMalformedHeaderException)5 URIException (org.apache.commons.httpclient.URIException)4 RecordStructure (org.parosproxy.paros.db.RecordStructure)4 HttpMessage (org.parosproxy.paros.network.HttpMessage)4 ApiException (org.zaproxy.zap.extension.api.ApiException)4 ApiResponseElement (org.zaproxy.zap.extension.api.ApiResponseElement)4 Date (java.util.Date)3 HashMap (java.util.HashMap)3 PatternSyntaxException (java.util.regex.PatternSyntaxException)3 JFileChooser (javax.swing.JFileChooser)3 JSONException (net.sf.json.JSONException)3 ExtensionHistory (org.parosproxy.paros.extension.history.ExtensionHistory)3