-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Johan
committed
Sep 23, 2019
1 parent
e3907c2
commit 98d0a31
Showing
20 changed files
with
80 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#!/usr/bin/env node | ||
export default { | ||
import { CommandDeclaration } from "../../../../types"; | ||
|
||
const declaration = (): CommandDeclaration => ({ | ||
description: "Copy or analyze firewall log" | ||
}; | ||
}); | ||
|
||
export default declaration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
#!/usr/bin/env node | ||
import { CommandDeclaration } from "../../../../types"; | ||
import ssh from "../../../ssh"; | ||
|
||
const transfer = (): void => { | ||
// TODO | ||
ssh.execute("cat /tmp/mnt/USB/skynet/skynet.log"); | ||
}; | ||
|
||
export default { | ||
const declaration = (): CommandDeclaration => ({ | ||
run: transfer, | ||
description: "Transfers the firewall log" | ||
}; | ||
}); | ||
|
||
export default declaration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
#!/usr/bin/env node | ||
import { CommandDeclaration } from "../../../types"; | ||
import ssh from "../../ssh"; | ||
|
||
const commands = (): void => { | ||
ssh.execute("ls -1 /usr/bin/ | grep -v '^d'"); | ||
}; | ||
|
||
export default { | ||
const declaration = (): CommandDeclaration => ({ | ||
description: "Lists files in /usr/bin", | ||
run: commands | ||
}; | ||
}); | ||
|
||
export default declaration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#!/usr/bin/env node | ||
export default { | ||
import { CommandDeclaration } from "../../../types"; | ||
|
||
const declaration = (): CommandDeclaration => ({ | ||
description: "Shows router information" | ||
}; | ||
}); | ||
|
||
export default declaration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
#!/usr/bin/env node | ||
import ssh from "../../ssh"; | ||
import { CommandDeclaration } from "../../../types"; | ||
|
||
const uptime = (): void => { | ||
ssh.execute("uptime"); | ||
}; | ||
|
||
export default { | ||
const declaration = (): CommandDeclaration => ({ | ||
description: "Display router uptime", | ||
run: uptime | ||
}; | ||
}); | ||
|
||
export default declaration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/usr/bin/env node | ||
import ssh from "../ssh"; | ||
import { CommandDeclaration } from "../../types"; | ||
|
||
const terminal = (args: string[]): void => { | ||
ssh.executeInTerminal(args); | ||
}; | ||
|
||
export default { | ||
run: terminal, | ||
helpname: "terminal [args]", | ||
const declaration = (): CommandDeclaration => ({ | ||
description: | ||
"Opens an ssh connection to the router and executes the args (optional)" | ||
}; | ||
"Opens an ssh connection to the router and executes the args (optional)", | ||
helpName: "terminal [args]", | ||
run: terminal | ||
}); | ||
|
||
export default declaration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#!/usr/bin/env node | ||
export interface Command { | ||
export default interface Command { | ||
args?: string[]; | ||
description: string; | ||
fullName: string; | ||
helpName: string; | ||
name: string; | ||
fullname: string; | ||
run: any; | ||
helpname: string; | ||
description: string; | ||
args?: string[]; | ||
subCommands: Command[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default interface CommandDeclaration { | ||
description?: string; | ||
helpName?: string; | ||
run?: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#!/usr/bin/env node | ||
import { Command } from "."; | ||
|
||
export interface CommandParser { | ||
export default interface CommandParser { | ||
isHelp: boolean; | ||
isDebug: boolean; | ||
all(): Command[]; | ||
find(): Command | null; | ||
all: () => Command[]; | ||
find: () => Command | null; | ||
stripOptions: () => string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import promptly from "promptly"; | ||
|
||
export type PromptBody = (message: string, opts: promptly.Options) => any; | ||
type PromptBody = (message: string, opts: promptly.Options) => any; | ||
|
||
export default PromptBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export enum PromptType { | ||
enum PromptType { | ||
Text, | ||
Password, | ||
Confirm | ||
} | ||
|
||
export default PromptType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export * from "./ConfigCreationData"; | ||
export * from "./Command"; | ||
export * from "./CommandParser"; | ||
export * from "./PromptType"; | ||
export * from "./PromptBody"; | ||
export * from "./SshConfig"; | ||
export { default as Command } from "./Command"; | ||
export { default as CommandDeclaration } from "./CommandDeclaration"; | ||
export { default as CommandParser } from "./CommandParser"; | ||
export { default as ConfigCreationData } from "./ConfigCreationData"; | ||
export { default as PromptType } from "./PromptType"; | ||
export { default as PromptBody } from "./PromptBody"; | ||
export { default as SshConfig } from "./SshConfig"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters