use of com.jsql.view.scan.ScanListTerminal in project jsql-injection by ron190.
the class RessourceAccess method scanList.
/**
* Start fast scan of URLs in sequence and display result.
* Unplug any existing view and plug a console-like view in order to
* respond appropriately to GUI message with simple text result instead of
* build complex graphical components during the multi website injections.
* At the end of the scan it plugs again the normal view.
* @param urlList contains a list of String URL
*/
public static void scanList(List<ItemList> urlList) {
// Erase everything in the view from a previous injection
Request requests = new Request();
requests.setMessage(Interaction.RESET_INTERFACE);
MediatorModel.model().sendToViews(requests);
// wait for ending of ongoing interaction between two injections
try {
Thread.sleep(500);
} catch (InterruptedException e) {
LOGGER.error("Interruption while sleeping during scan", e);
Thread.currentThread().interrupt();
}
// Display result only in console
MediatorModel.model().deleteObservers();
MediatorModel.model().addObserver(new ScanListTerminal());
MediatorModel.model().setIsScanning(true);
RessourceAccess.isScanStopped = false;
for (ItemList url : urlList) {
ItemListScan urlurl = (ItemListScan) url;
if (MediatorModel.model().isStoppedByUser() || RessourceAccess.isScanStopped) {
break;
}
LOGGER.info("Scanning " + urlurl.getBeanInjection().getUrl());
MediatorModel.model().controlInput(urlurl.getBeanInjection().getUrl(), urlurl.getBeanInjection().getRequest(), urlurl.getBeanInjection().getHeader(), urlurl.getBeanInjection().getInjectionTypeAsEnum(), urlurl.getBeanInjection().getRequestType(), true);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
LOGGER.error("Interruption while sleeping between two scans", e);
Thread.currentThread().interrupt();
}
}
// Get back the normal view
// TODO Don't play with View on Model
MediatorModel.model().addObserver(MediatorGui.frame().getObserver());
MediatorModel.model().setIsScanning(false);
MediatorModel.model().setIsStoppedByUser(false);
RessourceAccess.isScanStopped = false;
Request request = new Request();
request.setMessage(Interaction.END_SCAN);
MediatorModel.model().sendToViews(request);
}
Aggregations