Guest User

Untitled

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