// Security.java

package ed.security;

import ed.js.engine.*;

public class Security {

    static final String CORE = Convert.DEFAULT_PACKAGE + "._data_corejs_";
    static final String SHELL = Convert.DEFAULT_PACKAGE + ".lastline";
    
    public static boolean isCoreJS(){
        String topjs = getTopJS();
        if ( topjs == null )
            return false;

        if ( topjs.equals( SHELL ) )
            return true;

        return topjs.startsWith( CORE );
    }
    
    public static String getTopJS(){
        
        StackTraceElement[] st = Thread.currentThread().getStackTrace();
        
        for ( int i=0; i<st.length; i++ ){
            StackTraceElement e = st[i];
            if ( e.getClassName().startsWith( Convert.DEFAULT_PACKAGE + "." ) )
                return e.getClassName();
        }

        return null;
    }
    
    
}

@@ -85,39 +85,70 @@
 y %7B%0A
+    
 %0A    
-static final String CORE =
+final static String SECURE%5B%5D = new String%5B%5D%7B %0A       
  Con
@@ -190,41 +190,78 @@
 js_%22
-;
+ , 
 %0A    
-static final String SHELL =
+    Convert.DEFAULT_PACKAGE + %22._data_sites_admin_%22 , %0A       
  Con
@@ -294,16 +294,23 @@
 astline%22
+ %0A    %7D
 ;%0A    %0A 
@@ -440,46 +440,116 @@
 se;%0A
-%0A        if ( topjs.equals( SHELL
+        %0A        for ( int i=0; i%3CSECURE.length; i++ )%0A            if ( topjs.startsWith( SECURE%5Bi%5D
  ) )%0A
+    
     
@@ -569,16 +569,24 @@
 n true;%0A
+        
 %0A       
@@ -597,32 +597,13 @@
 urn 
-topjs.startsWith( CORE )
+false
 ;%0A  

clean security code