Skip to content

Commit

Permalink
feat: add support for gz/zst/lz4 extension
Browse files Browse the repository at this point in the history
Pcap/pcapng/cap files with extension .pcapng.gz ... are supported as well.
Tested with wireshark/sharkd 4.4.0.

Issue: Can not open pcap.gz #42
  • Loading branch information
mbehr1 committed Sep 17, 2024
1 parent 3750c2b commit 50282ec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ If you install from source (git clone https://github.com/wireshark/wireshark; cd
## Features

- Open 'pcap'/'pcapng' network capture files. Use command "Open pcap file..." or with vscode >=1.46 directly open cap/pcap/pcapng files.
- Compressed pcap/pcapng files are supported as well with extensions cap|pcap|pcapng.gz|zstlz4
- Display filter with known syntax from wireshark
- **Time sync** feature.
- Calculates time for each frame based on timestamp and broadcasts the time to the other **Time sync** extensions so that they reveal the fitting time ranges.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
"displayName": "pcap/pcapng/cap",
"selector": [
{
"filenamePattern": "*.pcap"
"filenamePattern": "{*.pcap,*.pcap.gz,*.pcap.zst,*.pcap.lz4}"
},
{
"filenamePattern": "*.pcapng"
"filenamePattern": "{*.pcapng,*.pcapng.gz,*.pcapng.zst,*.pcapng.lz4}"
},
{
"filenamePattern": "*.cap"
"filenamePattern": "{*.cap,*.cap.gz,*.cap.zst,*.cap.lz4}"
}
]
}
Expand Down
10 changes: 6 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export function activate(context: vscode.ExtensionContext) {
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: false,
filters: { 'pcap files': ['pcap', 'cap', 'pcapng'] },
filters: {
'pcap files': ['pcap', 'cap', 'pcapng'].flatMap((ext) => [ext, ext + '.gz', ext + '.zst', ext + '.lz4']),
},
openLabel: 'Select pcap file to open...',
})
.then(async (uris: vscode.Uri[] | undefined) => {
Expand Down Expand Up @@ -145,7 +147,7 @@ export function activate(context: vscode.ExtensionContext) {
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: true,
filters: { 'pcap files': ['pcap', 'cap', 'pcapng'] },
filters: { 'pcap files': ['pcap', 'cap', 'pcapng'].flatMap((ext) => [ext, ext + '.gz', ext + '.zst', ext + '.lz4']) },
openLabel: 'Select pcap file to filter...',
})
.then(async (uris: vscode.Uri[] | undefined) => {
Expand All @@ -167,7 +169,7 @@ export function activate(context: vscode.ExtensionContext) {
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: true,
filters: { 'pcap files': ['pcap', 'cap', 'pcapng'] },
filters: { 'pcap files': ['pcap', 'cap', 'pcapng'].flatMap((ext) => [ext, ext + '.gz', ext + '.zst', ext + '.lz4']) },
openLabel: 'Select pcap file to extract DLT from...',
})
.then(async (uris: vscode.Uri[] | undefined) => {
Expand All @@ -189,7 +191,7 @@ export function activate(context: vscode.ExtensionContext) {
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: true,
filters: { 'pcap files': ['pcap', 'cap', 'pcapng'] },
filters: { 'pcap files': ['pcap', 'cap', 'pcapng'].flatMap((ext) => [ext, ext + '.gz', ext + '.zst', ext + '.lz4']) },
openLabel: 'Select pcap file to remove TECMP headers from...',
})
.then(async (uris: vscode.Uri[] | undefined) => {
Expand Down

0 comments on commit 50282ec

Please sign in to comment.