Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial release of Capa Explorer Web #2224

Merged
merged 79 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
6bec5d4
webui: initial release
fariss Jul 22, 2024
c3aa306
add Github Pages deployement workflow
fariss Jul 22, 2024
2862cb3
remove Github Pages workflow from webui branch
fariss Jul 22, 2024
09d8624
add package-lock.json cache
Jul 22, 2024
5c60efa
add Github Pages deployment workflow
fariss Jul 22, 2024
3c27497
Remove demo rdoc json files (static and dynamic)
fariss Jul 22, 2024
626ea51
use existings tests/data/rd rdocs for Preview
fariss Jul 23, 2024
9db01e3
add href links to MBC, and refactor into helpers functions
fariss Jul 23, 2024
277e9d1
remove Toolset dropdown menu
fariss Jul 23, 2024
106c317
link sha256 to VT external link
fariss Jul 23, 2024
6da0e5d
highlight links, use monospace for feature values
fariss Jul 24, 2024
12f1851
deploy-webui.yml: include submodule capa-rules checkout
fariss Jul 24, 2024
3f33b82
changelog: add webui
fariss Jul 24, 2024
0028da5
implement text truncation for process names
fariss Jul 24, 2024
4aad53c
feature: implement parent-child process tree
fariss Jul 24, 2024
d25c86c
reformat function capabilities into a rowspan table instead of tree t…
fariss Jul 26, 2024
e3f695b
bump upload size limit to 100MB
fariss Jul 26, 2024
029259b
make rule names and matches click event expand the node
fariss Jul 28, 2024
d81b123
feature: add right click links context menu
fariss Jul 28, 2024
38cf1f1
feature: show regex captures
fariss Jul 29, 2024
13261d0
include basic block matches in capabilities by function table
fariss Jul 29, 2024
e70e1b0
feature: add call information to api feature in dynamic mode (-vv)
fariss Jul 30, 2024
b6f0ee5
wip: only include process name in api call details
fariss Jul 30, 2024
f60e3fc
lints
fariss Jul 30, 2024
62701a2
use Hash-Based routing (#)
fariss Jul 30, 2024
f6bc425
if node already expanded, toggle it off
fariss Jul 30, 2024
0ea6f1e
fix: do not toggle/on feature and statements
fariss Jul 30, 2024
b7b8792
Force reload the page on Import Analysis
fariss Jul 31, 2024
4fe7f78
edit code comments
fariss Jul 31, 2024
b229048
feature: show namespace chart
fariss Aug 1, 2024
b74738a
feature: show namespace chart
fariss Aug 1, 2024
9107819
fix: force reload page on import analysis
fariss Aug 1, 2024
8e9eadf
feature: support gzipped rdoc
fariss Aug 1, 2024
33be4d1
dynamic: only show first 20 matches per rule
fariss Aug 1, 2024
4137923
dynamic: revert to showing 1 match per rule
fariss Aug 1, 2024
07b4e1f
implement unit test
fariss Aug 1, 2024
b0ffc86
fix lint error
fariss Aug 1, 2024
67d3916
add lint and test steps to deploy workflow
fariss Aug 1, 2024
a6884db
fix: add lint and test steps to deploy workflow
fariss Aug 2, 2024
eb69b38
move url creation function to util/urlHelpers.js
fariss Aug 5, 2024
7cb93c8
update .prettierrc.json, and reformat code
fariss Aug 5, 2024
fcf200f
fix metadata panel on small screens
fariss Aug 5, 2024
d609203
add 404 page
fariss Aug 5, 2024
bb60099
rename window title to 'Capa Explorer'
fariss Aug 5, 2024
6b19e7b
add README.md for Capa Explorer WebUI
fariss Aug 5, 2024
7e64306
move webui to web/explorer
fariss Aug 5, 2024
bb1ef6c
move package-lock.json to web/explorer
Aug 5, 2024
e9e5d2b
delete webui
fariss Aug 5, 2024
ebb778a
delete webui/package-lock.json
Aug 5, 2024
f856ea7
modify deploy-webui.yml workflow to user web/explorer
fariss Aug 5, 2024
283aa27
add DEVELOPMENT.md
fariss Aug 5, 2024
fcdaabf
update development links
fariss Aug 5, 2024
a15eb83
format code
fariss Aug 5, 2024
ac08133
Merge branch 'master' into webui
fariss Aug 5, 2024
b675c9a
change target branch to master in deploy-webui.yml
fariss Aug 5, 2024
765c7cb
add on pull_request trigger to deploy-webui.yml
fariss Aug 5, 2024
ebfba54
fix Metadata panel on smaller screens
fariss Aug 6, 2024
db423d9
add comments to rule column components
fariss Aug 6, 2024
dfc19d8
Update docuemntation
fariss Aug 8, 2024
843fd34
changelog: update entry
fariss Aug 8, 2024
97bd499
add path resolving shortcuts "@"
fariss Aug 8, 2024
6b8983c
simplify function capabilities
fariss Aug 8, 2024
20d7bf1
gitignore: update gitignore
fariss Aug 8, 2024
01e6619
update Import Analysis url
fariss Aug 8, 2024
7cb31cf
refactor: add new URL creation helper functions for VT and capa-rules
fariss Aug 8, 2024
1f6ce48
refactor RuleMatchesTable
fariss Aug 8, 2024
287e428
set web-app version to 1.0.0
fariss Aug 8, 2024
368f635
minor fixes: NamespaceChart and ProcessCapabilities
fariss Aug 8, 2024
bb8991a
fix formatting
fariss Aug 8, 2024
e8ea461
fix formatting
fariss Aug 8, 2024
e8054c2
add deploy and tests workflows
fariss Aug 8, 2024
850ae5a
tests: update unit tests after refactoring parseFunctionCapabilities
fariss Aug 8, 2024
9d137a2
replace path traversal with @ path shortcut
fariss Aug 8, 2024
05575e1
encore rdoc query paramter URL
fariss Aug 8, 2024
1af97f6
update web workflow Format steps to use npm run format:check
fariss Aug 8, 2024
ba9ab7c
Update web/explorer/DEVELOPMENT.md
williballenthin Aug 8, 2024
6b8e2b3
Update web/explorer/README.md
williballenthin Aug 8, 2024
44cbe66
Update web/explorer/README.md
williballenthin Aug 8, 2024
312dd0d
Merge branch 'master' into webui
williballenthin Aug 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/deploy-webui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy webui to Github Pages

on:
# Runs on pushes targeting the webui branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
show-progress: true
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: './web/explorer/package-lock.json'
- name: Install dependencies
run: npm ci
working-directory: ./web/explorer
- name: Lint
run: npm run lint
working-directory: ./web/explorer
- name: Run unit tests
run: npm run test
working-directory: ./web/explorer
- name: Build
run: npm run build
working-directory: ./web/explorer
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './web/explorer/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
fariss marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
## master (unreleased)

### New Features

- webui: explore capa analysis in the web #2224 @s-ff
fariss marked this conversation as resolved.
Show resolved Hide resolved
- support analyzing DRAKVUF traces #2143 @yelhamer


### Breaking Changes

### New Rules (1)
Expand Down
13 changes: 13 additions & 0 deletions web/explorer/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/eslint-config-prettier/skip-formatting'],
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
'vue/multi-word-component-names': 'off'
}
}
28 changes: 28 additions & 0 deletions web/explorer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.vscode
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
8 changes: 8 additions & 0 deletions web/explorer/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": true,
"tabWidth": 4,
"singleQuote": false,
"printWidth": 120,
"trailingComma": "none"
}
fariss marked this conversation as resolved.
Show resolved Hide resolved
115 changes: 115 additions & 0 deletions web/explorer/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Development Guide for capa-webui

This guide will help you set up the Capa Explorer WebUI project for local development.

## Prerequisites

Before you begin, ensure you have the following installed:
- Node.js (v20.x or later recommended)
- npm (v10.x or later)
- Git

## Setting Up the Development Environment

1. Clone the repository:
```
git clone https://github.com/mandiat/capa.git
cd capa/web/explorer
```

2. Install dependencies:
```
npm install
```

3. Start the development server:
```
npm run dev
```

This will start the Vite development server. The application should now be running at `http://localhost:<port>`

## Project Structure

```
web/exporer/
├── src/
│ ├── assets/
│ ├── components/
│ ├── composables/
│ ├── router/
│ ├── utils/
│ ├── views/
│ ├── App.vue
│ └── main.js
├── public/
├── tests/
├── index.html
├── package.json
├── vite.config.js
├── DEVELOPMENT.md
└── README.md
```

- `src/`: Contains the source code of the application
- `src/components/`: Reusable Vue components
- `src/composables/`: Vue composition functions
- `src/router/`: Vue Router configuration
- `src/utils/`: Utility functions
- `src/views/`: Top-level views/pages
- `src/tests/`: Test files
- `public/`: Static assets that will be served as-is

## Building for Production

To build the application for production:

```
npm run build
```

This will generate production-ready files in the `dist/` directory.

## Testing

Run the test suite with:

```
npm run test
```

We use Vitest as our testing framework. Please ensure all tests pass before submitting a pull request.

## Linting and Formatting

We use ESLint for linting and Prettier for code formatting. Run the linter with:

```
npm run lint
```

To automatically fix linting and formatting issues:

```
npm run lint:fix
```

## Working with PrimeVue Components

Capa Explorer WebUI uses the PrimeVue UI component library. When adding new features or modifying existing ones, refer to the [PrimeVue documentation](https://primevue.org/vite) for available components and their usage.

## Best Practices

1. Follow the Vue.js Style Guide for consistent code style.
fariss marked this conversation as resolved.
Show resolved Hide resolved
3. Document new functions, components, and complex logic.
4. Write tests for new features and bug fixes.
5. Keep components small and focused on a single responsibility.
6. Use composables for reusable logic across components.

## Additional Resources

- [Vue.js Documentation](https://vuejs.org/guide/introduction.html)
- [Vite Documentation](https://vitejs.dev/guide/)
- [PrimeVue Documentation](https://www.primevue.org/)

If you encounter any issues or have questions about the development process, please open an issue on the GitHub repository.
41 changes: 41 additions & 0 deletions web/explorer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Capa Explorer WebUI

Capa Explorer WebUI is a web-based user interface for exploring program capabilities identified by the capa tool. It provides an intuitive and interactive way to analyze and visualize the results of capa analysis.
williballenthin marked this conversation as resolved.
Show resolved Hide resolved

## Features

- **Import capa Results**: Easily upload or import capa JSON result files.
- **Interactive Tree View**: Explore rule matches in a hierarchical structure.
- **Function Capabilities**: Group capabilities by function for static analysis.
- **Process Capabilities**: Group capabilities by process for dynamic analysis.
- **Toggeable Settings**: Toggle between different view modes and filter options.
fariss marked this conversation as resolved.
Show resolved Hide resolved

## Getting Started

1. **Access the Application**: Open the Capa Explorer WebUI in your web browser.
fariss marked this conversation as resolved.
Show resolved Hide resolved
williballenthin marked this conversation as resolved.
Show resolved Hide resolved

2. **Import capa Results**:

- Click on "Upload from local" to select a capa JSON file from your computer (with a version higher than 7.0.0).
- Or, paste a URL to a capa JSON file and click the arrow button to load it.
- Alternatively, use the "Preview Static" or "Preview Dynamic" for sample data.

3. **Explore the Results**:

- Use the tree view to navigate through the identified capabilities.
- Toggle between different views using the checkboxes in the settings panel:
- "Show capabilities by function/process" for grouped analysis.
- "Show library rule matches" to include or exclude library rules.

4. **Interact with the Data**:
- Expand/collapse nodes in the TreeTable to see more details.
- Use the search and filter options to find specific features or capabilities (rules).
- Right click on rule names to view their source code or additional information.

## Feedback and Contributions

We welcome your feedback and contributions to improve the web-based Capa Explorer. Please report any issues or suggest enhancements through the `capa` GitHub repository.

---

For developers interested in building or contributing to Capa Explorer WebUI, please refer to our [Development Guide](DEVELOPMENT.md).
13 changes: 13 additions & 0 deletions web/explorer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/public/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Capa Explorer</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions web/explorer/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
Loading
Loading