· 9 years ago · Mar 29, 2017, 05:12 PM
1/**
2 * Created by root on 26.03.2017.
3 */
4//---Require---//
5var Client = require('instagram-private-api').V1;
6var fs = require('fs'), request = require('request');
7var colors = require("colors/safe")
8var console_input = process.openStdin();
9var ProgressBar = require('progress');
10var progress = require('request-progress');
11var dateTime = require('node-datetime');
12var $ = require("jsdom").env("", function(err, window) {
13 if (err) {
14 console.error(err);
15 return;
16 }
17
18 $ = require("jquery")(window);
19});
20const readline = require('readline');
21const rl = readline.createInterface({
22 input: process.stdin,
23 output: process.stdout
24});
25
26
27var gagScraper = require('9gag-scraper')
28var sizeOf = require('image-size');
29const http = require('http');
30const imageType = require('image-type');
31const readChunk = require('read-chunk');
32var jsonfile = require('jsonfile');
33var decache = require('decache');
34
35///---Variable---//
36
37var storage = new Client.CookieFileStorage(__dirname + '/cookies/someuser.json');
38var desc = ["Laughed way too hard 😀", "prayed for it! ðŸ™Â", "rock hard 🙌", "guess who's hypnotized 😵😵😵", "☠☠☠killing you ☠☠☠", "💩 poop 💩", "drove like a pro 😎", "meh ðŸ˜Â"];
39var tags = ["#love #TagsForLikes #ForLikes #TFLers","#tweegram #photooftheday #20likes #amazing","#smile #follow4follow #like4like #look","#instalike #igers #picoftheday #food","#instadaily #instafollow #followme #colorful","#only #instagood #bestoftheday #instacool","#instago #all_shots #follow #webstagram"];
40//var proxie = ["141.101.132.247:8085","5.62.154.105:8085","5.189.206.201:8085","91.204.14.249:8085","188.72.96.91:8085","95.181.177.239:8085","95.181.176.87:8085","95.181.218.217:8085","95.85.80.229:8085","95.85.80.227:8085","193.93.192.65:8085","185.2.32.105:8085","95.181.176.207:8085"]; //-> 0-3
41
42
43var proxie = ["5.230.31.129:2257","5.230.31.63:2191","5.230.31.228:2356","5.230.31.24:2152","5.230.31.6:2134","5.230.154.240:8418","5.230.154.237:8415","5.230.154.43:8221","5.230.154.41:8219","5.230.154.183:8361","5.230.154.63:8241","5.230.154.84:8262","5.230.154.35:8213","5.230.154.138:8316","5.230.154.140:8318","5.230.154.93:8271","5.230.154.38:8216","5.230.154.121:8299","5.230.154.239:8417","5.230.154.24:8202","5.230.153.106:8234","5.230.153.50:8178","5.230.153.238:8366","5.230.153.150:8278","5.230.153.208:8336","5.230.153.124:8252","5.230.153.174:8302","5.230.153.250:8378","5.230.153.41:8169","5.230.153.21:8149","5.230.153.200:8328","5.230.153.74:8202","5.230.153.8:8136","5.230.153.147:8275","5.230.153.112:8240","5.230.153.232:8360","5.230.153.136:8264","5.230.153.117:8245","5.230.153.142:8270","5.230.153.204:8332","5.230.153.91:8219","5.230.153.105:8233","5.230.153.95:8223","185.13.156.245:2373","185.13.156.109:2237","185.13.156.98:2226","185.13.156.162:2290","185.13.156.166:2294","185.13.156.70:2198","178.18.151.146:1273","178.18.151.216:1343","178.18.151.74:1201","178.18.151.57:1184","178.18.151.243:1370","178.18.151.61:1188","178.18.151.77:1204","178.18.151.200:1327","178.18.151.236:1363","178.18.151.161:1288","178.18.151.229:1356","178.18.151.26:1153","5.175.229.88:3218","5.175.229.16:3146","5.175.229.220:3350","5.175.229.250:3380","5.175.229.180:3310","5.175.229.74:3204","5.175.229.122:3252","5.175.229.105:3235","5.175.229.234:3364","5.175.229.155:3285","5.175.229.241:3371","5.175.229.28:3158","5.175.229.69:3199","5.175.229.177:3307","5.175.229.170:3300","5.175.229.127:3257","5.175.229.48:3178","5.175.229.103:3233","5.175.229.23:3153","5.175.229.81:3211","5.175.229.54:3184","5.175.229.57:3187","5.175.229.50:3180","5.175.229.201:3331","5.175.229.43:3173","185.114.141.54:2184","185.114.141.207:2337","185.114.141.141:2271","185.114.141.245:2375","185.114.141.138:2268","185.114.141.34:2164","185.114.141.51:2181","185.114.141.4:2134","185.114.141.251:2381","185.114.141.200:2330","185.114.141.68:2198","185.114.141.117:2247","185.114.141.90:2220","185.114.141.77:2207,149.56.15.184:40562","149.56.15.184:40563","149.56.15.184:40564","149.56.15.184:40565","149.56.15.184:40566","149.56.15.184:40567","149.56.15.184:40568","149.56.15.184:40569","149.56.15.184:40570"]
44
45
46var dt = dateTime.create();
47var d = dt.format('[H:M:S] ');
48
49var output = {
50
51 error : function (msg) {
52 console.log(colors.red(d + "---NOK: " + msg));
53 },
54 success : function (msg) {
55 console.log(colors.green(d + "---IOK: " + msg));
56 },
57 info : function (msg) {
58 console.log(colors.gray(d + "---ATT: " + msg));
59 },
60 fatal : function (msg) {
61 console.log(colors.red.underline("FATAL ERROR: " + msg));
62 }
63}
64
65//---Functions--//
66var download = function(uri, filename, callback){
67 var bar = new ProgressBar('Downloading [:bar] :percent', {
68 complete: '=',
69 incomplete: ' ',
70 total: 100,
71 width: 50,
72 renderThrottle: 1,
73 head: '>',
74 });
75
76 request.head(uri, function(err, res, body){
77 //output.info('Content-Type:', res.headers['content-type'] + "");
78 //output.info('Content-Length:', res.headers['content-length'] + "");
79
80 progress(request(uri), {
81
82 })
83 .on('progress', function (state) {
84 //console.log(state["percent"]);
85 bar.tick(state["percent"] * 100);
86 }).on('end', function () {
87 bar.tick(100);
88 }).pipe(fs.createWriteStream(filename)).on('close', callback);
89
90 });
91};
92
93function makeid()
94{
95 var text = "";
96 var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
97
98 for( var i=0; i < 5; i++ )
99 text += possible.charAt(Math.floor(Math.random() * possible.length));
100
101 return text;
102}
103
104
105function getRandomInt(min, max) {
106 return Math.floor(Math.random() * (max - min + 1)) + min;
107}
108
109
110
111
112
113function deUmlaut(value){
114 value = value.toLowerCase();
115 value = value.replace(/ä/g, 'ae');
116 value = value.replace(/ö/g, 'oe');
117 value = value.replace(/ü/g, 'ue');
118 value = value.replace(/ß/g, 'ss');
119 value = value.replace(/ /g, '-');
120 value = value.replace(/\./g, '');
121 value = value.replace(/,/g, '');
122 value = value.replace(/\(/g, '');
123 value = value.replace(/\)/g, '');
124 return value;
125}
126
127var usedProxy = 0;
128var usProxy = "";
129
130var client = {
131 SetRandomPic() {
132
133 var proxiex = "http://" + proxie[getRandomInt(0,proxiex.length - 1)];
134
135 output.info("Setting proxy: " + proxiex);
136
137 Client.Request.setProxy(proxiex);
138
139
140 var rand = getRandomInt(0, 100);
141 (output.info("Started Picture download..."));
142
143 download('https://unsplash.it/1080/?random', rand + ".jpeg", function() {
144
145 (output.success("Downloaded"));
146
147 Client.Session.create(device, storage, 'picoftheday998', 'deinemum').then(function(session) {
148
149 fs.rename(rand + ".jpeg", './photos/' + rand + ".jpeg");
150 (output.info("Started Picture uploading..."));
151
152 Client.Upload.photo(session, './photos/' + rand + '.jpeg').then(function(upload) {
153 (output.info("Picture ID: " + upload.params.uploadId));
154 Client.Media.configurePhoto(session, upload.params.uploadId, desc[getRandomInt(0,2)] + tags[getRandomInt(0,6)]);
155 })
156 .then(function() {
157 (output.success("Uploaded Random Picture"));
158 ask();
159 })
160 .catch(Client.Exceptions.AuthenticationError, function(error){
161 output.error(error);
162 })
163 })
164
165 })
166 },
167 Create() {
168
169 var proxiex = "http://" + proxie[getRandomInt(0,3)];
170
171 output.info(proxiex);
172
173 Client.Request.setProxy(proxiex);
174 var session = new Client.Session(device, storage);
175
176
177
178
179 request({
180 url: 'https://randomuser.me/api/?nat=de',
181 method: 'GET',
182 dataType: 'json'
183 }, function(err, res, body) {
184
185 obj = JSON.parse(body);
186
187 var first = obj.results[0]["name"]["first"];
188 var last = obj.results[0]["name"]["last"];
189
190 var username = (first + "_" + last + getRandomInt(100,9999));
191
192 var deusername = deUmlaut(username);
193
194 var email = (deusername + "@gmail.com");
195 new Client.AccountEmailCreator(session)
196 .setEmail(email)
197 .setUsername(deusername)
198 .setPassword('HRWFrhWFHR$G')
199 .setName(first + " " + last)
200 .register()
201 .spread(function(account, discover) {
202 output.success("Account " + deusername + " created.");
203 }).then(function() {
204 var file = 'assets/accounts.json';
205 var filecontent = fs.readFileSync(file, "utf8");
206 var string = "\r\n" + email + ":" + deusername + ":HRWFrhWFHR$G";
207 fs.writeFile(file, filecontent + string, (err) => {});
208 output.info("Account written to file.");
209 setTimeout(function(){ask()}, 1000);
210 }).catch(Client.Exceptions.ActionSpamError, function(error){
211 // Ok now we know that Instagram is asking us to
212 // prove that we are real users
213 output.error(error);
214 setTimeout(function(){ask()}, 500);
215 })
216
217 });
218
219 },
220 masscreate(){
221
222
223 if(proxie.length <= 0){
224 output.fatal("All proxies used, stopping...");
225 return;
226 }
227 var device = new Client.Device(makeid() + getRandomInt(0, 99999));
228 var leng = proxie.length - 1;
229
230 var random = getRandomInt(0,leng);
231
232
233 if(usProxy == ""){
234 output.success("Switched proxy!");
235 var proxiex = "http://" + proxie[random];
236 usProxy = proxiex;
237 }
238
239
240 output.info("Proxies left: " + (proxie.length * 4) - usedProxy);
241
242 Client.Request.setProxy(usProxy);
243 var session = new Client.Session(device, storage);
244
245 request({
246 url: 'https://randomuser.me/api/?nat=de',
247 method: 'GET',
248 dataType: 'json'
249 }, function(err, res, body) {
250 obj = JSON.parse(body);
251
252 var first = obj.results[0]["name"]["first"];
253 var last = obj.results[0]["name"]["last"];
254 var username = (first + "_" + last + getRandomInt(100,9999));
255 var deusername = deUmlaut(username);
256
257 var email = (deusername + "@gmail.com");
258 new Client.AccountEmailCreator(session)
259 .setEmail(email)
260 .setUsername(deusername)
261 .setPassword('HRWFrhWFHR$G')
262 .setName(first + " " + last)
263 .register()
264 .spread(function(account, discover) {
265 output.success("Account " + deusername + " created.");
266 }).then(function() {
267 var file = 'assets/accounts.json';
268 var filecontent = fs.readFileSync(file, "utf8");
269 var string = "\r\n" + email + ":" + deusername + ":" + usProxy;
270 fs.writeFile(file, filecontent + string, (err) => {});
271 output.info("Account written to file.");
272 usedProxy++;
273 if(usedProxy >= 3){
274 output.error("Proxy overused, switching...");
275 usProxy = "";
276 proxie.splice(random, 1);
277
278 }
279
280
281
282 setTimeout(function(){client.masscreate()}, 1000);
283 }).catch(Client.Exceptions.AccountRegistrationError, function(error){
284 output.info("31");
285 output.error(error);
286 client.masscreate();
287 }).catch(Client.Exceptions.InvalidUsername, function(error){
288 output.info("14");
289 output.error(error);
290 client.masscreate();
291 }).catch(Client.Exceptions.RequestError, function(error){
292 output.error("Proxy not useable, switching...");
293 // output.error(error);
294 usProxy = "";
295 // proxie.splice(random, 1);
296 client.masscreate();
297
298 }).catch(Client.Exceptions.ActionSpamError, function(error){
299 output.fatal("Proxy blocked, switching...");
300 // output.error(error);
301 usProxy = "";
302 proxie.splice(random, 1);
303 client.masscreate();
304
305 })
306
307 });
308
309 },
310
311
312 gag(times) {
313
314 var times = 2;
315
316 for (runs = 0; runs < times; runs++) {
317
318 (output.info("Run " + runs + "/" + times));
319
320 new gagScraper().getRandom(function (error, data) {
321
322 var mime = data.image.substr(data.image.length - 3);
323
324 (output.info("Started Picture download..."));
325 (output.success(mime));
326
327 if (mime !== "jpg") {
328 (output.error("Wrong MIME... Retry"));
329 retry();
330 return;
331 }
332
333
334 download(data.image, data.id + ".jpeg", function() {
335 var dimensions = sizeOf(data.id + ".jpeg");
336
337
338 if ((dimensions.width > 1080) || (dimensions.height > 1080)) {
339 (output.error("Wrong Dimension... Retry"));
340 retry();
341 return;
342
343 } else {
344 (output.success("Downloaded"));
345 Client.Session.create(device, storage, 'picoftheday998', 'deinemum').then(function(session) {
346
347 fs.rename(data.id + ".jpeg", './photos/' + data.id + ".jpeg");
348 (output.info("Started Picture uploading..."));
349
350 Client.Upload.photo(session, './photos/' + data.id + '.jpeg').then(function(upload) {
351 (output.info("Picture ID: " + upload.params.uploadId));
352 Client.Media.configurePhoto(session, upload.params.uploadId, data.title + " Visit 9GAG on: " + data.url);
353 }).then(function() {
354 (output.success("Uploaded Random Picture"));
355 ask();
356 })
357 })
358 output.error(data.image);
359 }
360 });
361
362 });
363
364
365 }
366
367 setTimeout(function(){ask(); runs = 0;}, 10000);
368 },
369 proxy() {
370
371 var rand = getRandomInt(0, 100);
372 (output.info("Started Picture download..."));
373
374 download('https://unsplash.it/1080/?random', rand + ".jpeg", function() {
375
376 (output.success("Downloaded"));
377
378 Client.Session.create(device, storage, 'picoftheday998', 'deinemum', "http://5.230.133.120:3247").then(function(session) {
379
380 fs.rename(rand + ".jpeg", './photos/' + rand + ".jpeg");
381 (output.info("Started Picture uploading..."));
382
383 Client.Upload.photo(session, './photos/' + rand + '.jpeg').then(function(upload) {
384 (output.info("Picture ID: " + upload.params.uploadId));
385 Client.Media.configurePhoto(session, upload.params.uploadId, desc[getRandomInt(0,2)] + tags[getRandomInt(0,6)]);
386 }).then(function() {
387 (output.success("Uploaded Random Picture"));
388 ask();
389 })
390 })
391
392 })
393 },
394 test() {
395 output.error("Nothin in here.");
396 }
397}
398
399
400
401
402
403
404
405
406
407
408function proxy() {
409
410 try{
411
412
413 var file = '/home/instagram/node_modules/assets/accounts.json';
414
415 var filecontent = fs.readFileSync(file, "utf8");
416
417
418 var fileArray = filecontent.split("\n");
419
420 output.info("File length: " + file.length + " FileArray: " + fileArray.length + " [0] " + fileArray[0]);
421
422
423
424 for(i = 0; i < fileArray.length; i++) {
425 setTimeout(function () {
426
427 var zeile = "" + fileArray.toString();
428
429 var test = zeile.split(":");
430 var user = "";
431 var password = "";
432 var port = "";
433 var ip = "";
434
435 user = test[1];
436 ip = test[3];
437 ip = ip.replace("//", "");
438 port = test[4];
439 output.success("\n test \nZeile: " + zeile + "\n" + "Test: " + test + "\n test \n");
440
441 output.info("1: " + test[1] +" 2: " + test[2] +" 3: " + test[3]);
442
443
444
445
446
447 var rand = getRandomInt(0, 1000);
448 (output.info("Started Picture download..."));
449
450 download('https://unsplash.it/1080/?random', rand + ".jpeg", function () {
451
452 (output.success("Downloaded"));
453 var proxy = "http://" + ip + ":" + port + "/";
454
455 output.fatal("Proxy: " + proxy);
456
457 var d = new Client.Device(makeid() + getRandomInt(0, 99999));
458
459 Client.Session.create(d, storage, user, 'HRWFrhWFHR$G', proxy).then(function (session) {
460
461 fs.rename(rand + ".jpeg", './photos/' + rand + ".jpeg");
462 (output.info("Started Picture uploading..."));
463
464 Client.Upload.photo(session, './photos/' + rand + '.jpeg').then(function (upload) {
465 (output.info("Picture ID: " + upload.params.uploadId));
466 Client.Media.configurePhoto(session, upload.params.uploadId, desc[getRandomInt(0, 2)] + tags[getRandomInt(0, 6)]);
467 }).then(function () {
468 (output.success("Uploaded Random Picture"));
469 //ask();
470 })
471 })
472
473 })
474
475
476 }, 7500 * i);
477 }
478
479
480
481 }catch(exception){
482 output.error(exception.stack);
483 //setTimeout(function(){likeImage(mediaId, usernum++)}, 1500);
484 return;
485 }
486
487
488}
489
490
491
492
493
494
495
496
497var mediaId = "";
498var executions = 0;
499
500function likeImage(url){
501 mediaId = url;
502 try{
503
504 var file = '/home/instagram/node_modules/assets/accounts.json';
505
506 var filecontent = fs.readFileSync(file, "utf8");
507
508
509 var fileArray = filecontent.split("\n");
510
511 output.info("File length: " + fileArray.length + " Content length: " + filecontent.length);
512
513
514
515 var len = fileArray.length - 1;
516 //for(i = 0; i < len; i--){
517 output.success("For started");
518 if(executions >= len){
519 //break;
520 return;
521 }
522 executions++;
523
524 output.error("Exe's: " + executions);
525
526
527 // setTimeout(function(){
528 //var likes = executions + 1;
529
530
531
532
533
534 var testt = "" + fileArray[executions];
535
536 output.info("Testt: " + testt);
537
538 var test = testt.split(":");
539 var user = "";
540
541 var eins = test[1];
542 var zwei = test[2];
543 var drei = test[3];
544 var noll = test[0];
545 var ip = "";
546 var port = "";
547 var password = "HRWFrhWFHR$G";
548
549 //output.info("1: " + eins + " 2 "+ zwei + " 3 " + drei);
550
551
552 user = test[1];
553 ip = test[3].replace("//", "");
554 port = test[4];
555
556 //output.fatal("IP: " + ip + " Port: " + port);
557
558
559 /*if(test[0].includes("test")){
560
561 password = test[2];
562 ip = test[3];
563 port = test[4];
564
565 }
566 */
567 //output.error("User: " + user + " Password: " + password + " For loop: " + executions);
568
569 var proxiex = "http://" + ip + ":" + port + "/";
570 output.success("Setting: " + proxiex);
571 var myUrl = proxiex;
572
573 Client.Request.setProxy(myUrl);
574
575
576 //karl_henning2816@gmail.com:karl_henning2816:HRWFrhWFHR$G
577
578 //email :user: password
579
580
581
582 output.info("Test: " + test);
583
584 output.info("Array: " + fileArray);
585
586 //var splittedUserr = fileArray[i++].toString();
587
588
589 //var splittedUser = test.split(",");
590
591 //output.info("Splitteduser: " + splittedUser);
592
593
594
595 // if(password == null || passwword == ""){output.error("Error converting")}
596
597 //var lol = password.split(("$G"));
598
599 //password = lol[0] + "$G";
600
601 output.info("User: " + user + " Password: " + password);
602
603 var d = new Client.Device(makeid() + getRandomInt(0, 99999));
604
605
606 Client.Session.create(d, storage, user, password, myUrl).then(function (session) {
607 new Client.Request(session)
608 .setMethod('POST')
609 .setResource('like', {id: mediaId})
610 .generateUUID()
611 .setData({
612 media_id: mediaId,
613 src: "profile"
614 })
615 .signPayload()
616 .send();
617
618 }).then(function(){
619
620
621
622 //session.destroy();
623
624 }).catch(Client.Exceptions.AuthenticationError, function(error){
625 output.error(error);
626 }).catch(Client.Exceptions.CheckpointError, function(error){
627 output.error(error);
628 }).catch(Client.Exceptions.RequestError, function(error){
629 output.error(error);
630 }).then(function(){
631 var usercache = './cookies/someuser.json';
632 var userobj = "";
633 jsonfile.writeFile(usercache, userobj, function() {})
634 }).catch(Client.Exceptions.CheckpointError, function(error) {
635 output.error("Please don't spam :/" + " " + error)
636 }).then(function(){
637 output.success("Liked the image.");
638 }).then(function(session){
639 decache("instagram-private-api");
640 var usercache = './cookies/someuser.json';
641 var userobj = "";
642 //jsonfile.writeFile(usercache, userobj);
643 //fs.closeSync(fs.openSync(usercache, 'w'));
644 var promise = $.getJSON("http://80.241.214.249/renew.php", null, null);
645 output.success("Cleared someuser.json");
646 //session.destroy();
647 decache("instagram-private-api");
648 output.success("Logged out");
649 setTimeout(function(){likeImage(mediaId)}, 5000);
650 })
651
652 //}, 5000 * i);
653
654
655
656
657
658 }catch(exception){
659 output.error("Catched: " + exception.stack);
660 likeImage(mediaId);
661 return;
662 }
663
664
665
666
667
668
669
670
671
672
673};
674
675function follow(user){
676
677
678
679 var file = '/home/instagram/node_modules/assets/accounts.json';
680
681 var filecontent = fs.readFileSync(file, "utf8");
682
683
684 var fileArray = filecontent.split("\n");
685
686
687 for(i = 0; i < fileArray.length; i++){
688
689
690
691 setTimeout(function(){follow("itsjustme_lara")}, 1500);
692
693 var splittedUser = fileArray[userarsch++].split(":");
694
695 output.info("Splitteduser: " + splittedUser);
696
697 var loginUser = splittedUser[1];
698
699 var d = new Client.Device(makeid() + getRandomInt(0, 99999));
700 Client.Session.create(d, storage, splittedUser, 'HRWFrhWFHR$G')
701 .then(function(session) {
702 // Now you have a session, we can follow / unfollow, anything...
703 // And we want to follow Instagram official profile
704 return [session, Client.Account.searchForUser(session, user)]
705 })
706 .spread(function(session, account) {
707 return Client.Relationship.create(session, account.id);
708 })
709 .then(function(relationship) {
710 console.log(relationship.params)
711 // {followedBy: ... , following: ... }
712 // Yey, you just followed @instagram
713 decache("instagram-private-api");
714 })
715
716
717 }
718
719
720
721
722}
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754function igurlretrieve(url) {
755
756 var urldsrc = "http://api.instagram.com/oembed?url=" + url;
757
758 //fetch data from URL data source
759 var x = new XMLHttpRequest();
760 x.open('GET', urldsrc, true);
761 x.send();
762
763 //load resulting JSON data as JS object
764 var urldata = JSON.parse(x.responseText);
765
766 //reconstruct data as "instagram://" URL that can be opened in iOS app
767 var reconsturl = "" + urldata.media_id;
768 return reconsturl;
769
770}
771
772
773function retry() {
774 setTimeout(function(){client.gag()}, 1000);
775}
776
777output.info("InstaBOT precompiling... Set!");
778
779ask();
780
781
782function ask() {
783 rl.question("Command: ",function(answer){
784 if (answer == "account") {
785 client.Create();
786 } else if (answer == "") {
787 return;
788 } else if (answer == "pic") {
789 //client.SetRandomPic();
790 client.SetRandomPic();
791 } else if (answer.substring(0, 3) == "gag") {
792 //client.SetRandomPic();
793 //client.gag(parseInt(answer.substring(3, 4)));
794 client.gag(2);
795 } else if (answer == "proxy") {
796 proxy();
797 } else if (answer == "exit") {
798 console.log(" ");
799 output.success("Quitting. Thanks!");
800 console.log(" ");
801 process.exit();
802 }else if(answer.split(" ")[0] == "like"){
803 console.log(" ");
804 likeImage(answer.split(" ")[1]);
805 }
806
807 else if (answer == "help") {
808 output.info("----------------------------");
809 output.info("Use pic/gag/exit to control.");
810 output.info("----------------------------");
811 ask();
812 } else if (answer == "test") {
813 client.test();
814 } else if (answer == "masscreate") {
815 client.masscreate();
816 } else {
817 output.info("The command you've entered is not available.");
818 ask();
819 }
820 })
821}
822
823process.openStdin().on("keypress", function(chunk, key) {
824 if(key && key.name === "c" && key.ctrl) {
825 console.log(" ");
826 output.error("Quitting. Please use exit to cancel the application.");
827 process.exit();
828 }
829});
830
831process.stdin.setRawMode(true);