org.zaproxy.zap.extension.script.ScriptEngineWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zap Show documentation
Show all versions of zap Show documentation
The Zed Attack Proxy (ZAP) is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.
/*
* Zed Attack Proxy (ZAP) and its related class files.
*
* ZAP is an HTTP/HTTPS proxy for assessing web application security.
*
* Copyright 2013 The ZAP Development team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.zap.extension.script;
import java.util.List;
import javax.script.ScriptEngine;
import javax.swing.ImageIcon;
public abstract class ScriptEngineWrapper {
private ScriptEngine engine;
private String languageName;
private String engineName;
public ScriptEngineWrapper(ScriptEngine engine) {
this.engine = engine;
this.engineName = engine.getFactory().getEngineName();
this.languageName = engine.getFactory().getLanguageName();
}
public String getLanguageName() {
return languageName;
}
public String getEngineName() {
return engineName;
}
public ScriptEngine getEngine() {
// TODO Nasty hack!
return engine.getFactory().getScriptEngine();
}
public abstract boolean isTextBased();
public abstract String getTemplate(String type);
public abstract String getSyntaxStyle();
public abstract ImageIcon getIcon();
public abstract List getExtensions();
public abstract boolean isRawEngine();
/**
* Returns true if this engine supported script types without defined templates.
* @param type
* @return
*/
public abstract boolean isSupportsMissingTemplates();
/**
* Tells whether or not the given {@code script} is a default template of this engine.
*
* Default templates are automatically removed when the script engine is removed.
*
* @param script the script template that should be checked
* @return {@code true} if the template script is default of this engine, {@code false} otherwise
*/
public abstract boolean isDefaultTemplate(ScriptWrapper script);
}