This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.php
115 lines (100 loc) · 2.99 KB
/
main.php
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
<?php
require __DIR__ . '/vendor/autoload.php';
use Cvar1984\LiteOtp\Otp;
use Amp\Parallel\Worker;
use Amp\Promise;
$app = new Otp();
if ($app->os != 'Linux') {
$R = '';
$RR = '';
$G = '';
$GG = '';
$B = '';
$BB = '';
$Y = '';
$YY = '';
$X = '';
} else {
$R = "\e[91m";
$RR = "\e[91;7m";
$G = "\e[92m";
$GG = "\e[92;7m";
$B = "\e[36m";
$BB = "\e[36;7m";
$Y = "\e[93m";
$YY = "\e[93;7m";
$X = "\e[0m";
}
echo <<<BANNER
$Y _ _ _ ___ _____ ____
| | (_) |_ ___ / _ \_ _| _ \
| | | | __/ _ \ | | || | | |_) |
| |___| | || __/ |_| || | | __/
|_____|_|\__\___|\___/ |_| |_|
$R++++++++++++++++++++++++++++++++++++++
$B Author :$G $app->author
$B Github :$G $app->github
$B Team :$G $app->team
$B Version :$G $app->version
$B Date :$G $app->date
$B OS :$G $app->os
$R++++++++++++++++++++++++++++++++++++++$X
BANNER;
try {
if ($argc < 2) throw new \InvalidArgumentException('Read README.md');
$providers = ['tokopedia', 'jdid', 'phd', 'pedulisehat'];
if (is_numeric($argv[1])) {
$number = $argv[1];
while (1) {
foreach ($providers as $provider) {
printf(
'%sSend OTP to %s[%s]%s%s',
$G,
$Y,
$number,
$X,
PHP_EOL
);
printf('%sProvider %s[%s]%s%s', $G, $Y, $provider, $X, PHP_EOL);
$promises[$provider] = Worker\enqueueCallable(
'\Cvar1984\\LiteOtp\\Otp::' . $provider,
$number
);
$responses = Promise\wait(Promise\all($promises));
/* foreach($responses as $key => $value) */
/* { */
/* echo $value; */
/* } */
}
}
}
$fileName = $argv[1];
if (!is_file($fileName)) throw new \Exception($fileName . ' Is not a file');
if (!is_readable($fileName)) throw new \Exception('Permission denied');
$content = file_get_contents($fileName);
$content = trim($content, " \t\n\r\0\x0B"); //remove whitespace
$numbers = explode(PHP_EOL, $content);
while (1) {
foreach ($providers as $provider) {
foreach ($numbers as $index => $number) {
printf(
'%sSend OTP to %s[%s]%s%s',
$G,
$Y,
$number,
$X,
PHP_EOL
);
printf('%sProvider %s[%s]%s%s', $G, $Y, $provider, $X, PHP_EOL);
$promises[$index] = Worker\enqueueCallable(
'\Cvar1984\\LiteOtp\\Otp::' . $provider,
$number
);
$responses = Promise\wait(Promise\all($promises));
}
}
}
} catch (\Exception | \InvalidArgumentException $e) {
fprintf(STDERR, "%s%s%s\n", $RR, $e->getMessage(), $X);
exit(1);
}