-
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
Showing
17 changed files
with
113 additions
and
63 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
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,7 @@ | ||
import { ErrorBase } from "../utils/error.ts"; | ||
|
||
export type ErrorName = | ||
| "LIBREOFFICE" | ||
| "VSCODE"; | ||
|
||
export class ApplicationError extends ErrorBase<ErrorName> {} |
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,17 +1,18 @@ | ||
import { ElfInfo } from "../../types/linux/elf.d.ts"; | ||
import { LinuxError } from "./errors.ts"; | ||
|
||
/** | ||
* Function to parse an `elf` executable. | ||
* @param path Full path to a `elf` file | ||
* @returns Basic `ElfInfo` interface or null | ||
* @returns Basic `ElfInfo` interface or LinuxError | ||
*/ | ||
export function getElf(path: string): ElfInfo | null { | ||
//@ts-ignore: Custom Artemis function | ||
const data = Deno.core.ops.get_elf(path); | ||
if (data === "") { | ||
return null; | ||
export function getElf(path: string): ElfInfo | LinuxError { | ||
try { | ||
//@ts-ignore: Custom Artemis function | ||
const data = Deno.core.ops.get_elf(path); | ||
const elf: ElfInfo = JSON.parse(data); | ||
return elf; | ||
} catch (err) { | ||
return new LinuxError("ELF", `failed to parse elf ${path}: ${err}`); | ||
} | ||
|
||
const elf: ElfInfo = JSON.parse(data); | ||
return elf; | ||
} |
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,7 @@ | ||
import { ErrorBase } from "../utils/error.ts"; | ||
|
||
export type ErrorName = | ||
| "ELF" | ||
| "JOURNAL"; | ||
|
||
export class LinuxError extends ErrorBase<ErrorName> {} |
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,17 +1,21 @@ | ||
import { Journal } from "../../types/linux/journal.d.ts"; | ||
import { LinuxError } from "./errors.ts"; | ||
|
||
/** | ||
* Function to parse a `journal` file | ||
* @param path Path to journal file. It should end with `.journal`. | ||
* @returns Array of `Journal` entries | ||
*/ | ||
export function getJournal(path: string): Journal[] | null { | ||
//@ts-ignore: Custom Artemis function | ||
const data = Deno.core.ops.get_journal(path); | ||
if (data === "") { | ||
return null; | ||
export function getJournal(path: string): Journal[] | LinuxError { | ||
try { | ||
//@ts-ignore: Custom Artemis function | ||
const data = Deno.core.ops.get_journal(path); | ||
const journal: Journal[] = JSON.parse(data); | ||
return journal; | ||
} catch (err) { | ||
return new LinuxError( | ||
"JOURNAL", | ||
`failed to parse journal file ${path}: ${err}`, | ||
); | ||
} | ||
|
||
const journal: Journal[] = JSON.parse(data); | ||
return journal; | ||
} |
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,17 +1,21 @@ | ||
import { Fsevents } from "../../types/macos/fsevents.d.ts"; | ||
import { MacosError } from "./errors.ts"; | ||
|
||
/** | ||
* Function to parse the `FsEvents` on a macOS system | ||
* @param path Full path to a `fsevents` file | ||
* @returns Array of `FsEvent` records | ||
*/ | ||
export function getFsevents(path: string): Fsevents[] | null { | ||
//@ts-ignore: Custom Artemis function | ||
const data = Deno.core.ops.get_fsevents(path); | ||
if (data === "") { | ||
return null; | ||
export function getFsevents(path: string): Fsevents[] | MacosError { | ||
try { | ||
//@ts-ignore: Custom Artemis function | ||
const data = Deno.core.ops.get_fsevents(path); | ||
const fsevents: Fsevents[] = JSON.parse(data); | ||
return fsevents; | ||
} catch (err) { | ||
return new MacosError( | ||
"FSEVENTS", | ||
`failed to parse fsevents ${path}: ${err}`, | ||
); | ||
} | ||
|
||
const fsevents: Fsevents[] = JSON.parse(data); | ||
return fsevents; | ||
} |
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,17 +1,18 @@ | ||
import { MachoInfo } from "../../types/macos/macho.d.ts"; | ||
import { MacosError } from "./errors.ts"; | ||
|
||
/** | ||
* Function to parse a `macho` executable. | ||
* @param path Full path to a `macho` file | ||
* @returns Basic `MachoInfo` interface array or null | ||
* @returns Basic `MachoInfo` interface array or MacosError | ||
*/ | ||
export function getMacho(path: string): MachoInfo[] | null { | ||
//@ts-ignore: Custom Artemis function | ||
const data = Deno.core.ops.get_macho(path); | ||
if (data === "") { | ||
return null; | ||
export function getMacho(path: string): MachoInfo[] | MacosError { | ||
try { | ||
//@ts-ignore: Custom Artemis function | ||
const data = Deno.core.ops.get_macho(path); | ||
const macho: MachoInfo[] = JSON.parse(data); | ||
return macho; | ||
} catch (err) { | ||
return new MacosError("MACHO", `filed to parse macho file ${path}: ${err}`); | ||
} | ||
|
||
const macho: MachoInfo[] = JSON.parse(data); | ||
return macho; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ErrorBase } from "../utils/error.ts"; | ||
|
||
export type ErrorName = "PE"; | ||
|
||
export class WindowsError extends ErrorBase<ErrorName> {} |
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,17 +1,18 @@ | ||
import { PeInfo } from "../../types/windows/pe.d.ts"; | ||
import { WindowsError } from "./errors.ts"; | ||
|
||
/** | ||
* Function to parse a `pe` executable. | ||
* @param path Full path to a `pe` file | ||
* @returns Basic `PeInfo` interface or null | ||
* @returns Basic `PeInfo` interface or WindowsError | ||
*/ | ||
export function getPe(path: string): PeInfo | null { | ||
//@ts-ignore: Custom Artemis function | ||
const data: string = Deno.core.ops.get_pe(path); | ||
if (data === "") { | ||
return null; | ||
export function getPe(path: string): PeInfo | WindowsError { | ||
try { | ||
//@ts-ignore: Custom Artemis function | ||
const data: string = Deno.core.ops.get_pe(path); | ||
const result: PeInfo = JSON.parse(data); | ||
return result; | ||
} catch (err) { | ||
return new WindowsError("PE", `failed to parse pe file ${path}: ${err}`); | ||
} | ||
|
||
const result: PeInfo = JSON.parse(data); | ||
return result; | ||
} |
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