mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 06:01:28 +00:00
Avoid a zenmap crash if locale is not set properly
This commit is contained in:
@@ -623,8 +623,12 @@ in epoch format!")
|
|||||||
return ports
|
return ports
|
||||||
|
|
||||||
def get_formatted_date(self):
|
def get_formatted_date(self):
|
||||||
|
try:
|
||||||
return time.strftime("%B %d, %Y - %H:%M", self.get_date()).decode(
|
return time.strftime("%B %d, %Y - %H:%M", self.get_date()).decode(
|
||||||
locale.getpreferredencoding())
|
locale.getpreferredencoding())
|
||||||
|
except LookupError:
|
||||||
|
# encoding or locale not found
|
||||||
|
return time.asctime(self.get_date()).decode('ascii')
|
||||||
|
|
||||||
def get_scanner(self):
|
def get_scanner(self):
|
||||||
return self.nmap['nmaprun'].get('scanner', '')
|
return self.nmap['nmaprun'].get('scanner', '')
|
||||||
|
|||||||
Reference in New Issue
Block a user