Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.33 KB | None | 0 0
  1.  
  2. import java.applet.Applet;
  3. import java.io.*;
  4. import java.net.*;
  5.  
  6. public final class signlink implements Runnable {
  7.  
  8. public static void startpriv(InetAddress inetaddress) {
  9. threadliveid = (int) (Math.random() * 99999999D);
  10. if (active) {
  11. try {
  12. Thread.sleep(500L);
  13. } catch (Exception _ex) {
  14. }
  15. active = false;
  16. }
  17. socketreq = 0;
  18. threadreq = null;
  19. dnsreq = null;
  20. savereq = null;
  21. urlreq = null;
  22. socketip = inetaddress;
  23. Thread thread = new Thread(new signlink());
  24. thread.setDaemon(true);
  25. thread.start();
  26. while (!active) {
  27. try {
  28. Thread.sleep(50L);
  29. } catch (Exception _ex) { }
  30. }
  31. }
  32.  
  33. public void run() {
  34. active = true;
  35. uid = getuid(findcachedir());
  36. try {
  37. cache_dat = new RandomAccessFile(findcachedir() + "main_file_cache.dat", "rw");
  38. for (int j = 0; j < 5; j++) {
  39. cache_idx[j] = new RandomAccessFile(findcachedir() + "main_file_cache.idx" + j, "rw");
  40. }
  41. } catch (Exception exception) {
  42. exception.printStackTrace();
  43. }
  44. for (int i = threadliveid; threadliveid == i;) {
  45. if (socketreq != 0) {
  46. try {
  47. socket = new Socket(socketip, socketreq);
  48. } catch (Exception _ex) {
  49. socket = null;
  50. }
  51. socketreq = 0;
  52. } else if (threadreq != null) {
  53. Thread thread = new Thread(threadreq);
  54. thread.setDaemon(true);
  55. thread.start();
  56. thread.setPriority(threadreqpri);
  57. threadreq = null;
  58. } else if (dnsreq != null) {
  59. try {
  60. dns = InetAddress.getByName(dnsreq).getHostName();
  61. } catch (Exception _ex) {
  62. dns = "unknown";
  63. }
  64. dnsreq = null;
  65. } else if (savereq != null) {
  66. if (savebuf != null)
  67. try {
  68. FileOutputStream fileoutputstream = new FileOutputStream(findcachedir() + savereq);
  69. fileoutputstream.write(savebuf, 0, savelen);
  70. fileoutputstream.close();
  71. } catch (Exception _ex) {
  72. }
  73. if (waveplay) {
  74. waveplay = false;
  75. }
  76. if (midiplay) {
  77. midi = findcachedir() + savereq;
  78. midiplay = false;
  79. }
  80. savereq = null;
  81. } else if (urlreq != null) {
  82. try {
  83. System.out.println("urlstream");
  84. urlstream = new DataInputStream((new URL(mainapp.getCodeBase(), urlreq)).openStream());
  85. } catch (Exception _ex) {
  86. urlstream = null;
  87. }
  88. urlreq = null;
  89. }
  90. try {
  91. Thread.sleep(50L);
  92. } catch (Exception _ex) {
  93. }
  94. }
  95. }
  96.  
  97. public static String findcachedir() {
  98. String as[] = { "C:/" };
  99. if (storeid < 32 || storeid > 34)
  100. storeid = 32;
  101. String s = "OldSkool";
  102. for (int i = 0; i < as.length; i++)
  103. try {
  104. String s1 = as[i];
  105. if (s1.length() > 0) {
  106. File file = new File(s1);
  107. if (!file.exists())
  108. continue;
  109. }
  110. File file1 = new File(s1 + s);
  111. if (file1.exists() || file1.mkdir())
  112. return "./class/Cache/";
  113. } catch (Exception _ex) {
  114. }
  115. return null;
  116. }
  117.  
  118. private static int getuid(String s) {
  119. try {
  120. File file = new File(s + "uid.dat");
  121. if (!file.exists() || file.length() < 4L) {
  122. DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(s + "uid.dat"));
  123. dataoutputstream.writeInt((int) (Math.random() * 99999999D));
  124. dataoutputstream.close();
  125. }
  126. } catch (Exception _ex) { }
  127. try {
  128. DataInputStream datainputstream = new DataInputStream(new FileInputStream(s + "uid.dat"));
  129. int i = datainputstream.readInt();
  130. datainputstream.close();
  131. return i + 1;
  132. } catch (Exception _ex) {
  133. return 0;
  134. }
  135. }
  136.  
  137. public static synchronized Socket opensocket(int i) throws IOException {
  138. for (socketreq = i; socketreq != 0;)
  139. try {
  140. Thread.sleep(50L);
  141. } catch (Exception _ex) {
  142. }
  143.  
  144. if (socket == null)
  145. throw new IOException("could not open socket");
  146. else
  147. return socket;
  148. }
  149.  
  150. public static synchronized DataInputStream openurl(String s) throws IOException {
  151. for (urlreq = s; urlreq != null;)
  152. try {
  153. Thread.sleep(50L);
  154. } catch (Exception _ex) {
  155. }
  156.  
  157. if (urlstream == null)
  158. throw new IOException("could not open: " + s);
  159. else
  160. return urlstream;
  161. }
  162.  
  163. public static synchronized void dnslookup(String s) {
  164. dns = s;
  165. dnsreq = s;
  166. }
  167.  
  168. public static synchronized void startthread(Runnable runnable, int i) {
  169. threadreqpri = i;
  170. threadreq = runnable;
  171. }
  172.  
  173. public static synchronized boolean wavesave(byte abyte0[], int i) {
  174. if (i > 0x1e8480)
  175. return false;
  176. if (savereq != null) {
  177. return false;
  178. } else {
  179. wavepos = (wavepos + 1) % 5;
  180. savelen = i;
  181. savebuf = abyte0;
  182. waveplay = true;
  183. savereq = "sound" + wavepos + ".wav";
  184. return true;
  185. }
  186. }
  187.  
  188. public static synchronized boolean wavereplay() {
  189. if (savereq != null) {
  190. return false;
  191. } else {
  192. savebuf = null;
  193. waveplay = true;
  194. savereq = "sound" + wavepos + ".wav";
  195. return true;
  196. }
  197. }
  198.  
  199. public static synchronized void midisave(byte abyte0[], int i) {
  200. if (i > 0x1e8480)
  201. return;
  202. if (savereq != null) {
  203. } else {
  204. midipos = (midipos + 1) % 5;
  205. savelen = i;
  206. savebuf = abyte0;
  207. midiplay = true;
  208. savereq = "jingle" + midipos + ".mid";
  209. }
  210. }
  211.  
  212. public static void reporterror(String s) {
  213. System.out.println("Error: " + s);
  214. }
  215.  
  216. private signlink() {
  217. }
  218.  
  219. public static final int clientversion = 317;
  220. public static int uid;
  221. public static int storeid = 32;
  222. public static RandomAccessFile cache_dat = null;
  223. public static final RandomAccessFile[] cache_idx = new RandomAccessFile[5];
  224. public static boolean sunjava;
  225. public static Applet mainapp = null;
  226. private static boolean active;
  227. private static int threadliveid;
  228. private static InetAddress socketip;
  229. private static int socketreq;
  230. private static Socket socket = null;
  231. private static int threadreqpri = 1;
  232. private static Runnable threadreq = null;
  233. private static String dnsreq = null;
  234. public static String dns = null;
  235. private static String urlreq = null;
  236. private static DataInputStream urlstream = null;
  237. private static int savelen;
  238. private static String savereq = null;
  239. private static byte[] savebuf = null;
  240. private static boolean midiplay;
  241. private static int midipos;
  242. public static String midi = null;
  243. public static int midivol;
  244. public static int midifade;
  245. private static boolean waveplay;
  246. private static int wavepos;
  247. public static int wavevol;
  248. public static boolean reporterror = true;
  249. public static String errorname = "";
  250. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement