Installations
npm install body-fingerprint
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
16.19.1
NPM Version
8.19.3
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
thepicture
Download Statistics
Total Downloads
1,095
Last Day
1
Last Week
6
Last Month
31
Last Year
188
GitHub Statistics
67 Commits
1 Watching
2 Branches
1 Contributors
Bundle Size
12.03 kB
Minified
4.25 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.4.0
Package Id
body-fingerprint@1.4.0
Unpacked Size
31.92 kB
Size
8.19 kB
File Count
5
NPM Version
8.19.3
Node Version
16.19.1
Publised On
03 Dec 2023
Total Downloads
Cumulative downloads
Total Downloads
1,095
Last day
-88.9%
1
Compared to previous day
Last week
-57.1%
6
Compared to previous week
Last month
1,450%
31
Compared to previous month
Last year
-79.3%
188
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
No dependencies detected.
body-fingerprint
Install
1npm install body-fingerprint
Usage
1const express = require("express"); 2const app = express(); 3 4const { bodyFingerprint, jsonFingerprint } = require("body-fingerprint"); 5 6app.use(bodyFingerprint); 7app.use(jsonFingerprint); 8 9app.get("/", (_, res) => 10 res.send(` 11<script> 12body = new FormData(); 13body.set('a', 'b'); 14body.set('c', 'd'); 15body.set('e', new File([], '')) 16fetch('/', { 17 method: 'post', 18 body}) 19 .then((res) => res.text()) 20 .then((res) => document.body.insertAdjacentHTML( 21 'beforebegin', 22 '<span style="white-space: pre-line">' + res + '</span>' 23 )); 24fetch('/', { 25 method: 'post', 26 headers: {'content-type': 'application/json'}, 27 body: JSON.stringify({ 28 a: 'b', 29 c: 'd', 30 e: { 31 f: 'g' 32 } 33 }) 34}) 35 .then((res) => res.text()) 36 .then((res) => document.body.insertAdjacentHTML( 37 'beforebegin', 38 '<span style="white-space: pre-line">' + res + '</span>' 39 )) 40</script> 41`) 42); 43 44app.post("/", (req, res) => { 45 res.send([req.multipart.fingerprint, req.json.fingerprint]); 46}); 47 48app.listen(3000);
Multipart Fingerprint
Request:
POST /multipart HTTP/1.1
Host: example.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary1234567890123456
------WebKitFormBoundary1234567890123456
Content-Disposition: form-data; name="a"
b
------WebKitFormBoundary1234567890123456
Content-Disposition: form-data; name="c"
d
------WebKitFormBoundary1234567890123456
Content-Disposition: form-data; name="e"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundary1234567890123456--
Generated req.multipart
object:
1{ 2 "parts": [ 3 { 4 "attributes": { 5 "order": ["name"] 6 }, 7 "headers": { 8 "order": ["Content-Disposition"] 9 } 10 }, 11 { 12 "attributes": { 13 "order": ["name"] 14 }, 15 "headers": { 16 "order": ["Content-Disposition"] 17 } 18 }, 19 { 20 "attributes": { 21 "order": ["name", "filename"] 22 }, 23 "headers": { 24 "order": ["Content-Disposition", "Content-Type"] 25 } 26 } 27 ] 28}
JSON Fingerprint
Request:
1POST /json HTTP/1.1
2Host: example.com
3Content-Type: application/json
4
5{
6 a: 1,
7 b: {
8 c: 2,
9 d: 3,
10 }
11}
Generated req.json
object:
1{ 2 "fingerprint": "a,b,c,d", 3 "order": ["a", "b", "c", "d"], 4 "spaces": [" ", "\r", " \r", ... "\r"] // spaces fingerprint of json structure 5}
Options
depthFirstOrder
- traverses keys using depth-first search
1{ 2 a: 1, 3 b: { 4 c: 2, 5 d: 3, 6 } 7}
produces a,c,d,b
if depthFirstOrder
is true
. false
by default
Entropy
A property value representing Shannon entropy. null
by default
-
For multipart access through
req.multipart.entropy
-
For JSON access through
req.json.entropy
Test
1npm test
No vulnerabilities found.
No security vulnerabilities found.
Gathering detailed insights and metrics for body-fingerprint