Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can Add RunAs function like autoit RunAs/RunAsWait? #22

Open
frocelu opened this issue Aug 3, 2020 · 4 comments
Open

Can Add RunAs function like autoit RunAs/RunAsWait? #22

frocelu opened this issue Aug 3, 2020 · 4 comments

Comments

@frocelu
Copy link

frocelu commented Aug 3, 2020

This project is awesome.I used it on my work. thanks.

Is there a way to RunAs another windows user like this?
https://www.autoitscript.com/autoit3/docs/functions/RunAs.htm

@iamacarpet
Copy link
Owner

Hello @frocelu ,

That is functionality that would be awesome to have, but I'm afraid I don't have time to implement it at the moment, so I'll mark it as "help wanted": if you managed to implement it yourself, please share upstream.

This might help with something I looked into a while ago, which is doing what things like A/V do and having a master process running as "NT AUTH\SYSTEM" that looks for active user sessions and then injects a tray icon / GUI app into them, for the user to see the app is running and provide a point of interaction: there were some guides around online with a rough example of how to do this, but ultimately we didn't need it enough and it was a massive piece of work.

@frocelu
Copy link
Author

frocelu commented Aug 28, 2020

Thanks.
Now I use the func CreateProcessWithLogonW of win32 api in temporary.

If I have the ability to contribute this project I will glad to do.But for now, I still need a lot of works for doing this.
If You have some guides about this function, please give me, thanks.

@iamacarpet
Copy link
Owner

@frocelu well, nice one! I haven’t heard of that library before, it’s useful to see a lot of other Windows API stuff is already implemented there.

I notice the function you referenced requires a user / pass to run as the user, where as there is another function that takes a user session handle (for if the user is already logged in), for the ability to execute in their existing session: this will probably be more useful for my use case listed above.

@iamacarpet
Copy link
Owner

To implement this, we'll first need the ability to create tokens, detailed in #29

CreateProcessWithLogonW doesn't work as "NT AUTH\SYSTEM" and requires a user's full credentials.

Creating a session token, then using CreateProcessAsUser should allow us to become anyone without credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants