java.rmi.server.UID Java Examples
The following examples show how to use
java.rmi.server.UID.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RMIRefServer.java From JNDI-Injection-Exploit with MIT License | 6 votes |
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out ) throws Exception { System.out.println(getLocalTime() + " [RMISERVER] >> Reading message..."); int op = in.read(); switch ( op ) { case TransportConstants.Call: // service incoming RMI call doCall(in, out); break; case TransportConstants.Ping: // send ack for ping out.writeByte(TransportConstants.PingAck); break; case TransportConstants.DGCAck: UID.read(in); break; default: throw new IOException(getLocalTime() + " [RMISERVER] >> unknown transport op " + op); } s.close(); }
Example #2
Source File: JRMPListener.java From ysoserial with MIT License | 6 votes |
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception { System.err.println("Reading message..."); int op = in.read(); switch ( op ) { case TransportConstants.Call: // service incoming RMI call doCall(in, out, payload); break; case TransportConstants.Ping: // send ack for ping out.writeByte(TransportConstants.PingAck); break; case TransportConstants.DGCAck: UID u = UID.read(in); break; default: throw new IOException("unknown transport op " + op); } s.close(); }
Example #3
Source File: JRMPListener.java From ysoserial-modified with MIT License | 6 votes |
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception { System.err.println("Reading message..."); int op = in.read(); switch ( op ) { case TransportConstants.Call: // service incoming RMI call doCall(in, out, payload); break; case TransportConstants.Ping: // send ack for ping out.writeByte(TransportConstants.PingAck); break; case TransportConstants.DGCAck: UID u = UID.read(in); break; default: throw new IOException("unknown transport op " + op); } s.close(); }
Example #4
Source File: RMIRefServer.java From marshalsec with MIT License | 6 votes |
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out ) throws Exception { System.err.println("Reading message..."); int op = in.read(); switch ( op ) { case TransportConstants.Call: // service incoming RMI call doCall(in, out); break; case TransportConstants.Ping: // send ack for ping out.writeByte(TransportConstants.PingAck); break; case TransportConstants.DGCAck: UID.read(in); break; default: throw new IOException("unknown transport op " + op); } s.close(); }
Example #5
Source File: DGCAckHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Causes the DGCAckHandler associated with the specified UID to * release its references. **/ public static void received(UID id) { DGCAckHandler h = idTable.remove(id); if (h != null) { h.release(); } }
Example #6
Source File: DGCImpl_Stub.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * ObjectInputFilter to filter DGCClient return value (a Lease). * The list of acceptable classes is very short and explicit. * The depth and array sizes are limited. * <p> * The filter must accept normal and exception returns. * A DGC server may throw exceptions that may have a cause * and suppressed exceptions. * * @param filterInfo access to class, arrayLength, etc. * @return {@link ObjectInputFilter.Status#ALLOWED} if allowed, * {@link ObjectInputFilter.Status#REJECTED} if rejected, * otherwise {@link ObjectInputFilter.Status#UNDECIDED} */ private static ObjectInputFilter.Status leaseFilter(ObjectInputFilter.FilterInfo filterInfo) { if (filterInfo.depth() > DGCCLIENT_MAX_DEPTH) { return ObjectInputFilter.Status.REJECTED; } Class<?> clazz = filterInfo.serialClass(); if (clazz != null) { while (clazz.isArray()) { if (filterInfo.arrayLength() >= 0 && filterInfo.arrayLength() > DGCCLIENT_MAX_ARRAY_SIZE) { return ObjectInputFilter.Status.REJECTED; } // Arrays are allowed depending on the component type clazz = clazz.getComponentType(); } if (clazz.isPrimitive()) { // Arrays of primitives are allowed return ObjectInputFilter.Status.ALLOWED; } return (clazz == UID.class || clazz == VMID.class || clazz == Lease.class || (Throwable.class.isAssignableFrom(clazz) && clazz.getClassLoader() == Object.class.getClassLoader()) || clazz == StackTraceElement.class || clazz == ArrayList.class || // for suppressed exceptions, if any clazz == Object.class || clazz.getName().equals("java.util.Collections$UnmodifiableList") || clazz.getName().equals("java.util.Collections$UnmodifiableCollection") || clazz.getName().equals("java.util.Collections$UnmodifiableRandomAccessList")) ? ObjectInputFilter.Status.ALLOWED : ObjectInputFilter.Status.REJECTED; } // Not a class, not size limited return ObjectInputFilter.Status.UNDECIDED; }
Example #7
Source File: DGCAckHandler.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Causes the DGCAckHandler associated with the specified UID to * release its references. **/ public static void received(UID id) { DGCAckHandler h = idTable.remove(id); if (h != null) { h.release(); } }
Example #8
Source File: ConnectionOutputStream.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Constructs an marshal output stream using the underlying * stream associated with the connection, the parameter c. * @param c is the Connection object associated with the * ConnectionOutputStream object being constructed * @param resultStream indicates whether this stream is used * to marshal return results */ ConnectionOutputStream(Connection conn, boolean resultStream) throws IOException { super(conn.getOutputStream()); this.conn = conn; this.resultStream = resultStream; ackID = resultStream ? new UID() : null; }
Example #9
Source File: DGCAckHandler.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Causes the DGCAckHandler associated with the specified UID to * release its references. **/ public static void received(UID id) { DGCAckHandler h = idTable.remove(id); if (h != null) { h.release(); } }
Example #10
Source File: ConnectionOutputStream.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Constructs an marshal output stream using the underlying * stream associated with the connection, the parameter c. * @param c is the Connection object associated with the * ConnectionOutputStream object being constructed * @param resultStream indicates whether this stream is used * to marshal return results */ ConnectionOutputStream(Connection conn, boolean resultStream) throws IOException { super(conn.getOutputStream()); this.conn = conn; this.resultStream = resultStream; ackID = resultStream ? new UID() : null; }
Example #11
Source File: ConnectionOutputStream.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Constructs an marshal output stream using the underlying * stream associated with the connection, the parameter c. * @param c is the Connection object associated with the * ConnectionOutputStream object being constructed * @param resultStream indicates whether this stream is used * to marshal return results */ ConnectionOutputStream(Connection conn, boolean resultStream) throws IOException { super(conn.getOutputStream()); this.conn = conn; this.resultStream = resultStream; ackID = resultStream ? new UID() : null; }
Example #12
Source File: ConnectionOutputStream.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Constructs an marshal output stream using the underlying * stream associated with the connection, the parameter c. * @param c is the Connection object associated with the * ConnectionOutputStream object being constructed * @param resultStream indicates whether this stream is used * to marshal return results */ ConnectionOutputStream(Connection conn, boolean resultStream) throws IOException { super(conn.getOutputStream()); this.conn = conn; this.resultStream = resultStream; ackID = resultStream ? new UID() : null; }
Example #13
Source File: ConnectionOutputStream.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Constructs an marshal output stream using the underlying * stream associated with the connection, the parameter c. * @param c is the Connection object associated with the * ConnectionOutputStream object being constructed * @param resultStream indicates whether this stream is used * to marshal return results */ ConnectionOutputStream(Connection conn, boolean resultStream) throws IOException { super(conn.getOutputStream()); this.conn = conn; this.resultStream = resultStream; ackID = resultStream ? new UID() : null; }
Example #14
Source File: DGCImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * ObjectInputFilter to filter DGC input objects. * The list of acceptable classes is very short and explicit. * The depth and array sizes are limited. * * @param filterInfo access to class, arrayLength, etc. * @return {@link ObjectInputFilter.Status#ALLOWED} if allowed, * {@link ObjectInputFilter.Status#REJECTED} if rejected, * otherwise {@link ObjectInputFilter.Status#UNDECIDED} */ private static ObjectInputFilter.Status checkInput(ObjectInputFilter.FilterInfo filterInfo) { if (dgcFilter != null) { ObjectInputFilter.Status status = dgcFilter.checkInput(filterInfo); if (status != ObjectInputFilter.Status.UNDECIDED) { // The DGC filter can override the built-in white-list return status; } } if (filterInfo.depth() > DGC_MAX_DEPTH) { return ObjectInputFilter.Status.REJECTED; } Class<?> clazz = filterInfo.serialClass(); if (clazz != null) { while (clazz.isArray()) { if (filterInfo.arrayLength() >= 0 && filterInfo.arrayLength() > DGC_MAX_ARRAY_SIZE) { return ObjectInputFilter.Status.REJECTED; } // Arrays are allowed depending on the component type clazz = clazz.getComponentType(); } if (clazz.isPrimitive()) { // Arrays of primitives are allowed return ObjectInputFilter.Status.ALLOWED; } return (clazz == ObjID.class || clazz == UID.class || clazz == VMID.class || clazz == Lease.class) ? ObjectInputFilter.Status.ALLOWED : ObjectInputFilter.Status.REJECTED; } // Not a class, not size limited return ObjectInputFilter.Status.UNDECIDED; }
Example #15
Source File: FileNameFormatter.java From suro with Apache License 2.0 | 5 votes |
/** * * @param dir directory path where the files are written * @return full file path with the directory suffixed */ public static String get(String dir) { StringBuilder sb = new StringBuilder(dir); if (!dir.endsWith("/")) { sb.append('/'); } sb.append(fmt.print(new DateTime())) .append(localHostAddr) .append(new UID().toString()); return sb.toString().replaceAll("[-:]", ""); }
Example #16
Source File: DGCImpl_Stub.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * ObjectInputFilter to filter DGCClient return value (a Lease). * The list of acceptable classes is very short and explicit. * The depth and array sizes are limited. * * @param filterInfo access to class, arrayLength, etc. * @return {@link ObjectInputFilter.Status#ALLOWED} if allowed, * {@link ObjectInputFilter.Status#REJECTED} if rejected, * otherwise {@link ObjectInputFilter.Status#UNDECIDED} */ private static ObjectInputFilter.Status leaseFilter(ObjectInputFilter.FilterInfo filterInfo) { if (filterInfo.depth() > DGCCLIENT_MAX_DEPTH) { return ObjectInputFilter.Status.REJECTED; } Class<?> clazz = filterInfo.serialClass(); if (clazz != null) { while (clazz.isArray()) { if (filterInfo.arrayLength() >= 0 && filterInfo.arrayLength() > DGCCLIENT_MAX_ARRAY_SIZE) { return ObjectInputFilter.Status.REJECTED; } // Arrays are allowed depending on the component type clazz = clazz.getComponentType(); } if (clazz.isPrimitive()) { // Arrays of primitives are allowed return ObjectInputFilter.Status.ALLOWED; } return (clazz == UID.class || clazz == VMID.class || clazz == Lease.class) ? ObjectInputFilter.Status.ALLOWED : ObjectInputFilter.Status.REJECTED; } // Not a class, not size limited return ObjectInputFilter.Status.UNDECIDED; }
Example #17
Source File: ConnectionOutputStream.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Constructs an marshal output stream using the underlying * stream associated with the connection, the parameter c. * @param c is the Connection object associated with the * ConnectionOutputStream object being constructed * @param resultStream indicates whether this stream is used * to marshal return results */ ConnectionOutputStream(Connection conn, boolean resultStream) throws IOException { super(conn.getOutputStream()); this.conn = conn; this.resultStream = resultStream; ackID = resultStream ? new UID() : null; }
Example #18
Source File: DGCAckHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Causes the DGCAckHandler associated with the specified UID to * release its references. **/ public static void received(UID id) { DGCAckHandler h = idTable.remove(id); if (h != null) { h.release(); } }
Example #19
Source File: DefaultMessageFactory.java From perf-harness with MIT License | 5 votes |
/** * Attempts to use as much system info as possible to create a unique 24 byte identifier for the * given WorkerThread. In default mode it uses the UID class (not the best option!) and it is therefore * advisable to set <code>-id</code> in which case the tool assumes that this id is globally unique within * the test environment and can safely be used to differentiate JVMs. * Currently this is * unique per worker, but is undefined as to wether it returns the same cid from multiple * calls. * @param worker The subject for the correlation id. * @return A 24-byte array * @throws UnknownHostException The local hostname is being used to identify this JVM but could not be looked up * (try using <code>-id</code> to avoid the requirement on hostname. */ protected byte[] makeCorrelIdAsBytes(WorkerThread worker) throws UnknownHostException { String proc_id = Config.parms.getString("id"); byte[] bytes = new byte[24]; if (proc_id != null && proc_id.length() > 0) { // If we have set an ID then use that byte[] b = proc_id.getBytes(); System.arraycopy( b, 0, bytes, 0, b.length>24?24:b.length ); } else { // we have not set an ID, so attempt to create a random one. byte[] addr = InetAddress.getLocalHost().getAddress(); String uid = new UID().toString(); if (uid.length() > (22 - addr.length)) { uid = uid.substring(0, 22 - addr.length); } System.arraycopy(addr, 0, bytes, 0, addr.length); System.arraycopy(uid.toString().getBytes(), 0, bytes, addr.length, uid.length()); } // Add on the the thread id int threadInt = worker.getThreadNum(); byte[] threadBytes = String.valueOf(threadInt).getBytes(); System.arraycopy(threadBytes, 0, bytes, (24 - threadBytes.length), threadBytes.length); return bytes; }
Example #20
Source File: DGCImpl_Stub.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * ObjectInputFilter to filter DGCClient return value (a Lease). * The list of acceptable classes is very short and explicit. * The depth and array sizes are limited. * * @param filterInfo access to class, arrayLength, etc. * @return {@link ObjectInputFilter.Status#ALLOWED} if allowed, * {@link ObjectInputFilter.Status#REJECTED} if rejected, * otherwise {@link ObjectInputFilter.Status#UNDECIDED} */ private static ObjectInputFilter.Status leaseFilter(ObjectInputFilter.FilterInfo filterInfo) { if (filterInfo.depth() > DGCCLIENT_MAX_DEPTH) { return ObjectInputFilter.Status.REJECTED; } Class<?> clazz = filterInfo.serialClass(); if (clazz != null) { while (clazz.isArray()) { if (filterInfo.arrayLength() >= 0 && filterInfo.arrayLength() > DGCCLIENT_MAX_ARRAY_SIZE) { return ObjectInputFilter.Status.REJECTED; } // Arrays are allowed depending on the component type clazz = clazz.getComponentType(); } if (clazz.isPrimitive()) { // Arrays of primitives are allowed return ObjectInputFilter.Status.ALLOWED; } return (clazz == UID.class || clazz == VMID.class || clazz == Lease.class) ? ObjectInputFilter.Status.ALLOWED : ObjectInputFilter.Status.REJECTED; } // Not a class, not size limited return ObjectInputFilter.Status.UNDECIDED; }
Example #21
Source File: AbstractJMSProvider.java From perf-harness with MIT License | 5 votes |
protected String createDurableConnectionId(String uniqueID) { String durableConnectionId; // Note proc_id is not set unless -id n passed on cmdline String proc_id = Config.parms.getString("id"); if ( uniqueID!=null && proc_id!=null && proc_id.length()>0 ) { // This presumes that if you have given -id to this JVM // you have given a UNIQUE -id to ALL subscriber JVMs durableConnectionId = proc_id+"_"+uniqueID; } else { // If no -id then get a random ID ( UID() is crap at // this, but better than nothing ) durableConnectionId = new UID().toString().replaceAll(":", ""); } return durableConnectionId; }
Example #22
Source File: RandomHash.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 5 votes |
/** * Generate a new random md5 hash. * @return a securely-generated random 16 byte sequence. */ public static byte [] generateMD5Bytes() { try { MessageDigest digester = MessageDigest.getInstance("MD5"); long time = System.currentTimeMillis(); digester.update((new UID() + "@" + time).getBytes()); return digester.digest(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
Example #23
Source File: DGCAckHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Causes the DGCAckHandler associated with the specified UID to * release its references. **/ public static void received(UID id) { DGCAckHandler h = idTable.remove(id); if (h != null) { h.release(); } }
Example #24
Source File: DGCAckHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Causes the DGCAckHandler associated with the specified UID to * release its references. **/ public static void received(UID id) { DGCAckHandler h = idTable.remove(id); if (h != null) { h.release(); } }
Example #25
Source File: ConnectionOutputStream.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Constructs an marshal output stream using the underlying * stream associated with the connection, the parameter c. * @param c is the Connection object associated with the * ConnectionOutputStream object being constructed * @param resultStream indicates whether this stream is used * to marshal return results */ ConnectionOutputStream(Connection conn, boolean resultStream) throws IOException { super(conn.getOutputStream()); this.conn = conn; this.resultStream = resultStream; ackID = resultStream ? new UID() : null; }
Example #26
Source File: ConnectionOutputStream.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Constructs an marshal output stream using the underlying * stream associated with the connection, the parameter c. * @param c is the Connection object associated with the * ConnectionOutputStream object being constructed * @param resultStream indicates whether this stream is used * to marshal return results */ ConnectionOutputStream(Connection conn, boolean resultStream) throws IOException { super(conn.getOutputStream()); this.conn = conn; this.resultStream = resultStream; ackID = resultStream ? new UID() : null; }
Example #27
Source File: DGCImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * ObjectInputFilter to filter DGC input objects. * The list of acceptable classes is very short and explicit. * The depth and array sizes are limited. * * @param filterInfo access to class, arrayLength, etc. * @return {@link ObjectInputFilter.Status#ALLOWED} if allowed, * {@link ObjectInputFilter.Status#REJECTED} if rejected, * otherwise {@link ObjectInputFilter.Status#UNDECIDED} */ private static ObjectInputFilter.Status checkInput(ObjectInputFilter.FilterInfo filterInfo) { if (dgcFilter != null) { ObjectInputFilter.Status status = dgcFilter.checkInput(filterInfo); if (status != ObjectInputFilter.Status.UNDECIDED) { // The DGC filter can override the built-in white-list return status; } } if (filterInfo.depth() > DGC_MAX_DEPTH) { return ObjectInputFilter.Status.REJECTED; } Class<?> clazz = filterInfo.serialClass(); if (clazz != null) { while (clazz.isArray()) { if (filterInfo.arrayLength() >= 0 && filterInfo.arrayLength() > DGC_MAX_ARRAY_SIZE) { return ObjectInputFilter.Status.REJECTED; } // Arrays are allowed depending on the component type clazz = clazz.getComponentType(); } if (clazz.isPrimitive()) { // Arrays of primitives are allowed return ObjectInputFilter.Status.ALLOWED; } return (clazz == ObjID.class || clazz == UID.class || clazz == VMID.class || clazz == Lease.class) ? ObjectInputFilter.Status.ALLOWED : ObjectInputFilter.Status.REJECTED; } // Not a class, not size limited return ObjectInputFilter.Status.UNDECIDED; }
Example #28
Source File: MacroFormRenderer.java From scipio-erp with Apache License 2.0 | 5 votes |
private void executeMacro(Appendable writer, String macro) throws IOException { // SCIPIO: modified for exception try { Environment environment = getEnvironment(writer); Reader templateReader = new StringReader(macro); Template template = new Template(new UID().toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig()); templateReader.close(); FreeMarkerWorker.includeTemplate(template, environment); // SCIPIO: use FreeMarkerWorker instead of Environment directly } catch (TemplateException | IOException e) { Debug.logError(e, "Error rendering screen thru ftl macro: " + macro, module); handleError(writer, e); // SCIPIO } }
Example #29
Source File: DGCAckHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Causes the DGCAckHandler associated with the specified UID to * release its references. **/ public static void received(UID id) { DGCAckHandler h = idTable.remove(id); if (h != null) { h.release(); } }
Example #30
Source File: DefaultMessageFactory.java From perf-harness with MIT License | 5 votes |
/** * Returns a correlation id constructed from a UID and the name of the targeted workerthread. * @param worker * @throws UnknownHostException The local hostname is being used to identify this JVM but could not be looked up * (try using <code>-id</code> to avoid the requirement on hostname. */ protected String makeCorrelIdAsString(WorkerThread worker) throws UnknownHostException { String proc_id = Config.parms.getString("id"); StringBuffer cid = new StringBuffer(); if (proc_id != null && proc_id.length() > 0) { cid.append(proc_id); } else { cid.append( InetAddress.getLocalHost().toString() ); } cid.append(worker.getName()); cid.append( new UID().toString() ); Log.logger.log(Level.FINEST, "makeCorrelIDAsString: {0}", cid); return cid.toString(); }