當前位置: 首頁>>代碼示例>>Python>>正文


Python winsound.SND_ALIAS屬性代碼示例

本文整理匯總了Python中winsound.SND_ALIAS屬性的典型用法代碼示例。如果您正苦於以下問題:Python winsound.SND_ALIAS屬性的具體用法?Python winsound.SND_ALIAS怎麽用?Python winsound.SND_ALIAS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在winsound的用法示例。


在下文中一共展示了winsound.SND_ALIAS屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: do_scan

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def do_scan(crawling):
    while 1:
            try:
                    crawling = tocrawl.pop()
                        # print crawling
            except KeyError:
                    sys.exit(1)            
            url = urlparse.urlparse(crawling)
            try:
                    response = urllib2.urlopen(crawling)
            except urllib2.HTTPError, e:
                   continue
            except urllib2.URLError, e:
                    log_file = "sqli.txt" 
                    FILE = open(log_file, "a")
                    FILE.write(crawling)
                    FILE.close()
                    print "\n================================================================================"
                    print "\t\tBlind MySQL Injection Detected"
                    print crawling
                    print "\n===============================================================================\n"
                    winsound.PlaySound("SystemAsterisk", winsound.SND_ALIAS)
                    time.sleep(10)
                    continue 
開發者ID:mertsarica,項目名稱:hack4career,代碼行數:26,代碼來源:sbmit.py

示例2: test_stopasync

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def test_stopasync(self):
        if _have_soundcard():
            winsound.PlaySound(
                'SystemQuestion',
                winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP
            )
            time.sleep(0.5)
            try:
                winsound.PlaySound(
                    'SystemQuestion',
                    winsound.SND_ALIAS | winsound.SND_NOSTOP
                )
            except RuntimeError:
                pass
            else: # the first sound might already be finished
                pass
            winsound.PlaySound(None, winsound.SND_PURGE)
        else:
            self.assertRaises(
                RuntimeError,
                winsound.PlaySound,
                None, winsound.SND_PURGE
            ) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:25,代碼來源:test_winsound.py

示例3: dns_lookup

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def dns_lookup(address):
    subprocess.call("ipconfig /flushdns", stdout=False, stderr=False)
    query = socket.getaddrinfo(address, 80)
    query = ".".join([str(x) for x in query])
    query = query.split("'")[3]
    print address, "-", query
    date = datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S")
    
    if os.path.isfile("history.txt"):
        FILE  = open ("history.txt","r" )   
        entries = FILE.readlines()
        FILE.close()
        lastentry = entries[-1].split("|")[1]

        if debug:
            print query.strip, lastentry
            print address.strip().lower(), entries[-1].split("|")[0].strip().lower()

        if (address.strip().lower() == entries[-1].split("|")[0].strip().lower()):
            if query.strip() != lastentry.strip():
                print "DNS Change Detected! (Old: %s - New: %s)\n" %(lastentry.strip(), query)
                winsound.PlaySound("SystemAsterisk", winsound.SND_ALIAS)
                    
        line = address + "|" + query + "|" + date + "\n"
        FILE = open("history.txt", "a")
        FILE.writelines(line)
        FILE.close()
    else:
        line = address + "|" + query + "|" + date + "\n"
        FILE = open("history.txt", "w")
        FILE.writelines(line)
        FILE.close() 
開發者ID:mertsarica,項目名稱:hack4career,代碼行數:34,代碼來源:dns_checker.py

示例4: __init__

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def __init__(self, name='', file=None):
        """
            Constructor arguments:
             - *name* (*str*, default *empty string*) --
               name of the Windows system sound to play. This argument is
               effectively an alias for *file* on other platforms.
             - *file* (*str*, default *None*) --
               path of wave file to play when the action is executed.

            If *name* and *file* are both *None*, then waveform playback
            will be silenced on Windows when the action is executed. Nothing
            will happen on other platforms.

        """
        ActionBase.__init__(self)
        self._flags = 0
        if file is not None:
            self._name = file
            if os.name == 'nt':
                self._flags = winsound.SND_FILENAME
        else:
            self._name = name
            if os.name == 'nt':
                self._flags = winsound.SND_ALIAS

        # Expand ~ constructions and shell variables in the file path if
        # necessary.
        if file is not None or os.name != 'nt':
            self._name = os.path.expanduser(os.path.expandvars(self._name))

        self._str = str(self._name) 
開發者ID:dictation-toolbox,項目名稱:dragonfly,代碼行數:33,代碼來源:action_playsound.py

示例5: __init__

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def __init__(self, name=None, file=None):
        ActionBase.__init__(self)
        if name is not None:
            self._name = name
            self._flags = winsound.SND_ASYNC | winsound.SND_ALIAS
        elif file is not None:
            self._name = file
            self._flags = winsound.SND_ASYNC | winsound.SND_FILENAME

        self._str = str(self._name) 
開發者ID:t4ngo,項目名稱:dragonfly,代碼行數:12,代碼來源:action_playsound.py

示例6: test_alias_asterisk

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def test_alias_asterisk(self):
        if _have_soundcard():
            winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS)
        else:
            self.assertRaises(
                RuntimeError,
                winsound.PlaySound,
                'SystemAsterisk', winsound.SND_ALIAS
            ) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:11,代碼來源:test_winsound.py

示例7: test_alias_exclamation

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def test_alias_exclamation(self):
        if _have_soundcard():
            winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS)
        else:
            self.assertRaises(
                RuntimeError,
                winsound.PlaySound,
                'SystemExclamation', winsound.SND_ALIAS
            ) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:11,代碼來源:test_winsound.py

示例8: test_alias_exit

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def test_alias_exit(self):
        if _have_soundcard():
            winsound.PlaySound('SystemExit', winsound.SND_ALIAS)
        else:
            self.assertRaises(
                RuntimeError,
                winsound.PlaySound,
                'SystemExit', winsound.SND_ALIAS
            ) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:11,代碼來源:test_winsound.py

示例9: test_alias_hand

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def test_alias_hand(self):
        if _have_soundcard():
            winsound.PlaySound('SystemHand', winsound.SND_ALIAS)
        else:
            self.assertRaises(
                RuntimeError,
                winsound.PlaySound,
                'SystemHand', winsound.SND_ALIAS
            ) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:11,代碼來源:test_winsound.py

示例10: test_alias_question

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def test_alias_question(self):
        if _have_soundcard():
            winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS)
        else:
            self.assertRaises(
                RuntimeError,
                winsound.PlaySound,
                'SystemQuestion', winsound.SND_ALIAS
            ) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:11,代碼來源:test_winsound.py

示例11: test_alias_nofallback

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ALIAS [as 別名]
def test_alias_nofallback(self):
        if _have_soundcard():
            # Note that this is not the same as asserting RuntimeError
            # will get raised:  you cannot convert this to
            # self.assertRaises(...) form.  The attempt may or may not
            # raise RuntimeError, but it shouldn't raise anything other
            # than RuntimeError, and that's all we're trying to test
            # here.  The MS docs aren't clear about whether the SDK
            # PlaySound() with SND_ALIAS and SND_NODEFAULT will return
            # True or False when the alias is unknown.  On Tim's WinXP
            # box today, it returns True (no exception is raised).  What
            # we'd really like to test is that no sound is played, but
            # that requires first wiring an eardrum class into unittest
            # <wink>.
            try:
                winsound.PlaySound(
                    '!"$%&/(#+*',
                    winsound.SND_ALIAS | winsound.SND_NODEFAULT
                )
            except RuntimeError:
                pass
        else:
            self.assertRaises(
                RuntimeError,
                winsound.PlaySound,
                '!"$%&/(#+*', winsound.SND_ALIAS | winsound.SND_NODEFAULT
            ) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:29,代碼來源:test_winsound.py


注:本文中的winsound.SND_ALIAS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。