本文整理汇总了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
示例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
)
示例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()
示例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)
示例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)
示例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
)
示例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
)
示例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
)
示例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
)
示例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
)
示例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
)