muaddib-scanner 1.0.5 → 1.0.7

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/README.md CHANGED
@@ -9,10 +9,18 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <img src="https://img.shields.io/badge/version-1.0.0-blue" alt="Version">
12
+ <img src="https://img.shields.io/npm/v/muaddib-scanner" alt="npm version">
13
+ <img src="https://img.shields.io/npm/dt/muaddib-scanner" alt="npm downloads">
13
14
  <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
14
15
  <img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen" alt="Node">
15
- <img src="https://img.shields.io/badge/IOCs-58%2B%20packages-red" alt="IOCs">
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="#installation">Installation</a> |
20
+ <a href="#utilisation">Utilisation</a> |
21
+ <a href="#features">Features</a> |
22
+ <a href="#vs-code">VS Code</a> |
23
+ <a href="#discord">Discord</a>
16
24
  </p>
17
25
 
18
26
  ---
@@ -28,14 +36,26 @@ MUAD'DIB detecte ET guide la reponse.
28
36
  | Detection IOCs | Oui | Oui | Oui |
29
37
  | Analyse AST | Oui | Oui | Non |
30
38
  | Analyse Dataflow | Oui | Non | Non |
39
+ | Detection Typosquatting | Oui | Oui | Non |
31
40
  | Playbooks reponse | Oui | Non | Non |
41
+ | Score de risque | Oui | Oui | Oui |
32
42
  | SARIF / GitHub Security | Oui | Oui | Oui |
33
43
  | MITRE ATT&CK mapping | Oui | Non | Non |
44
+ | Webhook Discord/Slack | Oui | Non | Non |
45
+ | Extension VS Code | Oui | Oui | Oui |
46
+ | Mode daemon | Oui | Non | Non |
34
47
  | 100% Open Source | Oui | Non | Non |
35
48
 
36
49
  ---
37
50
 
38
51
  ## Installation
52
+
53
+ ### npm (recommande)
54
+ ```bash
55
+ npm install -g muaddib-scanner
56
+ ```
57
+
58
+ ### Depuis les sources
39
59
  ```bash
40
60
  git clone https://github.com/DNSZLSK/muad-dib.git
41
61
  cd muad-dib
@@ -48,13 +68,20 @@ npm install
48
68
 
49
69
  ### Scan basique
50
70
  ```bash
51
- node bin/muaddib.js scan .
52
- node bin/muaddib.js scan /chemin/vers/projet
71
+ muaddib scan .
72
+ muaddib scan /chemin/vers/projet
73
+ ```
74
+
75
+ ### Score de risque
76
+
77
+ Chaque scan affiche un score de risque 0-100 :
78
+ ```
79
+ [SCORE] 58/100 [███████████░░░░░░░░░] HIGH
53
80
  ```
54
81
 
55
82
  ### Mode explain (details complets)
56
83
  ```bash
57
- node bin/muaddib.js scan . --explain
84
+ muaddib scan . --explain
58
85
  ```
59
86
 
60
87
  Affiche pour chaque detection :
@@ -63,41 +90,62 @@ Affiche pour chaque detection :
63
90
  - References (articles, CVEs)
64
91
  - Playbook de reponse
65
92
 
66
- ### Export JSON
93
+ ### Export
67
94
  ```bash
68
- node bin/muaddib.js scan . --json > results.json
95
+ muaddib scan . --json > results.json # JSON
96
+ muaddib scan . --html rapport.html # HTML
97
+ muaddib scan . --sarif results.sarif # SARIF (GitHub Security)
69
98
  ```
70
99
 
71
- ### Rapport HTML
100
+ ### Seuil de severite
72
101
  ```bash
73
- node bin/muaddib.js scan . --html rapport.html
102
+ muaddib scan . --fail-on critical # Fail seulement sur CRITICAL
103
+ muaddib scan . --fail-on high # Fail sur HIGH et CRITICAL (defaut)
104
+ muaddib scan . --fail-on medium # Fail sur MEDIUM, HIGH, CRITICAL
74
105
  ```
75
106
 
76
- ### Rapport SARIF (GitHub Security)
107
+ ### Webhook Discord/Slack
77
108
  ```bash
78
- node bin/muaddib.js scan . --sarif results.sarif
109
+ muaddib scan . --webhook "https://discord.com/api/webhooks/..."
79
110
  ```
80
111
 
81
- ### Seuil de severite
112
+ Envoie une alerte avec le score et les menaces sur Discord ou Slack.
113
+
114
+ ### Surveillance temps reel
82
115
  ```bash
83
- node bin/muaddib.js scan . --fail-on critical # Fail seulement sur CRITICAL
84
- node bin/muaddib.js scan . --fail-on high # Fail sur HIGH et CRITICAL (defaut)
85
- node bin/muaddib.js scan . --fail-on medium # Fail sur MEDIUM, HIGH, CRITICAL
116
+ muaddib watch .
86
117
  ```
87
118
 
88
- ### Surveillance temps reel
119
+ ### Mode daemon
89
120
  ```bash
90
- node bin/muaddib.js watch .
121
+ muaddib daemon
122
+ muaddib daemon --webhook "https://discord.com/api/webhooks/..."
91
123
  ```
92
124
 
125
+ Surveille automatiquement tous les `npm install` et scanne les nouveaux packages.
126
+
93
127
  ### Mise a jour des IOCs
94
128
  ```bash
95
- node bin/muaddib.js update
129
+ muaddib update
96
130
  ```
97
131
 
98
132
  ---
99
133
 
100
- ## Detection
134
+ ## Features
135
+
136
+ ### Detection typosquatting
137
+
138
+ MUAD'DIB detecte les packages dont le nom ressemble a un package populaire :
139
+ ```
140
+ [HIGH] Package "lodahs" ressemble a "lodash" (swapped_chars). Possible typosquatting.
141
+ ```
142
+
143
+ ### Analyse dataflow
144
+
145
+ Detecte quand du code lit des credentials ET les envoie sur le reseau :
146
+ ```
147
+ [CRITICAL] Flux suspect: lecture credentials (readFileSync, GITHUB_TOKEN) + envoi reseau (fetch)
148
+ ```
101
149
 
102
150
  ### Attaques detectees
103
151
 
@@ -121,10 +169,36 @@ node bin/muaddib.js update
121
169
  | Reverse shell | T1059.004 | Pattern |
122
170
  | Dead man's switch | T1485 | Pattern |
123
171
  | Code obfusque | T1027 | Heuristiques |
172
+ | Typosquatting | T1195.002 | Levenshtein |
124
173
  | Supply chain compromise | T1195.002 | IOC matching |
125
174
 
126
175
  ---
127
176
 
177
+ ## VS Code
178
+
179
+ L'extension VS Code scanne automatiquement vos projets npm.
180
+
181
+ ### Installation
182
+
183
+ Le dossier `vscode-extension/` contient l'extension. Pour tester :
184
+
185
+ 1. Ouvrir le dossier `vscode-extension` dans VS Code
186
+ 2. Appuyer sur F5
187
+ 3. Dans la nouvelle fenetre, ouvrir un projet npm
188
+
189
+ ### Commandes
190
+
191
+ - `MUAD'DIB: Scan Project` - Scanner tout le projet
192
+ - `MUAD'DIB: Scan Current File` - Scanner le fichier actuel
193
+
194
+ ### Configuration
195
+
196
+ - `muaddib.autoScan` - Scanner automatiquement a l'ouverture (defaut: true)
197
+ - `muaddib.webhookUrl` - URL webhook Discord/Slack
198
+ - `muaddib.failLevel` - Niveau d'alerte (critical/high/medium/low)
199
+
200
+ ---
201
+
128
202
  ## Integration CI/CD
129
203
 
130
204
  ### GitHub Actions
@@ -144,8 +218,8 @@ jobs:
144
218
  - uses: actions/setup-node@v4
145
219
  with:
146
220
  node-version: '20'
147
- - run: npm install
148
- - run: node bin/muaddib.js scan . --sarif results.sarif
221
+ - run: npm install -g muaddib-scanner
222
+ - run: muaddib scan . --sarif results.sarif
149
223
  - uses: github/codeql-action/upload-sarif@v3
150
224
  with:
151
225
  sarif_file: results.sarif
@@ -155,6 +229,15 @@ Les alertes apparaissent dans Security > Code scanning alerts.
155
229
 
156
230
  ---
157
231
 
232
+ ## Discord
233
+
234
+ Rejoignez le serveur Discord pour :
235
+ - Recevoir les alertes de scan
236
+ - Partager des IOCs
237
+ - Contribuer au projet
238
+
239
+ ---
240
+
158
241
  ## Architecture
159
242
  ```
160
243
  MUAD'DIB Scanner
@@ -162,12 +245,16 @@ MUAD'DIB Scanner
162
245
  +-- IOC Match (YAML DB)
163
246
  +-- AST Parse (acorn)
164
247
  +-- Pattern Matching (shell, scripts)
248
+ +-- Typosquat Detection (Levenshtein)
165
249
  |
166
250
  v
167
251
  Dataflow Analysis (credential read -> network send)
168
252
  |
169
253
  v
170
254
  Threat Enrichment (rules, MITRE ATT&CK, playbooks)
255
+ |
256
+ v
257
+ Output (CLI, JSON, HTML, SARIF, Webhook)
171
258
  ```
172
259
 
173
260
  ---
@@ -195,7 +282,7 @@ Editez les fichiers YAML dans `iocs/` :
195
282
  git clone https://github.com/DNSZLSK/muad-dib.git
196
283
  cd muad-dib
197
284
  npm install
198
- node bin/muaddib.js scan test/samples --explain
285
+ npm test
199
286
  ```
200
287
 
201
288
  ---
package/bin/muaddib.js CHANGED
@@ -4,6 +4,7 @@ const { run } = require('../src/index.js');
4
4
  const { updateIOCs } = require('../src/ioc/updater.js');
5
5
  const { watch } = require('../src/watch.js');
6
6
  const { startDaemon } = require('../src/daemon.js');
7
+ const { runScraper } = require('../src/ioc/scraper.js');
7
8
 
8
9
  const args = process.argv.slice(2);
9
10
  const command = args[0];
@@ -58,6 +59,7 @@ if (!command) {
58
59
  Defaut: high (fail sur HIGH et CRITICAL)
59
60
  --webhook [url] Envoie une alerte Discord/Slack
60
61
  muaddib daemon [options] Lance le daemon de surveillance
62
+ muaddib scrape Scrape les advisories pour nouveaux IOCs
61
63
  `);
62
64
  process.exit(0);
63
65
  }
@@ -88,6 +90,14 @@ if (command === 'scan') {
88
90
  console.log('muaddib update - Met a jour les IOCs');
89
91
  } else if (command === 'daemon') {
90
92
  startDaemon({ webhook: webhookUrl });
93
+ } else if (command === 'scrape') {
94
+ runScraper().then(result => {
95
+ console.log(`[OK] ${result.added} nouveaux IOCs ajoutes (total: ${result.total})`);
96
+ process.exit(0);
97
+ }).catch(err => {
98
+ console.error('[ERREUR]', err.message);
99
+ process.exit(1);
100
+ });
91
101
  } else {
92
102
  console.log(`Commande inconnue: ${command}`);
93
103
  process.exit(1);