Skip to content

Commit

Permalink
5.0 - vite (#68)
Browse files Browse the repository at this point in the history
* initial vite conversion

* remove more deps

* more cleanup

* get eslint passing and using vue airbnb config

* update yarn command
  • Loading branch information
vinnybod committed Jan 6, 2023
1 parent 1498968 commit fadf6d1
Show file tree
Hide file tree
Showing 40 changed files with 840 additions and 8,630 deletions.
2 changes: 0 additions & 2 deletions .browserslistrc

This file was deleted.

27 changes: 24 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
require('@rushstack/eslint-patch/modern-module-resolution');

const path = require('node:path');
const createAliasSetting = require('@vue/eslint-config-airbnb/createAliasSetting');

module.exports = {
root: true,
env: {
node: true,
es2021: true,
},
extends: [
'plugin:vue/recommended',
'@vue/airbnb',
'@vue/eslint-config-airbnb',
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
Expand All @@ -16,9 +21,25 @@ module.exports = {
allowModifiers: true,
}],
'no-param-reassign': 'off',
'import/no-unresolved': 'error',
// This is probably a good idea, but I don't want to diverge all the file names right now
// while maintaining 4.x and 5.x.
'vue/multi-word-component-names': 'off',
'vue/max-len': ['error', {
code: 120,
ignoreComments: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
ignoreUrls: true,
}],
},
settings: {
...createAliasSetting({
'@': `${path.resolve(__dirname, './src')}`,
}),
},
parserOptions: {
parser: 'babel-eslint',
},
overrides: [
{
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ yarn

### Compile and hot-reload for development
```
yarn serve
yarn dev
```

### Compile and minify for production
Expand Down
5 changes: 0 additions & 5 deletions babel.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

19 changes: 19 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/favicon.ico">
<title>Starkiller</title>
</head>
<body>
<noscript>
<strong>We're sorry but starkiller doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app">
</div>
<!-- built files will be auto injected -->
<script type="module" src="/src/main.js"></script>
</body>
</html>
34 changes: 11 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
"version": "2.0.0-beta3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint"
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src"
},
"main": "background.js",
"dependencies": {
"@fontsource/roboto": "^4.5.1",
"@fortawesome/fontawesome-free": "^5.15.4",
"@mdi/font": "5.9.55",
"axios": "^0.24.0",
"chai-as-promised": "^7.1.1",
"lodash.debounce": "^4.0.8",
"moment": "^2.29.1",
"portal-vue": "^2.1.7",
Expand All @@ -32,23 +30,13 @@
"vuex-persistedstate": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.18",
"@vue/cli-plugin-e2e-cypress": "^4.5.18",
"@vue/cli-plugin-eslint": "^4.5.18",
"@vue/cli-plugin-router": "^4.5.18",
"@vue/cli-plugin-unit-mocha": "^4.5.18",
"@vue/cli-plugin-vuex": "^4.5.18",
"@vue/cli-service": "^4.5.18",
"@vue/eslint-config-airbnb": "^5.3.0",
"babel-eslint": "^10.0.3",
"chai": "^4.3.4",
"deepmerge": "^4.2.2",
"eslint": "^7.27.0",
"@rushstack/eslint-patch": "^1.2.0",
"@vitejs/plugin-vue2": "^2.2.0",
"@vue/eslint-config-airbnb": "^7.0.0",
"eslint": "^8.31.0",
"eslint-plugin-vue": "^9.8.0",
"sass": "^1.34.1",
"sass-loader": "^10.0.0",
"vue-cli-plugin-vuetify": "^2.4.8",
"vuetify-loader": "^1.7.0",
"webpack-bundle-analyzer": "^4.5.0"
"sass": "^1.57.1",
"unplugin-vue-components": "^0.22.12",
"vite": "^3"
}
}
3 changes: 3 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,21 @@
<a
class="mr-2"
target="_blank"
rel="noopener noreferrer"
href="https://github.com/bc-security/starkiller"
> Starkiller </a>
<span class="mr-2">|</span>
<a
class="mr-2"
target="_blank"
rel="noopener noreferrer"
href="https://github.com/bc-security/empire"
> Empire</a>
<span class="mr-2">|</span>
<a
class="mr-2"
target="_blank"
rel="noopener noreferrer"
href="https://github.com/sponsors/BC-SECURITY"
> Sponsor for extra features</a>
</v-footer>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
:title="user.name"
class="sc-message--avatar"
:style="{
backgroundImage: `url(${user.imageUrl})`
backgroundImage: `url(${user.imageUrl})`,
}"
>
<div :class="user.online ? 'online-indicator' : 'offline-indicator'" />
Expand Down
1 change: 1 addition & 0 deletions src/components/DynamicFormInput.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- eslint-disable vue/no-v-text-v-html-on-component -->
<template>
<div>
<v-switch
Expand Down
1 change: 1 addition & 0 deletions src/components/InfoViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
:key="index"
medium
target="_blank"
rel="noopener noreferrer"
class="mr-1 mb-1"
>
{{ formatDisplayName(author) }}
Expand Down
5 changes: 4 additions & 1 deletion src/components/SideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
two-line
>
<v-list-item-avatar>
<img src="../../src/assets/icon.png">
<img
src="../../src/assets/icon.png"
alt="Starkiller Icon"
>
</v-list-item-avatar>

<v-list-item-content>
Expand Down
1 change: 1 addition & 0 deletions src/components/TechniqueChips.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
small
:href="getTechniqueUrl(tech)"
target="_blank"
rel="noopener noreferrer"
color="green"
class="mr-1 mb-1"
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/agents/AgentCommandHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
:sort-by="sortBy"
:sort-desc="sortDesc"
:server-items-length="totalItems"
:footer-props="{'items-per-page-options': [10, 25, 50, 100]}"
:footer-props="{ 'items-per-page-options': [10, 25, 50, 100] }"
:items-per-page.sync="itemsPerPage"
:loading="loading"
:page="currentPage"
Expand Down
6 changes: 4 additions & 2 deletions src/components/agents/AgentExecuteModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,15 @@ export default {
this.loading = true;
const result = await Promise.allSettled(this.agents
.map((agent) => moduleApi.executeModule(this.selectedModule,
.map((agent) => moduleApi.executeModule(
this.selectedModule,
{
...this.form,
Agent: agent,
},
this.ignoreAdminCheck,
this.ignoreLanguageCheck)));
this.ignoreLanguageCheck,
)));
if (result.some((item) => item.status === 'rejected')) {
const split = result.reduce((acc, val) => {
Expand Down
8 changes: 3 additions & 5 deletions src/components/agents/AgentFileBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import Vue from 'vue';
import * as agentApi from '@/api/agent-api';
import debounce from 'lodash.debounce';
import pause from '@/utils/pause';
import ExecuteModuleDialog from './ExecuteModuleDialog.vue';
export default {
Expand Down Expand Up @@ -252,7 +253,7 @@ export default {
let complete = 0;
while (i < 10) {
// eslint-disable-next-line no-await-in-loop
await this.pause(6000);
await pause(6000);
// eslint-disable-next-line no-await-in-loop
if (await this.checkTaskComplete(task.id)) {
complete = true;
Expand Down Expand Up @@ -330,9 +331,6 @@ export default {
children: serverElement.is_file === false ? [] : undefined,
};
},
pause(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
},
async loadChildren(a, { stopTrying } = {}) {
if (this.currentlyLoading[a.id]) return Promise.resolve();
Expand All @@ -352,7 +350,7 @@ export default {
let complete = false;
while (i < 10) {
// eslint-disable-next-line no-await-in-loop
await this.pause(6000);
await pause(6000);
// eslint-disable-next-line no-await-in-loop
if (await this.checkTaskComplete(task.id)) {
console.log('task complete', task.id);
Expand Down
2 changes: 1 addition & 1 deletion src/components/agents/AgentForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default {
form: {},
moment,
workingHoursRules: [
(v) => new RegExp('^[0-9]{1,2}:[0-5][0-9]-[0-9]{1,2}:[0-5][0-9]$').test(v) || 'Must be in the format 00:00-24:00',
(v) => /^[0-9]{1,2}:[0-5][0-9]-[0-9]{1,2}:[0-5][0-9]$/.test(v) || 'Must be in the format 00:00-24:00',
],
nameRules: [
(v) => !!v || 'Name is required',
Expand Down
Loading

0 comments on commit fadf6d1

Please sign in to comment.