Skip to content

Commit

Permalink
Brute force
Browse files Browse the repository at this point in the history
  • Loading branch information
cb1kenobi committed Jul 16, 2024
1 parent 51639d9 commit 05a6d6f
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions test/get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fs from 'node:fs';
import { describe, expect, it } from 'vitest';
import winreglib from '../src/index.js';
const { spawnSync } = require('node:child_process');
import { spawn } from 'node:child_process';
import snooplogg from 'snooplogg';

const { log } = snooplogg('test:winreglib');
Expand Down Expand Up @@ -96,15 +97,29 @@ describe('get()', () => {
expect(value).toBeGreaterThanOrEqual(0);
});

it('should get an 64-bit integer value', () => {
spawnSync(
'reg',
[
'query',
'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Diagnostics\\DiagTrack\\TraceManager'
],
{ stdio: 'inherit' }
);
it('should get an 64-bit integer value', async () => {
await new Promise<void>(resolve => {
const child = spawn(
'reg',
['query', 'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion', '/s'],
{ stdio: 'pipe' }
);
let buffer = '';
child.stdout.on('data', data => {
buffer += data.toString();
});
child.on('close', () => {
const chunks = buffer.split('\n\n');
for (const chunk of chunks) {
if (chunk.includes('REG_QWORD')) {
console.log('-'.repeat(80));
console.log(chunk);
console.log('-'.repeat(80));
}
}
resolve();
});
});
const value = winreglib.get(
'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Diagnostics\\DiagTrack\\TraceManager',
'diagStartTime'
Expand Down

0 comments on commit 05a6d6f

Please sign in to comment.