Advertisement
Guest User

Untitled

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