venus-pit 1.1.4 → 1.1.6
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/LICENSE +373 -661
- package/dist/venus.bundle.js +2 -14
- package/dist/venus.bundle.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/tarpit/markov.js +1 -1
- package/src/lib/tarpit/pit.js +2 -2
- package/src/lib/tarpit/words/randomWord.js +3 -2
- package/src/venus.js +1 -0
- package/testing/venus.js +2 -14
- package/src/lib/tarpit/words/words.js +0 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "venus-pit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Express.js-based tarpit",
|
|
5
5
|
"main": "dist/venus.bundle.js",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"devbuild": "npm run build && cp dist/venus.bundle.js testing/venus.js"
|
|
15
15
|
},
|
|
16
16
|
"author": "Shrey Yadav",
|
|
17
|
-
"license": "
|
|
17
|
+
"license": "MPL-2.0",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"express": "^5.1.0"
|
|
20
20
|
},
|
package/src/lib/tarpit/markov.js
CHANGED
package/src/lib/tarpit/pit.js
CHANGED
|
@@ -41,8 +41,8 @@ function pit(app, instanceRoot, req) {
|
|
|
41
41
|
// reasonable server response time, should waste cpu cycles
|
|
42
42
|
setTimeout(() => {res.send(tar(pit(app, instanceRoot, req)))}, rand());
|
|
43
43
|
|
|
44
|
-
// prevent memory leak by cleaning up old routes
|
|
45
|
-
selfDestruct(newRoute)
|
|
44
|
+
// prevent memory leak by cleaning up old routes : add delay on garbage collection
|
|
45
|
+
setTimeout(() => {selfDestruct(newRoute)}, rand()*rand())
|
|
46
46
|
})
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import corpora from "../corpora.js"
|
|
2
2
|
import crypto from 'crypto'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// remove all non a-z, lowercase, split into tokens
|
|
5
|
+
let wordList = corpora.replace(/[^a-zA-Z ]/g, "").toLowerCase().split(/\s+/); // more efficient to just compute once
|
|
5
6
|
function randomWord() {
|
|
6
7
|
const index = crypto.randomInt(0, wordList.length);
|
|
7
8
|
return wordList[index];
|
package/src/venus.js
CHANGED
|
@@ -5,6 +5,7 @@ import { tar } from "./lib/tarpit/tar.js"
|
|
|
5
5
|
function venus(app, root="UNSET") {
|
|
6
6
|
const instanceRoot = new venusRoot(root);
|
|
7
7
|
console.log('path: ' + instanceRoot.path)
|
|
8
|
+
app.set('trust proxy', true) // fix ip detection
|
|
8
9
|
app.get(instanceRoot.path, (req, res) => {
|
|
9
10
|
let firsturl = pit(app, instanceRoot, req) // this will start the recursive hell known as a tarpit
|
|
10
11
|
res.send(tar(firsturl))
|