RE: HOWTO - GOAUTODIAL 4 AND VICIDIAL SAME BOX - SOLVED ยป bp.pl.txt
1 |
#!/usr/bin/perl |
---|---|
2 |
|
3 |
if (length($ARGV[0])>1) |
4 |
{ |
5 |
$i=0; |
6 |
|
7 |
while ($#ARGV >= $i) |
8 |
{ |
9 |
$args = "$args $ARGV[$i]"; |
10 |
$i++; |
11 |
} |
12 |
|
13 |
if ($args =~ /--pass=/i) |
14 |
{ |
15 |
@data_in = split(/--pass=/,$args); |
16 |
$pass = $data_in[1]; |
17 |
$pass =~ s/ .*//gi; |
18 |
|
19 |
$php_script = ' |
20 |
require("dbconnect_mysqli.php"); |
21 |
require("functions.php"); |
22 |
|
23 |
$stmt = "SELECT pass_key,pass_cost FROM system_settings;"; |
24 |
$rslt=mysql_to_mysqli($stmt, $link); |
25 |
$qm_conf_ct = mysqli_num_rows($rslt); |
26 |
|
27 |
if ($qm_conf_ct > 0) |
28 |
{ |
29 |
$row=mysqli_fetch_row($rslt); |
30 |
$SSpass_key = $row[0]; |
31 |
$SSpass_cost = $row[1]; |
32 |
|
33 |
$pass_options = ["cost" => $SSpass_cost,"salt" => base64_encode($SSpass_key)]; |
34 |
$pass_hash = password_hash($argv[1], PASSWORD_BCRYPT, $pass_options); |
35 |
$pass_hash = substr($pass_hash, 29, 31); |
36 |
echo "PHASH: $pass_hash\n"; |
37 |
} |
38 |
'; |
39 |
|
40 |
open my $sm, "|php -r '$php_script' -- $pass" or die "could not run inline php script"; |
41 |
close $sm; |
42 |
} |
43 |
} |