mirror of
https://github.com/wader/fq.git
synced 2025-01-06 05:07:00 +03:00
9852f56b74
What it can do: - Decodes records and most standard messages and extensions. - Decryptes records and reassemples application data stream if a keylog is provided and the cipher suite is supported. - Supports most recommended and used ciphers and a bunch of older ones. What it can't do: - SSL v3 maybe supported, is similar to TLS 1.0, not tested. - Decryption and renegotiation/cipher change. - Record defragmentation not supported, seems rare over TCP. - TLS 1.3 - SSL v2 but v2 compat header is supported. - Some key exchange messages not decoded yet Decryption code is heavly based on golang crypto/tls and zmap/zcrypto. Will be base for decoding http2 and other TLS based on protocols. Fixes #587
44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
def to_tar(g):
|
|
def lpad($l; $n): [[range($l-length) | $n], .];
|
|
def rpad($l; $n): [., [range($l-length) | $n]];
|
|
def header($filename; $b):
|
|
def checksum: [.[range(.size)]] | add;
|
|
def h:
|
|
[ ($filename | rpad(100; 0)) # name
|
|
, ("000644 " | rpad(8; 0)) # mode
|
|
, ("000000 " | rpad(8; 0)) # uid
|
|
, ("000000 " | rpad(8; 0)) # gid
|
|
, [($b.size | to_radix(8) | [lpad(11; "0")]), " "] # size
|
|
, [(0| to_radix(8) | lpad(11; "0")), " "] # mtime
|
|
, " " # chksum (blank spaces when adding checksum)
|
|
, ("0") # typeflag
|
|
, ("" | rpad(100; 0)) # linkname
|
|
, ["ustar", 0] # magic
|
|
, ("00") # version
|
|
, ("user" | rpad(32; 0)) # uname
|
|
, ("group" | rpad(32; 0)) # gname
|
|
, ("000000 " | rpad(8; 0)) # devmajor
|
|
, ("000000 " | rpad(8; 0)) # devminor
|
|
, ("" | rpad(155; 0)) # prefix
|
|
] | tobytes;
|
|
( h as $h
|
|
| [ $h[0:148]
|
|
, [(($h | checksum) | to_radix(8) | lpad(6; "0")), 0, " "]
|
|
, $h[148+8:]
|
|
]
|
|
| tobytes
|
|
);
|
|
[ ( # per file
|
|
( g as {$filename, $data}
|
|
| ($data | tobytes) as $b
|
|
| ($filename | rpad(100; 0)) # name
|
|
| header($filename; $b) as $header
|
|
| $header
|
|
, ("" | lpad((512 - ($header.size % 512)) % 512; 0))
|
|
, $b
|
|
, ("" | lpad((512 - ($b.size % 512)) % 512; 0))
|
|
)
|
|
# end_marker
|
|
, [range(1024) | 0]
|
|
)
|
|
] | tobytes; |