visidata timefromts fixed
This commit is contained in:
24
visidatarc
24
visidatarc
@@ -3,15 +3,30 @@
|
||||
from datetime import datetime
|
||||
import functools
|
||||
|
||||
|
||||
def timefromts(val):
|
||||
try:
|
||||
return datetime.fromtimestamp(float(val))
|
||||
except ValueError:
|
||||
pass
|
||||
try:
|
||||
return datetime.fromtimestamp(float(val)/1000)
|
||||
except ValueError:
|
||||
pass
|
||||
try:
|
||||
return datetime.fromtimestamp(float(val)/1000000)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
||||
# sym-ts = hexNcoded NT-Timestamp = Nanoseconds since 01.01.1601
|
||||
def sym_time(val):
|
||||
a = int(val, 16) # decode hex
|
||||
b=(a / 10000000) - 11644473600 #convert to seconds and subtract offset to 01.01.1970
|
||||
# convert to seconds and subtract offset to 01.01.1970
|
||||
b = (a / 10000000) - 11644473600
|
||||
return datetime.fromtimestamp(b)
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def vendor(mac):
|
||||
try:
|
||||
@@ -22,6 +37,7 @@ def vendor(mac):
|
||||
except ModuleNotFoundError:
|
||||
return "module not available"
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def dns_lookup(domain, record='A'):
|
||||
if len(domain.split(",")) > 1:
|
||||
@@ -39,6 +55,7 @@ def dns_lookup(domain,record='A'):
|
||||
except ModuleNotFoundError:
|
||||
return "module not available"
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def _ipinfo(ip):
|
||||
try:
|
||||
@@ -51,6 +68,7 @@ def _ipinfo(ip):
|
||||
except ModuleNotFoundError:
|
||||
return None
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def ipinfo(ip, type="country"):
|
||||
if len(ip.split(",")) > 1:
|
||||
@@ -60,6 +78,7 @@ def ipinfo(ip,type="country"):
|
||||
except:
|
||||
return ""
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def mx_lookup(domain):
|
||||
domain = domain.lstrip("www.")
|
||||
@@ -70,6 +89,7 @@ def mx_lookup(domain):
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def grab_banner(ip, port=25):
|
||||
if len(ip.split(",")) > 1:
|
||||
@@ -85,8 +105,6 @@ def grab_banner(ip,port=25):
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
|
||||
def sym_id(val):
|
||||
event_ids = {
|
||||
"2": "Scan Stopped",
|
||||
|
||||
Reference in New Issue
Block a user