Closed gredwhite closed 1 year ago
jcifs-ng only provides the basics for the MSRPC protocol and SMB transport - as well as some select calls from the SAMR spec to implement specific functions.
GPT clearly is hallucinating.... (or reproducing someone else's code) welcome to the future....
So you would have to implement the necessary RPCs yourself. I'd strongly suggest using LDAP to create users instead, much less painful.
jcifs-ng only provides the basics for the MSRPC protocol and SMB transport - as well as some select calls from the SAMR spec to implement specific functions.
GPT clearly is hallucinating.... (or reproducing someone else's code) welcome to the future....
So you would have to implement the necessary RPCs yourself. I'd strongly suggest using LDAP to create users instead, much less painful.
First of all I would like to say thank you for your answer!
Highly likely that we will use LDAP instead but we would like to have an estimate for implementation of SAMR protocol for user creation. I don't have expirience in any protocol implementation so could you please provide some high level pieces of advice to start from just to give me high-level understanding of the effort.
Why does library has a partial support of SAMR ? Could it be used somehow by the libraries clients?
Because you take a part in development of jcif-ng library you might know some knowledge about similar libraries. Are there any other java libraries which can support it (user creation using SAMR protocol) ?
You'd have to put together the DCERPC/MSPRC encoding/decoding of the necessary messages like in https://github.com/AgNO3/jcifs-ng/blob/master/src/main/java/jcifs/dcerpc/msrpc/samr.java, then you could just send them as in the existing uses. There is some legacy jcifs IDL to java compiler somewhere, but that never worked for me. Putting these things together by hand, from my experience, is no fun at all.
There are some functions provided to resolve group memberships that use SAMR RPCs, even though I'm not sure anybody even uses them.
I don't believe there is an alternerative Java implementation for MSRPC (at least via SMB, but probably also otherwise) out there. There is SMBJ, but I don't see any RPC support in there.
Well... looks like it is painful to use SAMR from java nowadays. And looks like almost noone does it. It is because there are no advantages in SAMR in comparison with quite popular LDAP. Correct ?
You'd have to put together the DCERPC/MSPRC encoding/decoding of the necessary messages like in https://github.com/AgNO3/jcifs-ng/blob/master/src/main/java/jcifs/dcerpc/msrpc/samr.java, then you could just send them as in the existing uses. There is some legacy jcifs IDL to java compiler somewhere, but that never worked for me. Putting these things together by hand, from my experience, is no fun at all.
As I can see there are 2 files: samr.java and samr.iml.
@Generated ( "midlc" )
@SuppressWarnings ( "all" )
public class samr {
Looks like samr.java is generated based on samr.iml but even contributor didn't have successful experience with that staff. Another option is manual implementaion of samr.java taking existing methods as an example.
then you could just send them as in the existing uses
Where can I find existing uses ?
I don't believe there are advantages using SAMR, that may even be a relict of the pre-AD days.
shows the currently existing usage of SAMR services.
I have local Samba server. I start it using docker-compose file.
I want to implement a java program to create a new user in Sambe. SAMR protocol is suitable for this https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/d0360910-33dd-4e3c-b5a2-26daf95f5ffa
In that library (jcifs-ng) there are some classes/files which contain
samr
as a part of the name. All of them are located in that package: https://github.com/AgNO3/jcifs-ng/tree/master/src/main/java/jcifs/dcerpc/msrpcBut I can't find any example of usage such classes.
Also I asked chatGpt to help me and it returned me the following code:
But I can't find SamrUser, SamrDomain classes in any jcif library
Could you please provide working example of program creating the user ?