Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
puffyCid committed Nov 15, 2023
1 parent 69bf6cc commit bb75a1f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion artemis-docs/docs/API/Artifacts/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Parse Windows ShimDB files at provided drive letter.
| ----- | -------- | ---------------------------------- |
| drive | `string` | Drive letter to get Windows ShimDB |

### getCustomShimdb(path) -> `Shimdb[]`
### getCustomShimdb(path) -> `Shimdb[] | WindowsError`

Parse Windows ShimDB file at provided path.

Expand Down
6 changes: 4 additions & 2 deletions src/windows/errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ErrorBase } from "../utils/error.ts";

export type ErrorName = "PE";
export type ErrorName =
| "PE"
| "SHIMDB";

export class WindowsError extends ErrorBase<ErrorName> {}
export class WindowsError extends ErrorBase<ErrorName> { }
17 changes: 9 additions & 8 deletions src/windows/shimdb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Shimdb } from "../../types/windows/shimdb.d.ts";
import { WindowsError } from "./errors.ts";

/**
* Function to parse `ShimDB` entries on the systemdrive
Expand Down Expand Up @@ -31,13 +32,13 @@ export function getAltShimdb(drive: string): Shimdb[] {
* @param path full path to custom sdb file
* @returns Shimdb info
*/
export function getCustomShimdb(path: string): Shimdb | null {
//@ts-ignore: Custom Artemis function
const data: string = Deno.core.ops.get_custom_shimdb(path);
if (data === "") {
return null;
export function getCustomShimdb(path: string): Shimdb | WindowsError {
try {
//@ts-ignore: Custom Artemis function
const data: string = Deno.core.ops.get_custom_shimdb(path);
const results: Shimdb = JSON.parse(data);
return results;
} catch (err) {
return new WindowsError('SHIMDB', `failed to parse sdb ${path}: ${err}`);
}

const results: Shimdb = JSON.parse(data);
return results;
}

0 comments on commit bb75a1f

Please sign in to comment.