#🔒 python error
13 messages · Page 1 of 1 (latest)
@icy marten
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I have a problem with the "add everyone" function which is supposed to add the "everyone" group to a key with all rights but I have certain errors
''''import os.path
import winreg
import win32security
import ntsecuritycon
def ajout_groupe_tout_monde(registre_temp,cle_temp):
#Creation du nouveau groupe
tout_le_monde = win32security.LookupAccountName("","Tout le monde")
#Ouverture de la cle du registre
clef = winreg.OpenKeyEx(registre_temp,cle_temp,0,winreg.KEY_READ | winreg.KEY_WRITE)
if registre_temp == winreg.HKEY_CURRENT_USER :
cle_c = "HKEY_CURRENT_USER"
elif registre_temp == winreg.HKEY_LOCAL_MACHINE :
cle_c = "HKEY_LOCAL_MACHINE"
else :
raise ValueError("Registre introuvable") #Affichage uniquement
sd =win32security.GetSecurityInfo(
clef,
win32security.SE_REGISTRY_KEY,
win32security.DACL_SECURITY_INFORMATION
)
#obtention DACL
dacl = sd.GetSecurityDescriptorDacl()
if dacl is None :
dacl = win32security.ACL()
#creation nouveau id pour le groupe 'Tout le monde"
everyone, _, _ = win32security.LookupAccountName("","Tout le monde")
access_mask = ntsecuritycon.TOKEN_ALL_ACCESS #KEY_ALL_ACCESS ?
dacl.AddAccessAllowedAceEx(win32security.ACL_REVISION,0,access_mask,everyone)
sd.SetSecurityDescriptorDacl(1,dacl,0)
#On veux obtenir la description de la securite
win32security.SetNamedSecurityInfo(
registre_temp,
win32security.SE_REGISTRY_KEY,
win32security.DACL_SECURITY_INFORMATION,
None,
None,
dacl,
None
)
#Fermeture et enregistrement de la cle
winreg.CloseKey(clef)
#On définit les differents registres que nous allons utiliser
registre = winreg.HKEY_CURRENT_USER
registre_2 = winreg.HKEY_LOCAL_MACHINE
#On définit les differentes clés pour lequelles nous voulons vérifier leurs existances
cle = r"Software\Borland"
cle_2 = r"Software\ComputerLine Electronique"
cle_3 = r"Software\WOW6432Node\Borland"
ajout_groupe_tout_monde(registre,cle)'''
Hey @icy marten!
It looks like you are trying to paste code into this channel.
You seem to be using the wrong symbols to indicate where the code block should start. The correct symbols would be ```, not '''.
Here is an example of how it should look:
```
Hello, world!
```
This will result in the following:
Hello, world!```
You can **edit your original message** to correct your code block.
yo i saw this active chat quick question is it possible to automate chrome dino using selenium ?
ohk
you may want to ask in #web-development
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.