Startup Error with NetUserGetLocalGroups RC5

This is where you report any issues if you are running a beta version of EventGhost
Forum rules
To submit a possible bug report please follow this template

Version: 0.5 beta 2 (the version you are running)
Traceback: Traceback (most recent call last):
File "<SOME_EVENTGHOST_FILE.py>", line 10, in <module>
SOME_FUNCTION()
File "<SOME_EVENTGHOST_FILE.py>", line 4, in SOME_EVENTGHOST_MODULE
SOME_FUNCTION()

copy and past any traceback information from the log if there is no traceback put NONE

Event:
Main.test.0.1.2.3.4.5.6.7.8
1
2

in the Event field you will want to put the event that was triggered just prior to the traceback occurring, if there is personal data put PERSONAL DATA if there was no traceback or no event triggered right before the traceback put NO EVENT

Description: if you have the ability to replicate the issue then put in here a description of what you are doing to create the problem.

Screen Shots: screen shots of the error and any events/macros/acrions that were run before the issue or screen shots of the problem

Files: any files that may be used to isolate where the issue is. something like the log.txt file would go here

if you provide the above information before hand it will greatly speed up the diagnostic process. we will not have to ask for the bits and pieces. And also having a well formatted Bug Report filled out will get answered sooner then the ones that aren't
Post Reply
eatmeimadanish
Experienced User
Posts: 116
Joined: Thu Oct 01, 2009 5:11 pm

Startup Error with NetUserGetLocalGroups RC5

Post by eatmeimadanish » Thu Nov 29, 2018 4:03 pm

Version: 0.5.0-rc2
Unhandled exception in WorkerThread <EventThread>:
Callers stack:
File "wx\_core.pyc", line 8657, in MainLoop
File "wx\_core.pyc", line 7952, in MainLoop
File "wx\_core.pyc", line 16766, in <lambda>
Traceback (most recent call last) (0.5.0-rc5):
File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 253, in __DoOneEvent
self.HandleAction(action)
File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 140, in HandleAction
action()
File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 324, in __call__
self.returnValue = self.func(*self.args, **self.kwargs)
File "C:\Program Files (x86)\EventGhost\eg\Classes\EventThread.py", line 75, in StartSession
actionThread.Func(actionThread.StartSession, 120)(filename)
File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 324, in __call__
self.returnValue = self.func(*self.args, **self.kwargs)
File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionThread.py", line 107, in StartSession
IsLocalAdmin=User.IsLocalAdmin(),
File "C:\Program Files (x86)\EventGhost\eg\WinApi\User.py", line 80, in IsLocalAdmin
return 'Administrators' in Groups()
File "C:\Program Files (x86)\EventGhost\eg\WinApi\User.py", line 61, in Groups
return win32net.NetUserGetLocalGroups(server, user_name)
error: (2221, 'NetUserGetLocalGroups', 'The user name could not be found.')

Event:
The system generates no events since it fails to fully load.

User avatar
kgschlosser
Site Admin
Posts: 4313
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Startup Error with NetUserGetLocalGroups RC5

Post by kgschlosser » Fri Nov 30, 2018 6:10 am

it seems as tho there is an issue with your user account. can you try logging in with a different username and then run EG???
If you like the work I have been doing then feel free to Image

eatmeimadanish
Experienced User
Posts: 116
Joined: Thu Oct 01, 2009 5:11 pm

Re: Startup Error with NetUserGetLocalGroups RC5

Post by eatmeimadanish » Tue Dec 04, 2018 8:55 pm

This does not happen in RC4. I am logged in under my domain account, I tried other accounts and they do the same thing. It could be a group policy that blocks this kind of access, not sure. Either way, this error should be trapped and the new option skipped if it fails.

Pretty sure this is related to identifying the user account and creating an event that was added in RC5.

User avatar
kgschlosser
Site Admin
Posts: 4313
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Startup Error with NetUserGetLocalGroups RC5

Post by kgschlosser » Wed Dec 05, 2018 12:03 am

we added a new feature to 0.5rc5 what it does it simply gets the user name from windows and check the groups for the user to see if one of them is Administrators.

That's it. So I am not sure what could be mucking up the works with it. I am logged into a domain as well and do not have this issue.

I can't think of anything offhand that would stop a user from checking the groups that actual user is in. I can't think of any kind of a GPO or Security parameter that would stop that. Now granted You can be stopped from opening up MMC or the users and groups applet. But you should always be able to check your own permissions.

I am gathering your are running Active Directory as well if you are logging into a domain. Is this a work PC? or do you have a PDC setup at your house? if it is the latter then I would assume that you have some sort of an administrative account. does it do the same thing with that account as well??

If EG is being used in a business environment that becomes a big snafu. I do not know how I could support the use of EG with really off the wall security changes in most cases. Unless you have Administrative rights I do not know how to go about finding out what the problem is.

The reason for this addition was for RDP issues and also so the user could have their tree do different things based on who is logged in.
If you like the work I have been doing then feel free to Image

eatmeimadanish
Experienced User
Posts: 116
Joined: Thu Oct 01, 2009 5:11 pm

Re: Startup Error with NetUserGetLocalGroups RC5

Post by eatmeimadanish » Thu Dec 06, 2018 3:23 pm

Changing User.py line from line 51 with the code fixed the issue.

Code: Select all

def Groups(user_name=Name(), server=None):
    """
    Retrieves direct and indirect group name the username is a member of for a 
    specific computer/server. If no parameters are passed it will default to 
    the current user and the local computer.
    
    :type user_name: str
    :type server: str
    :rtype: list
    """
    try:
        return win32net.NetUserGetLocalGroups(server, user_name)
    except:
        return []

eatmeimadanish
Experienced User
Posts: 116
Joined: Thu Oct 01, 2009 5:11 pm

Re: Startup Error with NetUserGetLocalGroups RC5

Post by eatmeimadanish » Thu Dec 06, 2018 3:27 pm

This has an example of how to properly explore user groups. I modified it for EG.

https://programtalk.com/python-examples ... calGroups/

Code: Select all

def Groups(user_name=Name(), server=None):
    """
    Retrieves direct and indirect group name the username is a member of for a 
    specific computer/server. If no parameters are passed it will default to 
    the current user and the local computer.
    
    :type user_name: str
    :type server: str
    :rtype: list
    """
    groups = []
    try:
        groups.extend(win32net.NetUserGetLocalGroups(server, user_name))
    except:
        pass
    try:
        groups.extend(win32net.NetUserGetGroups(server, user_name))
    except:
        pass

    return groups
    

Post Reply