diff --git a/gui/Gui/Scytherthread.py b/gui/Gui/Scytherthread.py index ce5afbe..b95af8f 100644 --- a/gui/Gui/Scytherthread.py +++ b/gui/Gui/Scytherthread.py @@ -71,14 +71,23 @@ class ScytherThread(threading.Thread): wx.CallAfter(self.callback, scyther, claims, summary) def claimFixViewOne(self,claims): - if claims: - for cl in claims: - if len(cl.attacks) > 1: - # Fix it such that by default, only the best attack is - # shown, unless we are in characterize or check mode - # TODO [X] [CC] make switch-dependant. - if not self.mode in ["characterize","check"]: - cl.attacks = [cl.attacks[-1]] + """ + This is a stupid hack as long as switches.useAttackBuffer in + Scyther C code is false. It is currently false because Windows + VISTA screwed up the standard C function tmpfile() (It's in a + directory to which normal users cannot write...) + """ + if int(Preference.get('allattacks','0')) == 0: + if claims: + for cl in claims: + if len(cl.attacks) > 1: + # Fix it such that by default, only the best attack is + # shown, unless we are in characterize or check mode + # TODO [X] [CC] make switch-dependant. + if not self.mode in ["characterize","check"]: + cl.attacks = [cl.attacks[-1]] + """ Cutting invalidates exactness of attack/behaviour counts """ + cl.complete = False return claims diff --git a/gui/Gui/Settingswindow.py b/gui/Gui/Settingswindow.py index 298fd7e..50547ff 100644 --- a/gui/Gui/Settingswindow.py +++ b/gui/Gui/Settingswindow.py @@ -98,6 +98,15 @@ class SettingsWindow(wx.Panel): ### MISC expert stuff grid.titleAdd("Advanced parameters") + # Continue after finding the first attack + self.allattacks = int(Preference.get('allattacks','0')) + claimoptions = ['Yes','No'] + r8 = wx.StaticText(self,-1,"Stop after finding one attack") + l8 = self.ch = wx.Choice(self,-1,choices=claimoptions) + l8.SetSelection(self.allattacks) + self.Bind(wx.EVT_CHOICE,self.EvtAllAttacks,l8) + grid.stepAdd(l8,r8) + # Bound on the number of patterns self.maxattacks = int(Preference.get('maxattacks','10')) r9 = wx.StaticText(self,-1,"Maximum number of patterns\nper claim") @@ -143,6 +152,10 @@ class SettingsWindow(wx.Panel): def EvtFontsize(self,evt): self.fontsize = evt.GetInt() + def EvtAllAttacks(self,evt): + self.allattacks = evt.GetInt() + Preference.set('allattacks',self.allattacks) + def EvtMaxAttacks(self,evt): self.maxattacks = evt.GetInt() @@ -160,6 +173,9 @@ class SettingsWindow(wx.Panel): tstr += "--max-runs=%s " % (str(self.maxruns)) # Matching type tstr += "--match=%s " % (str(self.match)) + # All attacks (has to go BEFORE max attacks) + if self.allattacks != 0: + tstr += "--all-attacks " # Max attacks/classes if self.maxattacks != 0: tstr += "--max-attacks=%s " % (str(self.maxattacks))