Python winsound.SND_ALIAS Examples
The following are 12
code examples of winsound.SND_ALIAS().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
winsound
, or try the search function
.
Example #1
Source File: sbmit.py From hack4career with Apache License 2.0 | 6 votes |
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
Example #2
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 6 votes |
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 )
Example #3
Source File: dns_checker.py From hack4career with Apache License 2.0 | 5 votes |
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()
Example #4
Source File: action_playsound.py From dragonfly with GNU Lesser General Public License v3.0 | 5 votes |
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)
Example #5
Source File: action_playsound.py From dragonfly with GNU Lesser General Public License v3.0 | 5 votes |
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)
Example #6
Source File: _test_playsound.py From dragonfly with GNU Lesser General Public License v3.0 | 5 votes |
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)
Example #7
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_alias_asterisk(self): if _have_soundcard(): winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS) else: self.assertRaises( RuntimeError, winsound.PlaySound, 'SystemAsterisk', winsound.SND_ALIAS )
Example #8
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_alias_exclamation(self): if _have_soundcard(): winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS) else: self.assertRaises( RuntimeError, winsound.PlaySound, 'SystemExclamation', winsound.SND_ALIAS )
Example #9
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_alias_exit(self): if _have_soundcard(): winsound.PlaySound('SystemExit', winsound.SND_ALIAS) else: self.assertRaises( RuntimeError, winsound.PlaySound, 'SystemExit', winsound.SND_ALIAS )
Example #10
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_alias_hand(self): if _have_soundcard(): winsound.PlaySound('SystemHand', winsound.SND_ALIAS) else: self.assertRaises( RuntimeError, winsound.PlaySound, 'SystemHand', winsound.SND_ALIAS )
Example #11
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_alias_question(self): if _have_soundcard(): winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS) else: self.assertRaises( RuntimeError, winsound.PlaySound, 'SystemQuestion', winsound.SND_ALIAS )
Example #12
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 5 votes |
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 )