use of org.zaproxy.zap.extension.ascan.VariantFactory 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();
}
use of org.zaproxy.zap.extension.ascan.VariantFactory in project zaproxy by zaproxy.
the class AbstractAppParamPlugin method scan.
@Override
public void scan() {
VariantFactory factory = Model.getSingleton().getVariantFactory();
listVariant = factory.createVariants(this.getParent().getScannerParam(), this.getBaseMsg());
if (listVariant.isEmpty()) {
getParent().pluginSkipped(this, Constant.messages.getString("ascan.progress.label.skipped.reason.noinputvectors"));
return;
}
for (int i = 0; i < listVariant.size() && !isStop(); i++) {
HttpMessage msg = getNewMsg();
// ZAP: Removed unnecessary cast.
variant = listVariant.get(i);
try {
variant.setMessage(msg);
this.scan(this.variant.getParamList());
} catch (Exception e) {
logger.error("Error occurred while scanning with variant " + variant.getClass().getCanonicalName(), e);
}
// ZAP: Implement pause and resume
while (getParent().isPaused() && !isStop()) {
Util.sleep(500);
}
}
}
use of org.zaproxy.zap.extension.ascan.VariantFactory in project zaproxy by zaproxy.
the class SiteMapUnitTest method setup.
@BeforeEach
void setup() throws Exception {
Session session = mock(Session.class);
StandardParameterParser spp = new StandardParameterParser();
given(session.getUrlParamParser(any(String.class))).willReturn(spp);
sessionId = 1234L;
given(session.getSessionId()).willReturn(sessionId);
tableHistory = mock(TableHistory.class);
given(tableHistory.write(eq(sessionId), eq(HistoryReference.TYPE_TEMPORARY), any(HttpMessage.class))).willReturn(mock(RecordHistory.class));
HistoryReference.setTableHistory(tableHistory);
tableAlert = mock(TableAlert.class);
given(tableAlert.getAlertsBySourceHistoryId(anyInt())).willReturn(Collections.emptyList());
HistoryReference.setTableAlert(tableAlert);
Model model = mock(Model.class);
Control.initSingletonForTesting(model);
given(model.getSession()).willReturn(session);
factory = new VariantFactory();
given(model.getVariantFactory()).willReturn(factory);
rootNode = new SiteNode(null, -1, "Root Node");
siteMap = new SiteMap(rootNode, model);
}
use of org.zaproxy.zap.extension.ascan.VariantFactory in project zaproxy by zaproxy.
the class SessionUnitTest method setUp.
@BeforeEach
void setUp() throws Exception {
factory = new VariantFactory();
Model model = mock(Model.class);
given(model.getVariantFactory()).willReturn(factory);
Control.initSingletonForTesting(model);
session = new Session(model);
given(model.getSession()).willReturn(session);
}
Aggregations