-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.php
More file actions
78 lines (72 loc) · 2.51 KB
/
Copy pathapi.php
File metadata and controls
78 lines (72 loc) · 2.51 KB
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
<?php
function router($fname, $cpid)
{
$headers = [
"Referer: http://192.168.1.1/default.html",
"Origin: http://192.168.1.1",
"Content-Type: application/json",
"_TclRequestVerificationKey: XXX", // placeholder, no need to add key
"_TclRequestVerificationToken: XXX", // replace XXX with the TclRequestVerificationToken
];
$payload = [
"id" => $cpid,
"jsonrpc" => "2.0",
"method" => $fname,
"params" => "{}",
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_URL, "http://192.168.1.1/jrd/webapi");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$result_dec = json_decode($result, true);
if (isset($result["error"]["message"])) {
echo "ERROR: " . $result["error"]["message"];
} else {
if ($fname === "GetUsageSettings") {
echo "\n***TRAFFIC***\n" . $result_dec["result"]["UsedData"] / pow(1024, 3) ." GB\n\n"; // traffico
}
echo "\n\n****************************** " . $fname . " ******************************\n";
//var_dump($result);
$result2 = json_decode($result, true);
echo json_encode($result2, JSON_PRETTY_PRINT);
}
}
// router("PLAYLOAD", "ID");
router("GetUsageSettings", "0");
router("HeartBeat", "2.3");
router("GetCurrentTime", "27.55");
router("GetConnectionState", "88.1");
router("GetApSystemInfo", "80.6");
router("GetModemSystemInfo", "50.8");
router("GetApStatus", "82.2");
router("GetSimStatus", "73.9");
router("GetModemStatus", "20.8");
router("GetConnectedDeviceList", "82.5");
router("GetLanPortInfo", "28.6");
router("GetLanSettings", "53.2");
router("GetWanSettings", "60.3");
router("getDMZInfo", "4.8");
router("GetSMSStorageState", "25.6");
router("GetQosSettings", "98.4");
// Wlan
router("GetWlanStatistics", "99.7");
router("GetWlanSettings", "40.7");
router("GetWlanSupportMode", "99.8");
// SIP
router("GetSIPServerSettings", "98.3");
router("GetSIPAccountSettings", "98.4");
// Other
router("GetUsageRecord", "98.4");
router("GetConnectionSettings", "98.4");
router("GetMacFilterSettings", "98.4");
router("GetParentalSettingsr", "98.4");
router("GetProfileList", "98.4");
router("GetWPSConnectionState", "98.4");
router("GetLanStatistics", "98.4");
router("GetNetworkSettings", "98.4");
router("GetNetworkInfo", "98.4");
router("GetDdnsSettings", "98.4");
?>