forked from cryptoGlance/cryptoGlance-web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.php
More file actions
129 lines (117 loc) · 4.49 KB
/
debug.php
File metadata and controls
129 lines (117 loc) · 4.49 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
//
// Author: Stoyvo (CryptoGlance)
//
// Description: This is a quick tool to get basic information from a specified API for mining software.
// The goal is to expand CryptoGlance to as many devices as possible and make this open to all crypto miners.
//
error_reporting(E_ERROR);
ini_set("display_errors", 1);
function runCMD($host, $port, $cmd) {
$response = '';
$socket = stream_socket_client('tcp://'.$host.':'.$port, $errno, $errstr, 5);
if (!$socket) {
die('Cannot connect to miner API. Please go <a href="" onclick="window.history.go(-1); return false;">back</a> and verify IP address and port.');
return null;
} else {
fwrite($socket, $cmd);
while (!feof($socket)) {
$response .= fgets($socket);
}
fclose($socket);
}
return str_replace("\0", '', $response);
}
?>
<html>
<head>
<title>Rig/Minger Debug Info</title>
</head>
<body>
<form action="" method="POST">
<table>
<tr>
<td>IP Address:</td>
<td><input type="text" name="address" value="<?php echo $_POST['address']; ?>" /></td>
<td></td>
</tr>
<tr>
<td>Port:</td>
<td><input type="text" name="port" value="<?php echo $_POST['port']; ?>" /></td>
<td></td>
</tr>
<tr>
<td colspan="3">
<button type="submit" name="submit" value="one">Test Miner</button>
or
<button type="submit" name="submit" value="all">Test All miners</button>
</td>
</tr>
</table>
</form>
<div style="font-size: 12px;margin-top:20px;"><a href="javascript:window.history.go(-1);">« Back to CryptoGlance</a>.</div>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
echo '<br /><hr /><br />';
if ($_POST['submit'] == 'one') {
$config = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"config"}'), true);
$debug = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"debug"}'), true);
$summary = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"summary"}'), true);
$dev = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"devs"}'), true);
$devdetails = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"devdetails"}'), true);
$stats = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"stats"}'), true);
$eStats = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"estats","parameter":1}'), true);
$pools = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"pools"}'), true);
$ascset = json_decode(runCMD($_POST['address'], $_POST['port'], '{"command":"ascset","parameter":"0, help"}'), true);
echo "<pre>config:";
print_r($config);
echo "</pre>";
echo "<pre>debug:";
print_r($debug);
echo "</pre>";
echo "<pre>SUMMARY:";
print_r($summary);
echo "</pre>";
echo "<br />------------<br /><br />";
echo "<pre>DEVICES:";
print_r($dev);
echo "</pre>";
echo "<pre>devdetails:";
print_r($devdetails);
echo "</pre>";
echo "<pre>stats:";
print_r($stats);
echo "</pre>";
echo "<pre>eStats:";
print_r($eStats);
echo "</pre>";
echo "<br />------------<br /><br />";
echo "<pre>POOLS:";
print_r($pools);
echo "</pre>";
echo "<pre>ascset:";
print_r($ascset);
echo "</pre>";
} else if ($_POST['submit'] == 'all') {
// Show errors
ini_set("display_errors", 1);
// Get all custom classes
require_once('includes/inc.php');
require_once('includes/autoloader.inc.php');
$rigClass = new Rigs();
$overview = $rigClass->getOverview();
$update = $rigClass->getUpdate();
echo "<pre>RIGS OVERVIEW:";
print_r($overview);
echo "</pre>";
echo "<br />------------<br /><br />";
echo "<pre>RIGS UPDATE:";
print_r($update);
echo "</pre>";
}
}
?>
<hr />
<div style="font-size: 12px;margin-top:20px;">This tool was created for <a href="http://cryptoglance.info">CryptoGlance</a>.</div>
</body>
</html>