403Webshell
Server IP : 216.92.14.13  /  Your IP : 216.73.216.171
Web Server : Apache
System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64
User : rmlac2fmr ( 1040637)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/bin/subscribe.pl
#!/usr/local/bin/perl 

eval 'exec /usr/local/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell
#
# subscribe.pl
#
# Subscribe to a MQTT topic
# and display message to STDOUT
#

use WebSphere::MQTT::Client;
use Data::Dumper;
use strict;


# 
my $mqtt = new WebSphere::MQTT::Client(
	Hostname => 'smartlab.combe.chem.soton.ac.uk',
	Port => 1883,
	Debug => 1,
);


# Connect to Broker
my $res = $mqtt->connect();
die "Failed to connect: $res\n" if ($res);

print Dumper( $mqtt );


sleep 1;
print "status=".$mqtt->status()."\n";
sleep 1;
print "status=".$mqtt->status()."\n";

# Subscribe to topic
my $res = $mqtt->subscribe( '#' );
print "Subscribe result=$res\n";


sleep 2;
print "status=".$mqtt->status()."\n";
sleep 2;


# Get Messages
while( 1 ) {

	my @res = $mqtt->receivePub();
	#errors can be caught by eval { }
	
	print Dumper(@res);
}



# Unsubscribe from topic
my $res = $mqtt->unsubscribe( '#' );
print "Unubscribe result=$res\n";


sleep 2;

print "status=".$mqtt->status()."\n";

# Clean up
$mqtt->terminate();

print Dumper( $mqtt );


Youez - 2016 - github.com/yon3zu
LinuXploit