Guest User

Signlink

a guest
Dec 2nd, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.27 KB | None | 0 0
  1. // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3)
  4. // Source File Name: signlink.java
  5.  
  6. package sign;
  7.  
  8. import java.applet.Applet;
  9. import java.io.*;
  10. import java.net.*;
  11.  
  12. public final class signlink
  13. implements Runnable
  14. {
  15.  
  16. public static void startpriv(InetAddress inetaddress)
  17. {
  18. threadliveid = (int)(Math.random() * 99999999D);
  19. if(active)
  20. {
  21. try
  22. {
  23. Thread.sleep(500L);
  24. }
  25. catch(Exception _ex) { }
  26. active = false;
  27. }
  28. socketreq = 0;
  29. threadreq = null;
  30. dnsreq = null;
  31. savereq = null;
  32. urlreq = null;
  33. socketip = inetaddress;
  34. Thread thread = new Thread(new signlink());
  35. thread.setDaemon(true);
  36. thread.start();
  37. while(!active)
  38. try
  39. {
  40. Thread.sleep(50L);
  41. }
  42. catch(Exception _ex) { }
  43. }
  44.  
  45. public void run()
  46. {
  47. active = true;
  48. String s = findcachedir();
  49. uid = getuid(s);
  50. //System.out.println("DEBUG: "+uid);
  51. try
  52. { // Take me to the cache
  53. File file = new File(s + "main_file_cache.dat");
  54. //if(file.exists() && file.length() > 150000000)
  55. // file.delete();
  56. cache_dat = new RandomAccessFile(s + "main_file_cache.dat", "rw");
  57. for(int j = 0; j < 5; j++)
  58. cache_idx[j] = new RandomAccessFile(s + "main_file_cache.idx" + j, "rw");
  59.  
  60. }
  61. catch(Exception exception)
  62. {
  63. exception.printStackTrace();
  64. }
  65. for(int i = threadliveid; threadliveid == i;)
  66. {
  67. if(socketreq != 0)
  68. {
  69. try
  70. {
  71. socket = new Socket(socketip, socketreq);
  72. }
  73. catch(Exception _ex)
  74. {
  75. socket = null;
  76. }
  77. socketreq = 0;
  78. } else
  79. if(threadreq != null)
  80. {
  81. Thread thread = new Thread(threadreq);
  82. thread.setDaemon(true);
  83. thread.start();
  84. thread.setPriority(threadreqpri);
  85. threadreq = null;
  86. } else
  87. if(dnsreq != null)
  88. {
  89. try
  90. {
  91. dns = InetAddress.getByName(dnsreq).getHostName();
  92. }
  93. catch(Exception _ex)
  94. {
  95. dns = "unknown";
  96. }
  97. dnsreq = null;
  98. } else
  99. if(savereq != null)
  100. {
  101. if(savebuf != null)
  102. try
  103. {
  104. FileOutputStream fileoutputstream = new FileOutputStream(s + savereq);
  105. fileoutputstream.write(savebuf, 0, savelen);
  106. fileoutputstream.close();
  107. }
  108. catch(Exception _ex) { }
  109. if(waveplay)
  110. {
  111. String wave = s + savereq;
  112. waveplay = false;
  113. }
  114. if(midiplay)
  115. {
  116. midi = s + savereq;
  117. midiplay = false;
  118. }
  119. savereq = null;
  120. } else
  121. if(urlreq != null)
  122. {
  123. try
  124. {
  125. System.out.println("urlstream");
  126. urlstream = new DataInputStream((new URL(mainapp.getCodeBase(), urlreq)).openStream());
  127. }
  128. catch(Exception _ex)
  129. {
  130. urlstream = null;
  131. }
  132. urlreq = null;
  133. }
  134. try
  135. {
  136. Thread.sleep(50L);
  137. }
  138. catch(Exception _ex) { }
  139. }
  140.  
  141. }
  142.  
  143. public static String findcachedir()
  144. {
  145. boolean exists = (new File(System.getProperty("user.home") + "/SinatraCache/")).exists();
  146. if (exists) {
  147. System.out.println("Directory exists");
  148. return System.getProperty("user.home") + "/SinatraCache/";
  149. } else {
  150. File f = new File(System.getProperty("user.home") + "/SinatraCache/");
  151. f.mkdir();
  152. System.out.println("Directory doesnt exist, making directory");
  153. return System.getProperty("user.home") + "/SinatraCache/";
  154. }
  155. }
  156.  
  157. public static String sencondclientDir() {
  158. File file = new File(System.getProperty("user.home") + "/Desktop/");
  159. if (!file.exists())
  160. file.mkdir();
  161. return file.toString();
  162. }
  163.  
  164. public static String sencondDir() {
  165. File file = new File("c:/SinatraCache/");
  166. if (!file.exists())
  167. file.mkdir();
  168. return file.toString();
  169. }
  170.  
  171. public static String findcachedirORIG()
  172. {
  173. String as[] = {
  174. "c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", "~/",
  175. "/tmp/", "", "c:/rscache", "/rscache"
  176. };
  177. if(storeid < 32 || storeid > 34)
  178. storeid = 32;
  179. String s = ".file_store_" + storeid;
  180. for(int i = 0; i < as.length; i++)
  181. try
  182. {
  183. String s1 = as[i];
  184. if(s1.length() > 0)
  185. {
  186. File file = new File(s1);
  187. if(!file.exists())
  188. continue;
  189. }
  190. File file1 = new File(s1 + s);
  191. if(file1.exists() || file1.mkdir())
  192. return s1 + s + "/";
  193. }
  194. catch(Exception _ex) { }
  195.  
  196. return null;
  197.  
  198. }
  199.  
  200. private static int getuid(String s)
  201. {
  202. try
  203. {
  204. File file = new File(s + "uid.dat");
  205. if(!file.exists() || file.length() < 4L)
  206. {
  207. DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(s + "uid.dat"));
  208. dataoutputstream.writeInt((int)(5555)); // Pretty sure we can generate a new one sec
  209. dataoutputstream.close();
  210. } // Right
  211. }
  212. catch(Exception _ex) { }
  213. try
  214. {
  215. DataInputStream datainputstream = new DataInputStream(new FileInputStream(s + "uid.dat"));
  216. int i = datainputstream.readInt();
  217. datainputstream.close();
  218. return i + 1;
  219. }
  220. catch(Exception _ex)
  221. {
  222. return 0;
  223. }
  224. }
  225.  
  226. public static synchronized Socket opensocket(int i)
  227. throws IOException
  228. {
  229. for(socketreq = i; socketreq != 0;)
  230. try
  231. {
  232. Thread.sleep(50L);
  233. }
  234. catch(Exception _ex) { }
  235.  
  236. if(socket == null)
  237. throw new IOException("could not open socket");
  238. else
  239. return socket;
  240. }
  241.  
  242. public static synchronized DataInputStream openurl(String s)
  243. throws IOException
  244. {
  245. for(urlreq = s; urlreq != null;)
  246. try
  247. {
  248. Thread.sleep(50L);
  249. }
  250. catch(Exception _ex) { }
  251.  
  252. if(urlstream == null)
  253. throw new IOException("could not open: " + s);
  254. else
  255. return urlstream;
  256. }
  257.  
  258. public static synchronized void dnslookup(String s)
  259. {
  260. dns = s;
  261. dnsreq = s;
  262. }
  263.  
  264. public static synchronized void startthread(Runnable runnable, int i)
  265. {
  266. threadreqpri = i;
  267. threadreq = runnable;
  268. }
  269.  
  270. public static synchronized boolean wavesave(byte abyte0[], int i)
  271. {
  272. if(i > 0x1e8480)
  273. return false;
  274. if(savereq != null)
  275. {
  276. return false;
  277. } else
  278. {
  279. wavepos = (wavepos + 1) % 5;
  280. savelen = i;
  281. savebuf = abyte0;
  282. waveplay = true;
  283. savereq = "sound" + wavepos + ".wav";
  284. return true;
  285. }
  286. }
  287.  
  288. public static synchronized boolean wavereplay()
  289. {
  290. if(savereq != null)
  291. {
  292. return false;
  293. } else
  294. {
  295. savebuf = null;
  296. waveplay = true;
  297. savereq = "sound" + wavepos + ".wav";
  298. return true;
  299. }
  300. }
  301.  
  302. public static synchronized void midisave(byte abyte0[], int i)
  303. {
  304. if(i > 0x1e8480)
  305. return;
  306. if(savereq != null)
  307. {
  308. } else
  309. {
  310. midipos = (midipos + 1) % 5;
  311. savelen = i;
  312. savebuf = abyte0;
  313. midiplay = true;
  314. savereq = "jingle" + midipos + ".mid";
  315. }
  316. }
  317.  
  318. public static void reporterror(String s)
  319. {
  320. System.out.println("Error: " + s);
  321. }
  322.  
  323. private signlink()
  324. {
  325. }
  326.  
  327. public static final int clientversion = 317;
  328. public static int uid;
  329. public static int storeid = 32;
  330. public static RandomAccessFile cache_dat = null;
  331. public static final RandomAccessFile[] cache_idx = new RandomAccessFile[5];
  332. public static boolean sunjava;
  333. public static Applet mainapp = null;
  334. private static boolean active;
  335. private static int threadliveid;
  336. private static InetAddress socketip;
  337. private static int socketreq;
  338. private static Socket socket = null;
  339. private static int threadreqpri = 1;
  340. private static Runnable threadreq = null;
  341. private static String dnsreq = null;
  342. public static String dns = null;
  343. private static String urlreq = null;
  344. private static DataInputStream urlstream = null;
  345. private static int savelen;
  346. private static String savereq = null;
  347. private static byte[] savebuf = null;
  348. private static boolean midiplay;
  349. private static int midipos;
  350. public static String midi = null;
  351. public static int midivol;
  352. public static int midifade;
  353. private static boolean waveplay;
  354. private static int wavepos;
  355. public static int wavevol;
  356. public static boolean reporterror = true;
  357. public static String errorname = "";
  358.  
  359. }
Advertisement
Add Comment
Please, Sign In to add comment