Implementation for an Issue #292

This commit is contained in:
Miroslav Stampar 2012-12-11 12:02:06 +01:00
parent 9e38ccbc3d
commit 562044577b
10 changed files with 113 additions and 50 deletions

View file

@ -12,10 +12,10 @@ import re
import socket
import time
from extra.beep.beep import beep
from lib.core.agent import agent
from lib.core.common import arrayizeValue
from lib.core.common import Backend
from lib.core.common import beep
from lib.core.common import extractRegexResult
from lib.core.common import extractTextTagContent
from lib.core.common import findDynamicContent

View file

@ -2046,50 +2046,6 @@ def urlencode(value, safe="%&=", convall=False, limit=False):
return result
def beep():
"""
Does an audible beep sound
Reference: http://de3.aminet.net/dev/src/clr.py.txt
"""
def _failsafe():
dataToStdout('\a', True)
if sys.platform == 'linux2':
for dev in ('/dev/audio', '/dev/oss', '/dev/dsp', '/dev/sound'):
if os.path.exists(dev):
try:
audio = file(dev, 'wb')
for _ in xrange(250):
audio.write(chr(32) * 4)
audio.write(chr(0) * 4)
audio.close()
return
except:
pass
try:
import curses
curses.initscr()
curses.beep()
curses.flash()
curses.endwin()
return
except:
_failsafe()
elif sys.platform == 'darwin':
try:
import Carbon.Snd
Carbon.Snd.SysBeep(1)
except:
_failsafe()
else:
_failsafe()
def runningAsAdmin():
"""
Returns True if the current process is run under admin privileges

View file

@ -192,6 +192,7 @@ optDict = {
"Miscellaneous": {
"mnemonics": "string",
"answers": "string",
"beep": "boolean",
"checkPayload": "boolean",
"cleanup": "boolean",
"dependencies": "boolean",

View file

@ -13,8 +13,8 @@ import sys
import tempfile
import time
from extra.beep.beep import beep
from lib.controller.controller import start
from lib.core.common import beep
from lib.core.common import clearConsoleLine
from lib.core.common import dataToStdout
from lib.core.common import readXmlFile

View file

@ -606,6 +606,9 @@ def cmdLineParser():
miscellaneous.add_option("--answers", dest="answers",
help="Set question answers (e.g. \"quit=N,follow=N\")")
miscellaneous.add_option("--beep", dest="beep", action="store_true",
help="Make a beep sound when SQL injection is found")
miscellaneous.add_option("--check-payload", dest="checkPayload",
action="store_true",
help="Offline WAF/IPS/IDS payload detection testing")
@ -658,9 +661,6 @@ def cmdLineParser():
help="Simple wizard interface for beginner users")
# Hidden and/or experimental options
parser.add_option("--beep", dest="beep", action="store_true",
help=SUPPRESS_HELP)
parser.add_option("--profile", dest="profile", action="store_true",
help=SUPPRESS_HELP)

View file

@ -107,7 +107,7 @@ def _oneShotErrorUse(expression, field=None):
None)
if output is not None:
output = getUnicode(output, kb.pageEncoding)
output = getUnicode(output)
else:
trimmed = extractRegexResult(trimcheck, page, re.DOTALL | re.IGNORECASE) \
or extractRegexResult(trimcheck, listToStrValue(headers.headers \