You are on page 1of 3

package org.

tb_orasocketserver;
import
import
import
import

java.io.*;
java.net.URL;
java.security.MessageDigest;
java.util.*;

// Referenced classes of package org.tb_orasocketserver:


//
FrmJARmaker, OSS
public class ThinStart
{
URL oracle_url;
URL oracle_root;
Exception userex;
public static String formsURL = "";
static ThinStart mainInstance = null;
public static Hashtable config2file = new Hashtable();
public static boolean is_registered = false;
public static String email;
public static String license;
public static String kkey;
public static String regchkstring;
public static String checkString;
public static String checkUpdates = "YES";
public static int x1;
public static String cmd_url = "no";
public static int cmd_pport = -1;
public static int cmd_iport = -1;
public ThinStart()
{
}
public void runcmdline(String s, String s1, int i)
throws Exception
{
try
{
oracle_url = new URL(s1);
oracle_root = new URL(oracle_url.getProtocol(), oracle_url.getHost()
, oracle_url.getPort(), "/");
if(!oracle_url.getProtocol().equals("http") && !oracle_url.getProtoc
ol().equals("https"))
{
System.out.println("Protocol must be http or https.");
throw userex;
}
}
catch(Exception _ex)
{
System.out.println("Not a valid URL: ");
if(s1 != null && !s1.equals(""))
{
System.out.println(s1);
} else
{
System.out.println("No URL entered.");
}

throw userex;
}
formsURL = s1;
System.out.println("Loading Forms JARs from Forms Server...");
File file = File.createTempFile(s, null);
file.deleteOnExit();
FrmJARmaker.runmain(formsURL, file, i);
config2file.put(s, file);
if(FrmJARmaker.success != 1)
{
System.out.println("Errors encountered. Unable to continue.");
System.exit(1);
}
}
private static String byteArray2Hex(byte abyte0[])
{
Formatter formatter = new Formatter();
byte abyte1[];
int j = (abyte1 = abyte0).length;
for(int i = 0; i < j; i++)
{
byte byte0 = abyte1[i];
formatter.format("%02x", new Object[] {
Byte.valueOf(byte0)
});
}
return formatter.toString();
}
public static void main(String args[])
{
try
{
if(args != null)
{
if(args.length >= 1)
{
cmd_pport = Integer.parseInt(args[0]);
}
if(args.length >= 2)
{
cmd_iport = Integer.parseInt(args[1]);
}
}
}
catch(Exception _ex)
{
System.out.println("Parameter error. Syntax: Parameter 1 is public
port (default 80), Parameter 3 i" +
"s internal port (default 6499)"
);
cmd_pport = -1;
cmd_iport = -1;
return;
}
try
{
Properties properties = new Properties();

properties.load(new FileInputStream("configs.properties"));
Set set = properties.keySet();
Iterator iterator = set.iterator();
mainInstance = new ThinStart();
while(iterator.hasNext())
{
String s = (String)iterator.next();
if(!s.endsWith("_key"))
{
String s1 = properties.getProperty(s);
String s2 = properties.getProperty((new StringBuilder(String
.valueOf(s))).append("_key").toString(), "demo").toUpperCase();
MessageDigest messagedigest = MessageDigest.getInstance("SHA
-1");
String s3 = byteArray2Hex(messagedigest.digest((new String((
new StringBuilder("!")).append(s1.toUpperCase()).append("t").append("b").append(
"t").append("l").append("a").append("s").toString())).getBytes())).toUpperCase()
.substring(0, 11);
s3 = (new StringBuilder(String.valueOf(s3.substring(0, 4))))
.append("-").append(s3.substring(4, 7)).append("-").append(s3.substring(7, 11)).
toString();
byte byte0 = 17;
if(s3.equals(s2))
{
byte0 = 11;
} else
if(s2.equals("DEMO"))
{
byte0 = 17;
} else
{
byte0 = 9;
}
s3 = "FormsMain.class";
System.out.println((new StringBuilder("GENERATING PACKAGE FO
R CONFIG: ")).append(s).toString());
try
{
mainInstance.runcmdline(s, s1, byte0);
}
catch(Exception exception1)
{
exception1.printStackTrace();
System.out.println((new StringBuilder("[Ex] Error creati
ng package for config ")).append(s).toString());
}
}
}
System.out.println("Preparation completed. Starting Server...");
(new OSS(cmd_pport, cmd_iport, null)).run();
}
catch(Exception exception)
{
exception.printStackTrace();
System.out.println("[Ex2] Program terminated.");
}
return;
}
}

You might also like