MCPcopy Index your code
hub / github.com/secdev/scapy / ls_output

Method ls_output

scapy/layers/smbclient.py:1418–1449  ·  view source on GitHub ↗

Print the output of 'ls'

(self, results, *, t=False, S=False, r=False)

Source from the content-addressed store, hash-verified

1416
1417 @CLIUtil.addoutput(ls)
1418 def ls_output(self, results, *, t=False, S=False, r=False):
1419 """
1420 Print the output of 'ls'
1421 """
1422 fld = UTCTimeField(
1423 "", None, fmt="<Q", epoch=[1601, 1, 1, 0, 0, 0], custom_scaling=1e7
1424 )
1425 if t:
1426 # Sort by time
1427 results.sort(key=lambda x: -x[3])
1428 if S:
1429 # Sort by size
1430 results.sort(key=lambda x: -x[2])
1431 if r:
1432 # Reverse sort
1433 results = results[::-1]
1434 results = [
1435 (
1436 x[0],
1437 "+".join(y.lstrip("FILE_ATTRIBUTE_") for y in str(x[1]).split("+")),
1438 human_size(x[2]),
1439 fld.i2repr(None, x[3]),
1440 )
1441 for x in results
1442 ]
1443 print(
1444 pretty_list(
1445 results,
1446 [("FileName", "FileAttributes", "EndOfFile", "LastWriteTime")],
1447 sortBy=None,
1448 )
1449 )
1450
1451 @CLIUtil.addcomplete(ls)
1452 def ls_complete(self, folder):

Callers

nothing calls this directly

Calls 5

i2reprMethod · 0.95
UTCTimeFieldClass · 0.90
human_sizeFunction · 0.90
pretty_listFunction · 0.90
joinMethod · 0.80

Tested by

no test coverage detected