File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -624,7 +624,7 @@ def getppid():
624624 try :
625625 self .info_once (self .checksec ())
626626 except Exception :
627- log .warn_once ("Couldn't check security settings on %r" % self .host )
627+ self .warn_once ("Couldn't check security settings on %r" % self .host )
628628
629629 @property
630630 def sftp (self ):
@@ -1973,6 +1973,16 @@ def preexec():
19731973
19741974 return self ._aslr_ulimit
19751975
1976+ def _checksec_cache (self , value = None ):
1977+ path = self ._get_cachefile ('%s-%s' % (self .host , self .port ))
1978+
1979+ if value is not None :
1980+ with open (path , 'w+' ) as f :
1981+ f .write (value )
1982+ else :
1983+ with open (path , 'r+' ) as f :
1984+ return f .read ()
1985+
19761986 def checksec (self , banner = True ):
19771987 """checksec()
19781988
@@ -1981,6 +1991,10 @@ def checksec(self, banner=True):
19811991 Arguments:
19821992 banner(bool): Whether to print the path to the ELF binary.
19831993 """
1994+ cached = self ._checksec_cache ()
1995+ if cached :
1996+ return cached
1997+
19841998 red = text .red
19851999 green = text .green
19862000 yellow = text .yellow
@@ -2001,5 +2015,6 @@ def checksec(self, banner=True):
20012015 if self .aslr_ulimit :
20022016 res += [ "Note:" .ljust (10 ) + red ("Susceptible to ASLR ulimit trick (CVE-2016-3672)" )]
20032017
2004- return '\n ' .join (res )
2005-
2018+ cached = '\n ' .join (res )
2019+ self ._checksec_cache (cached )
2020+ return cached
You can’t perform that action at this time.
0 commit comments