MPA: Added --plain option for output to text files (disables progress bars)
This commit is contained in:
parent
b1f993a6c9
commit
f97afc4a62
@ -79,6 +79,9 @@ def parseArgs():
|
|||||||
parser.add_option("-D","--debug",dest="debug",default=False,action="store_true",
|
parser.add_option("-D","--debug",dest="debug",default=False,action="store_true",
|
||||||
help="Enable debugging features.")
|
help="Enable debugging features.")
|
||||||
|
|
||||||
|
parser.add_option("-p","--plain",dest="plain",default=False,action="store_true",
|
||||||
|
help="Ensure plain output, e.g., no progress bars.")
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@ -114,11 +117,12 @@ def getCorrectIsolatedClaims(protocolset,options=None):
|
|||||||
correctclaims = []
|
correctclaims = []
|
||||||
goodprotocols = []
|
goodprotocols = []
|
||||||
|
|
||||||
widgets = ['Scanning for claims that are correct in isolation: ', Percentage(), ' ',
|
if not OPTS.plain:
|
||||||
Bar(marker='#',left='[',right=']')
|
widgets = ['Scanning for claims that are correct in isolation: ', Percentage(), ' ',
|
||||||
]
|
Bar(marker='#',left='[',right=']')
|
||||||
pbar = ProgressBar(widgets=widgets, maxval=len(protocolset))
|
]
|
||||||
pbar.start()
|
pbar = ProgressBar(widgets=widgets, maxval=len(protocolset))
|
||||||
|
pbar.start()
|
||||||
count = 0
|
count = 0
|
||||||
for protocol in protocolset:
|
for protocol in protocolset:
|
||||||
# verify protocol in isolation
|
# verify protocol in isolation
|
||||||
@ -129,9 +133,11 @@ def getCorrectIsolatedClaims(protocolset,options=None):
|
|||||||
if claim.okay:
|
if claim.okay:
|
||||||
correctclaims.append((protocol,claim.id))
|
correctclaims.append((protocol,claim.id))
|
||||||
count += 1
|
count += 1
|
||||||
pbar.update(count)
|
|
||||||
pbar.finish()
|
|
||||||
return (goodprotocols,correctclaims)
|
return (goodprotocols,correctclaims)
|
||||||
|
if not OPTS.plain:
|
||||||
|
pbar.update(count)
|
||||||
|
if not OPTS.plain:
|
||||||
|
pbar.finish()
|
||||||
|
|
||||||
|
|
||||||
def verifyMPAlist(mpalist,claimid,options=None):
|
def verifyMPAlist(mpalist,claimid,options=None):
|
||||||
@ -218,11 +224,12 @@ def findAllMPA(protocolset,maxcount=3,options="",mpaoptions=""):
|
|||||||
(protocolset,correct) = getCorrectIsolatedClaims(protocolset,options)
|
(protocolset,correct) = getCorrectIsolatedClaims(protocolset,options)
|
||||||
print "Investigating %i correct claims." % (len(correct))
|
print "Investigating %i correct claims." % (len(correct))
|
||||||
# For all these claims...
|
# For all these claims...
|
||||||
widgets = ['Scanning for MPA attacks: ', Percentage(), ' ',
|
if not OPTS.plain:
|
||||||
Bar(marker='#',left='[',right=']')
|
widgets = ['Scanning for MPA attacks: ', Percentage(), ' ',
|
||||||
]
|
Bar(marker='#',left='[',right=']')
|
||||||
pbar = ProgressBar(widgets=widgets, maxval=len(correct))
|
]
|
||||||
pbar.start()
|
pbar = ProgressBar(widgets=widgets, maxval=len(correct))
|
||||||
|
pbar.start()
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
# Concatenate options but add space iff needed
|
# Concatenate options but add space iff needed
|
||||||
@ -232,8 +239,10 @@ def findAllMPA(protocolset,maxcount=3,options="",mpaoptions=""):
|
|||||||
# Try to find multi-protocol attacks
|
# Try to find multi-protocol attacks
|
||||||
findMPA(protocolset,protocol,claimid,maxcount,options=alloptions)
|
findMPA(protocolset,protocol,claimid,maxcount,options=alloptions)
|
||||||
count += 1
|
count += 1
|
||||||
pbar.update(count)
|
if not OPTS.plain:
|
||||||
pbar.finish()
|
pbar.update(count)
|
||||||
|
if not OPTS.plain:
|
||||||
|
pbar.finish()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
The below computation assumes protocol names are unique to files, but if
|
The below computation assumes protocol names are unique to files, but if
|
||||||
|
Loading…
Reference in New Issue
Block a user