-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
209 lines (187 loc) · 6.93 KB
/
index.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
const fs = require('fs')
const figlet = require('figlet');
const process = require('process');
const exec = require('child_process').exec;
const { stdout, stderr } = require('process');
threads = null
currentThreads = null
currentPort = 65534
toCheck = null
var processes = {}
counter = 0
origLength = 0
twilbal = "$0 USD."
function isDebug() {
try {
require("./secretHacker.txt")
debugMode = true
console.log("Debugging mode enabled!")
}
catch (err) {
debugMode = false
}
}
function debug(message) {
if (debugMode == true) {
console.log(message)
}
}
function endProcess() {
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.on('data', process.exit.bind(process, 0));
}
function isConfig() {
try {
config = require('./config.json');
console.log("config.json successfully loaded!")
return true
} catch (err) {
debug(err)
console.log("Uh oh! config.json was not loaded properly. This is usually because you don't have a config.json file located in the directory of this program.")
console.log("An example file will be created if it is not already present. Press any key to exit.")
let example = {
"sid": "Your account SID. Found at https://www.twilio.com/console",
"token": "Your auth token. Found at https://www.twilio.com/console",
"number": "The phone number you have purchased from Twilio.",
"threads": "How many processes do you want running at once?",
"minimum": "What's the minimum $ value you want for a hit? Optional, but if not specified, $0 hits will be listed."
};
let data = JSON.stringify(example)
fs.writeFileSync('config.example.json', data)
endProcess()
return false
}
}
function isGoogle() {
try {
google = require('./google.json');
console.log("google.json successfully loaded!")
return true
}
catch (err) {
debug(err)
console.log("Uh oh! google.json was not loaded properly. This is usually because you don't have a google.json file located in the directory of this program.")
console.log("Visit this link and create a JSON key file from the service account of your Google Cloud project: https://cloud.google.com/docs/authentication/getting-started")
console.log("Place the JSON file in this directory, and rename it to google.json. Press any key to exit.")
endProcess()
return false
}
}
function isCombo() {
try {
combo = require('./combo.txt');
console.log("combo.txt successfully loaded!")
toCheck = fs.readFileSync('./combo.txt').toString().split('\n');
return true
}
catch (err) {
debug(err)
console.log("There is no combo.txt file. Create this file and insert valid 16 digit numbers line by line. For example:")
console.log("6094762943970634")
console.log("6077601261963598")
console.log("Once you've placed the file in this directory, relaunch the program. Press any key to exit.")
endProcess()
return false
}
}
// Twilio credential checker can go here, but we'll assume the user is competent enough to figure it out.
function splash() {
figlet.text(`Crack
Bucks`, {
font: 'Big Money-sw',
horizontalLayout: 'default',
verticalLayout: 'default',
width: 80,
whitespaceBreak: true
}, function (err, data) {
if (err) {
console.log('CRACKBUCKS');
debug(err);
return;
}
console.log(data);
});
setTimeout(function () {
console.log(`CrackBucks by Mehad.`)
}, 100)
}
function start() {
process.title = "CRACKBUCKS - mehad"
isDebug()
if (isConfig() && isGoogle() && isCombo()) {
debug("WARNING: config.json and google.json have not been checked for validity, just for existence. If you are debugging errors, check that these files contain the proper credentials.")
splash()
setTimeout(function () {
balanceChecker()
if (config.threads == undefined || config.threads == null || isNaN(config.threads)) {
console.log('Your config.json file does not contain a valid amount of threads. Please check your config.json file again. Press any key to exit.')
endProcess()
}
else if (toCheck == null || toCheck == undefined) {
console.log('Something is wrong with your combo.txt file. Please check it and try again. Press any key to exit.')
endProcess()
}
else {
console.log('Starting to crack!')
threads = config.threads
currentThreads = config.threads
origLength = toCheck.length
starterHelper()
}
}, 200)
}
}
function processStarter() {
if (currentPort < 1026) {
currentPort = 65534
processStarter()
}
else if (toCheck[0] == undefined || toCheck[0] == null) {
console.log(`Either the end of the list has been reached, or the combos.txt file has errors in it. You can end the process when all checks have completed.`)
}
else {
currentPort -= 1
counter += 1
goCheck = toCheck[0]
toCheck.shift()
balanceChecker()
debug(`Starting process on port ${currentPort} with number ${goCheck}`)
processes[counter] = exec(`node caller.js ${currentPort} ${goCheck}`,
(error, stdout, stderr) => {
debug(`Output: ${stdout} || Err: ${stderr}`);
if (error !== null) {
debug(`Error: ${error}`)
}
})
processes[counter].on('close', () => exitHandler())
processes[counter].on('error', () => exitHandler())
process.title = `CRACKBUCKS - mehad - Doing/done: ${origLength - toCheck.length} Todo: ${toCheck.length}/${origLength} Balance: ${twilbal}`
}
}
function exitHandler() {
// Hopefully this doesn't do something bad!
setTimeout(function () {
processStarter()
}, 250)
}
function starterHelper() {
if (currentThreads != 0 && !isNaN(threads) && !isNaN(currentThreads)) {
for (let i = 0; i < currentThreads; i++) {
setTimeout(function () {
processStarter()
}, 250)
}
}
}
function balanceChecker() {
const twilio = require('twilio')(config.sid, config.token)
twilio.balance.fetch()
.then((data) => {
const balance = Math.round(data.balance * 100) / 100;
const currency = data.currency;
twilbal = `$${balance} ${currency}`
return twilbal
});
}
start()