|
|
|
@ -50,13 +50,17 @@ class BOB {
@@ -50,13 +50,17 @@ class BOB {
|
|
|
|
|
socket_close($this->sock); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function setnick() { |
|
|
|
|
public function setnick(): bool { |
|
|
|
|
$command = "setnick " . $this->options["bob_nick"] . "\n"; |
|
|
|
|
socket_write($this->sock, $command, strlen($command)); |
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
if(!preg_match('/^OK/', $response)) { |
|
|
|
|
//echo "[BOB] setnick response: " . $response; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function options() { |
|
|
|
@ -68,7 +72,7 @@ class BOB {
@@ -68,7 +72,7 @@ class BOB {
|
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] options response: " . $response; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -78,7 +82,7 @@ class BOB {
@@ -78,7 +82,7 @@ class BOB {
|
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] newkeys response: " . $response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function start() { |
|
|
|
@ -87,7 +91,7 @@ class BOB {
@@ -87,7 +91,7 @@ class BOB {
|
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] start response: " . $response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function intun() { |
|
|
|
@ -96,14 +100,14 @@ class BOB {
@@ -96,14 +100,14 @@ class BOB {
|
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] inhost response: " . $response; |
|
|
|
|
|
|
|
|
|
$command = "inport " . rand(1024, 65535) . "\n"; |
|
|
|
|
socket_write($this->sock, $command, strlen($command)); |
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] inport response: " . $response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getnick() { |
|
|
|
@ -112,7 +116,7 @@ class BOB {
@@ -112,7 +116,7 @@ class BOB {
|
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] getnick response: " . $response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function lookup(string $address): bool { |
|
|
|
@ -122,6 +126,7 @@ class BOB {
@@ -122,6 +126,7 @@ class BOB {
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
|
|
|
|
|
if(preg_match('/^OK/', $response)) |
|
|
|
|
//echo "[BOB] lookup response: " . $response; |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
@ -134,6 +139,7 @@ class BOB {
@@ -134,6 +139,7 @@ class BOB {
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
|
|
|
|
|
if(preg_match('/^OK/', $response)) |
|
|
|
|
//echo "[BOB] lookup response: " . $response; |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
@ -145,7 +151,7 @@ class BOB {
@@ -145,7 +151,7 @@ class BOB {
|
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] stop response: " . $response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function clear() { |
|
|
|
@ -154,7 +160,7 @@ class BOB {
@@ -154,7 +160,7 @@ class BOB {
|
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] clear response: " . $response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function zap() { |
|
|
|
@ -163,6 +169,6 @@ class BOB {
@@ -163,6 +169,6 @@ class BOB {
|
|
|
|
|
|
|
|
|
|
$response = socket_read($this->sock, 1024, PHP_NORMAL_READ); |
|
|
|
|
if(!preg_match('/^OK/', $response)) |
|
|
|
|
echo "BOB response: " . $response; |
|
|
|
|
echo "[BOB] zap response: " . $response; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|