Guest User

Untitled

a guest
Oct 29th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.59 KB | None | 0 0
  1. /*
  2. JAVA GOT ME STONED; CLIENT - JGMS.
  3. CURRENT VERSION; 1.5.2.0
  4. CREATED BY JAVA GOT ME STONED OF RUNE-SERVER.
  5. FILE: FINDER.
  6. */
  7.  
  8. package sign;
  9.  
  10. import java.applet.Applet;
  11. import java.io.*;
  12. import java.net.*;
  13. import javax.sound.midi.*;
  14. import javax.sound.sampled.*;
  15.  
  16. public final class signlink
  17. implements Runnable
  18. {
  19.  
  20. public int waveTimer1, waveTimer2 = 0;
  21.  
  22. public static final void startpriv(InetAddress inetaddress)
  23. {
  24. threadliveid = (int)(Math.random() * 99999999D);
  25. if(active)
  26. {
  27. try
  28. {
  29. Thread.sleep(500L);
  30. }
  31. catch(Exception _ex) { }
  32. active = false;
  33. }
  34. socketreq = 0;
  35. threadreq = null;
  36. dnsreq = null;
  37. savereqmidi = null;
  38. urlreq = null;
  39. socketip = inetaddress;
  40. Thread thread = new Thread(new signlink());
  41. thread.setDaemon(true);
  42. thread.start();
  43. while(!active)
  44. try
  45. {
  46. Thread.sleep(50L);
  47. }
  48. catch(Exception _ex) { }
  49. }
  50.  
  51. enum Position {
  52. LEFT, RIGHT, NORMAL
  53. };
  54. private final int EXTERNAL_BUFFER_SIZE = 524288; // 128Kb
  55. private Position curPosition;
  56.  
  57. public final void run()
  58. {
  59. active = true;
  60. String s = findcachedir();
  61. uid = getuid(s);
  62. try
  63. {
  64. File file = new File(s + "main_file_cache.dat");
  65. if(file.exists() && file.length() > 0x3200000L)
  66. file.delete();
  67. cache_dat = new RandomAccessFile(s + "main_file_cache.dat", "rw");
  68. for(int j = 0; j < 5; j++)
  69. cache_idx[j] = new RandomAccessFile(s + "main_file_cache.idx" + j, "rw");
  70.  
  71. }
  72. catch(Exception exception)
  73. {
  74. exception.printStackTrace();
  75. }
  76. for(int i = threadliveid; threadliveid == i;)
  77. {
  78. if(socketreq != 0)
  79. {
  80. try
  81. {
  82. socket = new Socket(socketip, socketreq);
  83. }
  84. catch(Exception _ex)
  85. {
  86. socket = null;
  87. }
  88. socketreq = 0;
  89. } else
  90. if(threadreq != null)
  91. {
  92. Thread thread = new Thread(threadreq);
  93. thread.setDaemon(true);
  94. thread.start();
  95. thread.setPriority(threadreqpri);
  96. threadreq = null;
  97. } else
  98. if(dnsreq != null)
  99. {
  100. try
  101. {
  102. dns = InetAddress.getByName(dnsreq).getHostName();
  103. }
  104. catch(Exception _ex)
  105. {
  106. dns = "unknown";
  107. }
  108. dnsreq = null;
  109. } else
  110. for(int j = 1; j <= 10; j++) {
  111. if(waveplay[j])
  112. {
  113. if(savereq[j] != null) {
  114. playSound(s,savereq[j], j);
  115. } else { waveplay[j] = false; }
  116. }
  117. }
  118. if(midiplay)
  119. {
  120. playMidi(s);
  121. midiplay = false;
  122. savereqmidi = null;
  123. } else
  124. if(urlreq != null)
  125. {
  126. try
  127. {
  128. urlstream = new DataInputStream((new URL(mainapp.getCodeBase(), urlreq)).openStream());
  129. }
  130. catch(Exception _ex)
  131. {
  132. urlstream = null;
  133. }
  134. urlreq = null;
  135. }
  136. try
  137. {
  138. Thread.sleep(50L);
  139. }
  140. catch(Exception _ex) { }
  141. }
  142.  
  143. }
  144.  
  145. public static Sequencer musicSr = null;
  146. public static Sequence musicS = null;
  147.  
  148. public static final String findcachedir()
  149. {
  150. try
  151. {
  152. String s = "evolved_cache_32";
  153. File file = new File(s);
  154. if(file.exists() || file.mkdir())
  155. return s + "/";
  156. }
  157. catch(Exception _ex) { }
  158.  
  159. return null;
  160. }
  161.  
  162. private static final int getuid(String s)
  163. {
  164. return 13131313; //(int)(Math.random() * 99999999D);
  165. }
  166.  
  167. public static final synchronized Socket opensocket(int i)
  168. throws IOException
  169. {
  170. for(socketreq = i; socketreq != 0;)
  171. try
  172. {
  173. Thread.sleep(50L);
  174. }
  175. catch(Exception _ex) { }
  176.  
  177. if(socket == null)
  178. throw new IOException("could not open socket");
  179. else
  180. return socket;
  181. }
  182.  
  183. public static final synchronized DataInputStream openurl(String s)
  184. throws IOException
  185. {
  186. for(urlreq = s; urlreq != null;)
  187. try
  188. {
  189. Thread.sleep(50L);
  190. }
  191. catch(Exception _ex) { }
  192.  
  193. if(urlstream == null)
  194. throw new IOException("could not open: " + s);
  195. else
  196. return urlstream;
  197. }
  198.  
  199. public static final synchronized void dnslookup(String s)
  200. {
  201. dns = s;
  202. dnsreq = s;
  203. }
  204.  
  205. public static final synchronized void startthread(Runnable runnable, int i)
  206. {
  207. threadreqpri = i;
  208. threadreq = runnable;
  209. }
  210.  
  211. public static final synchronized boolean wavesave(byte abyte0[], int i, int j)
  212. {
  213. String s = findcachedir();
  214. String savereqwave;
  215. byte savebufwave[];
  216. int savelenwave;
  217. int waveposwave = 1;
  218. if(i > 0x1e8480) {
  219. return false;
  220. }
  221. waveposwave = (waveposwave) % 15;
  222. savelenwave = i;
  223. savebufwave = abyte0;
  224. waveplay[j] = true;
  225. savereqwave = "sound" + waveposwave + ".wav";
  226. savereq[j] = savereqwave;
  227. saveSound(s,savereqwave,savebufwave,savelenwave);
  228. return true;
  229. }
  230.  
  231. public static final synchronized boolean wavereplay(int j)
  232. {
  233. int waveposwave = 1;
  234. waveposwave = (waveposwave) % 15;
  235. waveplay[j] = true;
  236. savereq[j] = "sound" + waveposwave + ".wav";
  237. return true;
  238. }
  239.  
  240. public static final synchronized void midisave(byte abyte0[], int i)
  241. {
  242. if(i > 0x1e8480)
  243. return;
  244. if(savereqmidi != null)
  245. {
  246. return;
  247. } else
  248. {
  249. midipos = (midipos + 1) % 5;
  250. savelenmidi = i;
  251. savebufmidi = abyte0;
  252. midiplay = false;
  253. savereqmidi = "Mission-Impossible.mid";
  254. return;
  255. }
  256. }
  257.  
  258. public static void saveSound(String swave, String savereqwave, byte savebufwave[], int savelenwave) {
  259. try
  260. {
  261. FileOutputStream fileoutputstream = new FileOutputStream(swave + savereqwave);
  262. fileoutputstream.write(savebufwave, 0, savelenwave);
  263. fileoutputstream.close();
  264. }
  265. catch(Exception _ex) { }
  266. }
  267.  
  268. public static boolean playSound(String swave, String savereqwave, int j) {
  269. //SoundTimer = 3;
  270. String[] wave = new String [10];
  271. String[] savereqwave2 = new String[10];
  272. savereqwave2[j] = savereqwave;
  273. if(savereqwave2[j] != null)
  274. {
  275. wave[j] = swave + savereqwave2[j];
  276.  
  277. AudioInputStream[] audioInputStream = new AudioInputStream[10];
  278. try {
  279. audioInputStream[j] = AudioSystem.getAudioInputStream(new File(wave[j]));
  280. } catch (UnsupportedAudioFileException e1) {
  281. e1.printStackTrace();
  282. return false;
  283. } catch (IOException e1) {
  284. e1.printStackTrace();
  285. return false;
  286. }
  287. AudioFormat[] format = new AudioFormat[10];
  288. format[j] = audioInputStream[j].getFormat();
  289. SourceDataLine[] auline = new SourceDataLine[10];
  290. DataLine.Info info = new DataLine.Info(SourceDataLine.class, format[j]);
  291.  
  292. try {
  293. auline[j] = (SourceDataLine) AudioSystem.getLine(info);
  294. auline[j].open(format[j]);
  295. } catch (LineUnavailableException e) {
  296. e.printStackTrace();
  297. return false;
  298. } catch (Exception e) {
  299. e.printStackTrace();
  300. return false;
  301. }
  302.  
  303. auline[j].start();
  304. int nBytesRead[] = new int [10];
  305. byte[] abData[] = new byte[5200][10];
  306.  
  307. try {
  308. while (nBytesRead[j] != -1) {
  309. nBytesRead[j] = audioInputStream[j].read(abData[j], 0, abData[j].length);
  310. if (nBytesRead[j] >= 0)
  311. auline[j].write(abData[j], 0, nBytesRead[j]);
  312. }
  313. } catch (IOException e) {
  314. e.printStackTrace();
  315. return false;
  316. } finally {
  317. auline[j].drain();
  318. auline[j].close();
  319. }
  320. }
  321. try
  322. {
  323. Thread.sleep(500L);
  324. }
  325. catch(Exception _ex) { }
  326. waveplay[j] = false;
  327. return true;
  328. }
  329.  
  330. public static boolean playMidi(String s) {
  331. midi = s + savereqmidi;
  332. try {
  333. if (musicSr != null)
  334. {
  335. musicSr.stop();
  336. musicSr.close();
  337. }
  338. musicSr = null;
  339. musicS = null;
  340.  
  341. File music = new File(midi);
  342. if(music.exists())
  343. {
  344. musicS = MidiSystem.getSequence(music);
  345. }
  346.  
  347. // Create a sequencer for the sequence
  348. musicSr = MidiSystem.getSequencer();
  349. musicSr.open();
  350. musicSr.setSequence(musicS);
  351. musicSr.setLoopCount(musicSr.LOOP_CONTINUOUSLY);
  352. musicSr.start();
  353.  
  354. } catch (Exception ex) {
  355. ex.printStackTrace();
  356. }
  357. return true;
  358. }
  359.  
  360.  
  361.  
  362. public static final void reporterror(String s)
  363. {
  364. if(!reporterror)
  365. return;
  366. if(!active)
  367. return;
  368. System.out.println("Error: " + s);
  369. try
  370. {
  371. s = s.replace(':', '_');
  372. s = s.replace('@', '_');
  373. s = s.replace('&', '_');
  374. s = s.replace('#', '_');
  375. DataInputStream datainputstream = openurl("reporterror" + 317 + ".cgi?error=" + errorname + " " + s);
  376. datainputstream.readLine();
  377. datainputstream.close();
  378. return;
  379. }
  380. catch(IOException _ex)
  381. {
  382. return;
  383. }
  384. }
  385.  
  386. public signlink()
  387. {
  388. }
  389. public int WaveNumber = 1;
  390. private static final int clientversion = 317;
  391. public static int uid;
  392. public static int storeid = 32;
  393. public static RandomAccessFile cache_dat = null;
  394. public static RandomAccessFile cache_idx[] = new RandomAccessFile[5];
  395. public static boolean sunjava;
  396. public static Applet mainapp = null;
  397. private static boolean active;
  398. private static int threadliveid;
  399. private static InetAddress socketip;
  400. private static int socketreq;
  401. private static Socket socket = null;
  402. private static int threadreqpri = 1;
  403. private static Runnable threadreq = null;
  404. private static String dnsreq = null;
  405. public static String dns = null;
  406. private static String urlreq = null;
  407. public static DataInputStream urlstream = null;
  408. public static int savelenmidi;
  409. public static String[] savereq = new String[11];
  410. public static String savereqmidi = null;
  411. public static byte savebufmidi[] = null;
  412. public static boolean midiplay;
  413. public static int midipos;
  414. public static String midi = null;
  415. public static int midivol;
  416. public static int midifade;
  417. public static boolean[] waveplay = new boolean[11];
  418. public static int wavevol;
  419. public static boolean music = true;
  420. public static boolean reporterror = true;
  421. public static String errorname = "";
  422. }
Advertisement
Add Comment
Please, Sign In to add comment