Fixed path-event filter
This commit is contained in:
parent
3bda688b1e
commit
cb117273a7
28
index.html
28
index.html
@ -6,31 +6,11 @@
|
||||
</head>
|
||||
<body>
|
||||
<script type="module">
|
||||
import {ArgParser} from './dist/index.mjs';
|
||||
import {PES, PathEvent} from './dist/index.mjs';
|
||||
const perm = PES`storage/test/john-flag.png:r`;
|
||||
const perms = [ 'logs/Momentum:c', 'storage/test:r', 'data/Repos:r', 'email:c' ];
|
||||
|
||||
const hostname = 'test';
|
||||
const argParser = new ArgParser('botnet-manager.js', 'Connect & manage a network of servers to launch distributed attacks.', [
|
||||
new ArgParser('copy', 'Copy file & dependencies to botnet', [
|
||||
{name: 'file', desc: 'File to copy', default: false},
|
||||
{name: 'control', desc: 'Copy to master server', flags: ['-c', '--control'], default: false},
|
||||
{name: 'noDeps', desc: 'Skip copying dependencies', flags: ['-d', '--no-deps'], default: false},
|
||||
{name: 'slave', desc: 'Copy to slave servers', flags: ['-s', '--slave'], default: false},
|
||||
]),
|
||||
new ArgParser('join', 'Connect server as a botnet slave', [
|
||||
{name: 'device', desc: 'Device to connect, defaults to the current machine', optional: true, default: hostname}
|
||||
]),
|
||||
new ArgParser('kill', 'Kill any scripts running on the botnet'),
|
||||
new ArgParser('leave', 'Disconnect worker node from swarm', [
|
||||
{name: 'device', desc: 'Device to disconnect, defaults to the current machine', optional: true, default: hostname}
|
||||
]),
|
||||
new ArgParser('run', 'Copy & run script on the botnet', [
|
||||
{name: 'script', desc: 'Script to copy & execute', type: 'string'},
|
||||
{name: 'args', desc: 'Arguments for script. Forward the current target with: {{TARGET}}', optional: true, extras: true},
|
||||
]),
|
||||
new ArgParser('start', 'Start this server as the botnet manager'),
|
||||
{name: 'silent', desc: 'Suppress program output', flags: ['-s', '--silent'], default: false},
|
||||
]);
|
||||
console.log(argParser.help({}));
|
||||
console.log(PathEvent.filter(perms, perm));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ztimson/utils",
|
||||
"version": "0.23.6",
|
||||
"version": "0.23.7",
|
||||
"description": "Utility library",
|
||||
"author": "Zak Timson",
|
||||
"license": "MIT",
|
||||
|
@ -142,7 +142,7 @@ export class PathEvent {
|
||||
const parsedFind = makeArray(filter).map(pe => new PathEvent(pe));
|
||||
return parsedTarget.filter(t => {
|
||||
if(!t.fullPath && t.all) return true;
|
||||
return !!parsedFind.find(f => t.fullPath.startsWith(f.fullPath)
|
||||
return !!parsedFind.find(f => f.fullPath.startsWith(t.fullPath)
|
||||
&& (f.all || t.all || t.methods.intersection(f.methods).length));
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user