osintkit 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/osintkit.js +32 -20
- package/osintkit/__init__.py +1 -1
- package/osintkit/__pycache__/__init__.cpython-311.pyc +0 -0
- package/osintkit/__pycache__/cli.cpython-311.pyc +0 -0
- package/osintkit/__pycache__/config.cpython-311.pyc +0 -0
- package/osintkit/__pycache__/profiles.cpython-311.pyc +0 -0
- package/osintkit/__pycache__/risk.cpython-311.pyc +0 -0
- package/osintkit/__pycache__/scanner.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/__init__.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/breach.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/brokers.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/certs.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/dark_web.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/gravatar.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/harvester.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/hibp.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/hibp_kanon.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/holehe.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/libphonenumber_info.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/paste.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/phone.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/sherlock.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/social.cpython-311.pyc +0 -0
- package/osintkit/modules/__pycache__/wayback.cpython-311.pyc +0 -0
- package/osintkit/modules/stage2/__pycache__/__init__.cpython-311.pyc +0 -0
- package/osintkit/modules/stage2/__pycache__/github_api.cpython-311.pyc +0 -0
- package/osintkit/modules/stage2/__pycache__/hunter.cpython-311.pyc +0 -0
- package/osintkit/modules/stage2/__pycache__/leakcheck.cpython-311.pyc +0 -0
- package/osintkit/modules/stage2/__pycache__/numverify.cpython-311.pyc +0 -0
- package/osintkit/modules/stage2/__pycache__/securitytrails.cpython-311.pyc +0 -0
- package/osintkit/output/__pycache__/__init__.cpython-311.pyc +0 -0
- package/osintkit/output/__pycache__/html_writer.cpython-311.pyc +0 -0
- package/osintkit/output/__pycache__/json_writer.cpython-311.pyc +0 -0
- package/osintkit/output/__pycache__/md_writer.cpython-311.pyc +0 -0
- package/package.json +1 -1
- package/postinstall.js +69 -50
- package/pyproject.toml +1 -1
- package/osintkit/__pycache__/__main__.cpython-311.pyc +0 -0
package/bin/osintkit.js
CHANGED
|
@@ -1,42 +1,54 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const { spawn } = require('child_process');
|
|
2
|
+
const { spawn, spawnSync } = require('child_process');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
|
|
6
|
-
// The npm package root is one level up from bin/
|
|
7
6
|
const packageDir = path.dirname(path.dirname(__filename));
|
|
7
|
+
const isWin = process.platform === 'win32';
|
|
8
|
+
|
|
9
|
+
const venvPython = isWin
|
|
10
|
+
? path.join(packageDir, '.venv', 'Scripts', 'python.exe')
|
|
11
|
+
: path.join(packageDir, '.venv', 'bin', 'python3');
|
|
12
|
+
|
|
13
|
+
// If venv doesn't exist yet, run postinstall first (self-healing first run)
|
|
14
|
+
if (!fs.existsSync(venvPython)) {
|
|
15
|
+
const postinstall = path.join(packageDir, 'postinstall.js');
|
|
16
|
+
if (fs.existsSync(postinstall)) {
|
|
17
|
+
console.log('osintkit: first run — setting up Python environment...');
|
|
18
|
+
const r = spawnSync(process.execPath, [postinstall], {
|
|
19
|
+
stdio: 'inherit',
|
|
20
|
+
cwd: packageDir,
|
|
21
|
+
});
|
|
22
|
+
if (!fs.existsSync(venvPython)) {
|
|
23
|
+
console.error('\nosintkit: setup failed. Run manually:');
|
|
24
|
+
console.error(` node ${postinstall}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
8
29
|
|
|
9
|
-
// Prefer venv Python (installed by postinstall), fall back to system Python.
|
|
10
|
-
// Checks both Unix (.venv/bin/) and Windows (.venv/Scripts/) paths.
|
|
11
30
|
function findPython() {
|
|
31
|
+
// Prefer venv Python (Unix + Windows)
|
|
12
32
|
const venvCandidates = [
|
|
13
|
-
path.join(packageDir, '.venv', 'bin', 'python3'),
|
|
14
|
-
path.join(packageDir, '.venv', 'bin', 'python'),
|
|
15
|
-
path.join(packageDir, '.venv', 'Scripts', 'python.exe'),
|
|
16
|
-
path.join(packageDir, 'venv', 'bin', 'python3'),
|
|
17
|
-
path.join(packageDir, 'venv', '
|
|
18
|
-
path.join(packageDir, 'venv', 'Scripts', 'python.exe'), // Windows alt name
|
|
33
|
+
path.join(packageDir, '.venv', 'bin', 'python3'),
|
|
34
|
+
path.join(packageDir, '.venv', 'bin', 'python'),
|
|
35
|
+
path.join(packageDir, '.venv', 'Scripts', 'python.exe'),
|
|
36
|
+
path.join(packageDir, 'venv', 'bin', 'python3'),
|
|
37
|
+
path.join(packageDir, 'venv', 'Scripts', 'python.exe'),
|
|
19
38
|
];
|
|
20
39
|
for (const p of venvCandidates) {
|
|
21
40
|
if (fs.existsSync(p)) return p;
|
|
22
41
|
}
|
|
23
|
-
|
|
24
42
|
// Fall back to system Python
|
|
25
|
-
const systemCandidates =
|
|
26
|
-
? ['python', 'python3']
|
|
27
|
-
: ['python3.11', 'python3', 'python'];
|
|
43
|
+
const systemCandidates = isWin ? ['python', 'python3'] : ['python3.11', 'python3', 'python'];
|
|
28
44
|
for (const bin of systemCandidates) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return bin;
|
|
32
|
-
} catch (_) {}
|
|
45
|
+
const r = spawnSync(bin, ['--version'], { stdio: 'pipe' });
|
|
46
|
+
if (r.status === 0) return bin;
|
|
33
47
|
}
|
|
34
48
|
return 'python3';
|
|
35
49
|
}
|
|
36
50
|
|
|
37
51
|
const pythonBin = findPython();
|
|
38
|
-
|
|
39
|
-
// Always set PYTHONPATH so the package is importable regardless of install method
|
|
40
52
|
const env = {
|
|
41
53
|
...process.env,
|
|
42
54
|
PYTHONPATH: process.env.PYTHONPATH
|
package/osintkit/__init__.py
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -1,75 +1,94 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* osintkit postinstall —
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Installs:
|
|
7
|
-
* 1. Core Python deps (typer, rich, httpx, pydantic, etc.) from requirements.txt
|
|
8
|
-
* 2. Optional OSINT tools (maigret, holehe, sherlock) from requirements-tools.txt
|
|
9
|
-
*
|
|
10
|
-
* Uses --break-system-packages on Linux/macOS where needed (Python 3.11+).
|
|
11
|
-
* Falls back gracefully if pip isn't available.
|
|
3
|
+
* osintkit postinstall — creates a venv inside the package dir and installs
|
|
4
|
+
* all Python dependencies into it. The npm shim (bin/osintkit.js) will then
|
|
5
|
+
* always find and use this venv's Python, avoiding any system Python confusion.
|
|
12
6
|
*/
|
|
13
7
|
|
|
14
|
-
const {
|
|
8
|
+
const { spawnSync } = require('child_process');
|
|
15
9
|
const path = require('path');
|
|
16
10
|
const fs = require('fs');
|
|
17
11
|
|
|
18
12
|
const packageDir = __dirname;
|
|
13
|
+
const venvDir = path.join(packageDir, '.venv');
|
|
19
14
|
const req = path.join(packageDir, 'requirements.txt');
|
|
20
15
|
const reqTools = path.join(packageDir, 'requirements-tools.txt');
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
// Platform-aware paths inside the venv
|
|
18
|
+
const isWin = process.platform === 'win32';
|
|
19
|
+
const venvPython = isWin
|
|
20
|
+
? path.join(venvDir, 'Scripts', 'python.exe')
|
|
21
|
+
: path.join(venvDir, 'bin', 'python3');
|
|
22
|
+
const venvPip = isWin
|
|
23
|
+
? path.join(venvDir, 'Scripts', 'pip.exe')
|
|
24
|
+
: path.join(venvDir, 'bin', 'pip3');
|
|
25
|
+
|
|
26
|
+
function findSystemPython() {
|
|
27
|
+
const candidates = isWin
|
|
28
|
+
? ['python', 'python3']
|
|
29
|
+
: ['python3.13', 'python3.12', 'python3.11', 'python3.10', 'python3'];
|
|
30
|
+
for (const bin of candidates) {
|
|
31
|
+
const r = spawnSync(bin, ['--version'], { encoding: 'utf8' });
|
|
32
|
+
if (r.status === 0) {
|
|
33
|
+
// Must be >= 3.10
|
|
34
|
+
const match = (r.stdout || r.stderr || '').match(/Python (\d+)\.(\d+)/);
|
|
35
|
+
if (match && (parseInt(match[1]) > 3 || parseInt(match[2]) >= 10)) {
|
|
36
|
+
return bin;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
28
39
|
}
|
|
29
40
|
return null;
|
|
30
41
|
}
|
|
31
42
|
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
43
|
+
function run(cmd, args, opts = {}) {
|
|
44
|
+
const r = spawnSync(cmd, args, { encoding: 'utf8', cwd: packageDir, ...opts });
|
|
45
|
+
return r;
|
|
46
|
+
}
|
|
37
47
|
|
|
38
|
-
|
|
48
|
+
console.log('\nosintkit: setting up Python environment...\n');
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} catch (_) {}
|
|
50
|
+
// Step 1: find a usable Python 3.10+
|
|
51
|
+
const sysPython = findSystemPython();
|
|
52
|
+
if (!sysPython) {
|
|
53
|
+
console.log(' ❌ Python 3.10+ not found.');
|
|
54
|
+
console.log(' Install from https://python.org then re-run: npm install -g osintkit\n');
|
|
55
|
+
process.exit(0);
|
|
56
|
+
}
|
|
57
|
+
console.log(` ✅ Found Python: ${sysPython}`);
|
|
49
58
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
console.log(`
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log(` ⚠️ ${label}: could not install (${err.message.split('\n')[0]})`);
|
|
59
|
+
// Step 2: create venv (skip if already exists)
|
|
60
|
+
if (!fs.existsSync(venvPython)) {
|
|
61
|
+
console.log(` 🔧 Creating venv at ${venvDir} ...`);
|
|
62
|
+
const r = run(sysPython, ['-m', 'venv', venvDir]);
|
|
63
|
+
if (r.status !== 0) {
|
|
64
|
+
console.log(' ❌ Failed to create venv.');
|
|
65
|
+
console.log(` ${(r.stderr || '').trim()}`);
|
|
66
|
+
console.log(' Try: python3 -m venv .venv (in the package dir)\n');
|
|
67
|
+
process.exit(0);
|
|
60
68
|
}
|
|
69
|
+
console.log(' ✅ Venv created');
|
|
70
|
+
} else {
|
|
71
|
+
console.log(' ✅ Venv already exists');
|
|
61
72
|
}
|
|
62
73
|
|
|
63
|
-
|
|
74
|
+
// Step 3: upgrade pip inside venv
|
|
75
|
+
run(venvPython, ['-m', 'pip', 'install', '--upgrade', 'pip', '-q']);
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
console.log(
|
|
69
|
-
|
|
77
|
+
// Step 4: install deps into venv
|
|
78
|
+
function pipInstall(requirementsFile, label) {
|
|
79
|
+
if (!fs.existsSync(requirementsFile)) return;
|
|
80
|
+
console.log(` 📦 Installing ${label}...`);
|
|
81
|
+
const r = run(venvPython, ['-m', 'pip', 'install', '-r', requirementsFile, '-q', '--disable-pip-version-check']);
|
|
82
|
+
if (r.status === 0) {
|
|
83
|
+
console.log(` ✅ ${label} installed`);
|
|
84
|
+
} else {
|
|
85
|
+
const err = (r.stderr || r.stdout || '').trim().split('\n').slice(-3).join('\n');
|
|
86
|
+
console.log(` ❌ ${label} failed:\n ${err}`);
|
|
87
|
+
console.log(` Fix: ${venvPython} -m pip install -r ${requirementsFile}`);
|
|
88
|
+
}
|
|
70
89
|
}
|
|
71
90
|
|
|
72
|
-
pipInstall(
|
|
73
|
-
pipInstall(
|
|
91
|
+
pipInstall(req, 'Core dependencies (typer, rich, httpx...)');
|
|
92
|
+
pipInstall(reqTools, 'OSINT tools (maigret, holehe, sherlock)');
|
|
74
93
|
|
|
75
|
-
console.log('\
|
|
94
|
+
console.log('\n ✅ osintkit ready. Run: osintkit new\n');
|
package/pyproject.toml
CHANGED
|
Binary file
|