Advertisement
Guest User

signlink.java

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