Conditions | 8 |
Paths | 24 |
Total Lines | 43 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 22 |
CRAP Score | 8 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | 5 | public function getLinks ($content) |
|
8 | { |
||
9 | 5 | $key = pack('H*', "8C35192D964DC3182C6F84F3252239EB4A320D2500000000"); |
|
10 | 5 | $iv = pack('H*', "a3d5a33cb95ac1f5cbdb1ad25cb0a7aa"); |
|
11 | 5 | $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CFB, ''); |
|
12 | 5 | mcrypt_generic_init($cipher, $key, $iv); |
|
13 | |||
14 | 5 | $content = @pack('H*', $content); |
|
15 | |||
16 | 5 | $links = []; |
|
17 | 5 | if (stripos($content, "\xDA") !== false) |
|
18 | { |
||
19 | 1 | $links = explode("\xDA", $content); |
|
20 | } |
||
21 | 4 | else if (stripos($content, "\n") !== false) |
|
22 | { |
||
23 | 3 | $links = explode("\n", $content); |
|
24 | } |
||
25 | |||
26 | 5 | $urls = []; |
|
27 | 5 | foreach ($links as $link) |
|
28 | { |
||
29 | 4 | if (empty($link)) |
|
30 | { |
||
31 | 4 | continue; |
|
32 | } |
||
33 | |||
34 | 4 | $text = @mdecrypt_generic($cipher, base64_decode($link)); |
|
35 | 4 | if (empty($text)) |
|
36 | { |
||
37 | 1 | continue; |
|
38 | } |
||
39 | |||
40 | 3 | $urls[] = $text; |
|
41 | } |
||
42 | |||
43 | 5 | if (empty($urls) && error_get_last()) |
|
44 | { |
||
45 | 2 | throw new \RuntimeException(error_get_last()['message']); |
|
46 | } |
||
47 | |||
48 | 3 | return $urls; |
|
49 | } |
||
50 | } |