[hobbit] Windows version of a fully functional bb command
Etienne,
I just tested it and it worked like a champ. Thanks!
......Bruce
_____
From: Etienne Grignon [mailto:etienne.grignon at gmail.com] Sent: Thursday, March 20, 2008 10:39 AM To: hobbit at hswn.dk Subject: Re: [hobbit] Windows version of a fully functional bb command
Hi,
2008/3/14, White, Bruce <bewhite at fellowes.com <mailto:bewhite at fellowes.com>
:
Hi all,
I know I saw a thread earlier about a fully functional bb for windows and that someone had ported the hobbit bb code to windows and got it working. I, for the life of me, can not now find that thread. I'm interested in a windows bb executable so I can write a quick DOS bat file that my windows guys can run to place a windows server into maintenance mode. Anybody have a windows bb executable and/or such a script?
You can use the bbwincmd.exe utility which is installed with BBWin. It is a cmd command line utility to send messages to hobbit server almost like the original bb command and your don't need cygwin.
Regards,
-- Etienne GRIGNON
Note: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Fellowes, Inc.
Speaking of such, is the protocol for the bb command published anywhere? It would be handy if I could write my own function for it in perl and other languages that I am writing hobbit scripts in. I'm guessing it's not as simple as just making a tcp connection to the port and sending the command.
-Charles
*From:* Etienne Grignon [mailto:etienne.grignon at gmail.com] *Sent:* Thursday, March 20, 2008 10:39 AM *To:* hobbit at hswn.dk *Subject:* Re: [hobbit] Windows version of a fully functional bb command
Hi,
2008/3/14, White, Bruce <bewhite at fellowes.com <mailto:bewhite at fellowes.com>>:
Hi all,
I know I saw a thread earlier about a fully functional bb for windows and that someone had ported the hobbit bb code to windows and got it working. I, for the life of me, can not now find that thread. I'm interested in a windows bb executable so I can write a quick DOS bat file that my windows guys can run to place a windows server into maintenance mode. Anybody have a windows bb executable and/or such a script?
You can use the bbwincmd.exe utility which is installed with BBWin. It is a cmd command line utility to send messages to hobbit server almost like the original bb command and your don't need cygwin.
Regards,
Once upon a time I think I heard that there was an RFC published, enshrining port 1984. But I never looked into it myself.
GLH
From: Charles Jones [mailto:jonescr at cisco.com]
Sent: Thursday, March 20, 2008 12:30 PM
To: hobbit at hswn.dk
Subject: [hobbit] bb cmd protocol? (was [hobbit] Windows version
of a fully functional bb command)
Speaking of such, is the protocol for the bb command published
anywhere? It would be handy if I could write my own function for it in perl and other languages that I am writing hobbit scripts in. I'm guessing it's not as simple as just making a tcp connection to the port and sending the command.
-Charles
From: Etienne Grignon [mailto:etienne.grignon at gmail.com]
Sent: Thursday, March 20, 2008 10:39 AM
To: hobbit at hswn.dk
Subject: Re: [hobbit] Windows version of a fully
functional bb command
Hi,
2008/3/14, White, Bruce <bewhite at fellowes.com>:
Hi all,
I know I saw a thread earlier about a fully functional
bb for windows and that someone had ported the hobbit bb code to windows and got it working. I, for the life of me, can not now find that thread. I'm interested in a windows bb executable so I can write a quick DOS bat file that my windows guys can run to place a windows server into maintenance mode. Anybody have a windows bb executable and/or such a script?
You can use the bbwincmd.exe utility which is installed
with BBWin. It is a cmd command line utility to send messages to hobbit server almost like the original bb command and your don't need cygwin. Regards,
Is http://quest.bb4.com/bb/help/help/Status_Message_Format.htm what your after.
Regards
Graeme
From: Charles Jones [mailto:jonescr at cisco.com] Sent: Friday, 21 March 2008 4:30 AM To: hobbit at hswn.dk Subject: [hobbit] bb cmd protocol? (was [hobbit] Windows version of a fully functional bb command)
Speaking of such, is the protocol for the bb command published anywhere? It would be handy if I could write my own function for it in perl and other languages that I am writing hobbit scripts in. I'm guessing it's not as simple as just making a tcp connection to the port and sending the command.
-Charles
From: Etienne Grignon [mailto:etienne.grignon at gmail.com] Sent: Thursday, March 20, 2008 10:39 AM To: hobbit at hswn.dk Subject: Re: [hobbit] Windows version of a fully functional bb command
Hi,
2008/3/14, White, Bruce <bewhite at fellowes.com>:
Hi all,
I know I saw a thread earlier about a fully functional bb for windows and that someone had ported the hobbit bb code to windows and got it working. I, for the life of me, can not now find that thread. I'm interested in a windows bb executable so I can write a quick DOS bat file that my windows guys can run to place a windows server into maintenance mode. Anybody have a windows bb executable and/or such a script?
You can use the bbwincmd.exe utility which is installed with BBWin. It is a cmd command line utility to send messages to hobbit server almost like the original bb command and your don't need cygwin.
Regards,
Important - This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Early Childhood Development.
No, I know the format of status messages...what I'm looking for is the protocol for establishing a connection to hobbit on port 1984 so that I can send status and other messages to Hobbit. I guess I could run a sniffer to find out, but I figure that its either documented somewhere, or Henrik could just let me know :)
-Charles
Shea, Graeme A wrote:
Is http://quest.bb4.com/bb/help/help/Status_Message_Format.htm what your after.
Regards
Graeme
*From:* Charles Jones [mailto:jonescr at cisco.com] *Sent:* Friday, 21 March 2008 4:30 AM *To:* hobbit at hswn.dk *Subject:* [hobbit] bb cmd protocol? (was [hobbit] Windows version of a fully functional bb command)
Speaking of such, is the protocol for the bb command published anywhere? It would be handy if I could write my own function for it in perl and other languages that I am writing hobbit scripts in. I'm guessing it's not as simple as just making a tcp connection to the port and sending the command.
-Charles
*From:* Etienne Grignon [mailto:etienne.grignon at gmail.com] *Sent:* Thursday, March 20, 2008 10:39 AM *To:* hobbit at hswn.dk <mailto:hobbit at hswn.dk> *Subject:* Re: [hobbit] Windows version of a fully functional bb command
Hi,
2008/3/14, White, Bruce <bewhite at fellowes.com <mailto:bewhite at fellowes.com>>:
Hi all,
I know I saw a thread earlier about a fully functional bb for windows and that someone had ported the hobbit bb code to windows and got it working. I, for the life of me, can not now find that thread. I'm interested in a windows bb executable so I can write a quick DOS bat file that my windows guys can run to place a windows server into maintenance mode. Anybody have a windows bb executable and/or such a script?
You can use the bbwincmd.exe utility which is installed with BBWin. It is a cmd command line utility to send messages to hobbit server almost like the original bb command and your don't need cygwin.
Regards,
*Important - *This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Early Childhood Development.
Henrik,
I'm talking about the connection protocol, not the message protocol. So that I can write code that can connect to a BBDISPLAY and send/receive data, without shelling out and using a bb binary. I've tried telnetting to port 1984 and typing various commands, and also using netcat, none of which seem to work, so I suspect that hobbitd is expecting to see some certain characters before it will accept a command.
-Charles
Henrik Stoerner wrote:
On Thu, Mar 20, 2008 at 10:29:40AM -0700, Charles Jones wrote:
Speaking of such, is the protocol for the bb command published anywhere?
See the bb(1) man-page.
Henrik
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
On Thu, Mar 20, 2008 at 5:43 PM, Charles Jones <jonescr at cisco.com> wrote:
Henrik,
I'm talking about the connection protocol, not the message protocol. So that I can write code that can connect to a BBDISPLAY and send/receive data, without shelling out and using a bb binary. I've tried telnetting to port 1984 and typing various commands, and also using netcat, none of which seem to work, so I suspect that hobbitd is expecting to see some certain characters before it will accept a command.
-Charles
Would bb.pl be of any use to you?? As found on deadcat.net:
#!/usr/bin/perl -w
bb.pl
BIG BROTHER CLIENT PROGRAM
Nicolas Chuche <chuche at teaser.fr>
Version 1
Jul 15, 2000
This program is a remake of bb.c in perl.
I've do that to :
1. have a real client for my NT servers
2. see what it done in perl
I've tried to have full compatibility so i've keep all the error
messages.
If you want to use it, just replace the original bb by this file in
BBHOME/bin
The header of bb.c :
SENDS THE INPUT LINE TO THE DAEMON ON THE BIG BROTHER PORT
Format: bb IP-ADDR [<LINE>|-]
IP-ADDR: IP-ADDR OF THE SERVER
LINE: <page|status|summary> <DATA>
DATA: for page: <NUMERIC MESSAGE><status-msg>
for status: <machine><color-code><status-msg>
fro summary: <summary name><color-code><http link>
- Will read from standard input a one line status
message.
use strict; use Socket;
my $PORT = 1984; # The bbd port my $PAGELEVELSDEFAULT = "red purple"; # the default page level my $MAXBBLINE = 256; # the max input line length
sub debug { print STDERR shift;}; # debug message : uncomment
this line sub debug {}; # and comment this one
@ARGV == 2 or &Usage; my ($server, $line) = @ARGV or &Usage;
take the standart input if second arg is "-"
if ($line eq '-') { debug("bb gets its input from stdin\n"); while (<STDIN>) { chomp; $_ = substr($_, 0, $MAXBBLINE - 1); debug("data came in [$_]\n"); bb_notify($server, $_); } debug("Done\n"); } else { bb_notify($server, $line); }
exit(0);
sub bb_notify { my ($machine, $data) = @_; my (@bbdisplays, @bbpagers, $bbpage, $pagelevels) = ();
@bbdisplays = split /\s+/, $ENV{BBDISPLAYS} if defined $ENV{BBDISPLAYS}; debug("Sending: ** $data ** to $machine - @bbdisplays\n"); bb_send($machine, \@bbdisplays, $data);
$bbpage = $ENV{BBPAGE};# if defined $ENV{BBPAGE}; $pagelevels = ((defined $ENV{PAGELEVELS}) && $ENV{PAGELEVELS}) ? $ENV{PAGELEVELS} : $PAGELEVELSDEFAULT;
paging or not paging ?
if( $bbpage && $pagelevels ) { my ($type, $machine, $color, $message) = $data =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/;
debug("v1:[$type] v2:[$machine] v3:[$color] v4:[$message]\n");
if ($type =~ /status/ && $pagelevels =~ /$color/) {
$data =~ s/^(\s*status\S*\s+)/page /; # Change msg type
@bbpagers = split /\s+/, $ENV{BBPAGERS} if defined $ENV{BBPAGERS};
debug("Sending: ** $data ** to $bbpage - @bbpagers\n");
bb_send($bbpage,\@bbpagers,$data); # SEND IT ACROSS TO BBPAGER
}
} }
Send a message
sub bb_send { my ($bbdisp, $machinelist, $message) = @_; my (%machine, @machinelist) = ();
@machinelist = ($bbdisp ne "0.0.0.0") ? ($bbdisp) : @$machinelist;
debug("BOX: $bbdisp\nBOXES: @machinelist\n");
for my $server (@machinelist) { my ($port, $iaddr, $paddr, $proto); # Variable réseau
# don't send the message twice to the same machine
next if $machine{$server};
$machine{$server} = 1;
debug("Host: $server\n");
$iaddr = inet_aton($server) || warn "bb: Unknown host:
$server\n", next; $paddr = sockaddr_in($PORT, $iaddr); $proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto) || warn "bb: Can't open
stream socket\n", next; connect(SOCK, $paddr) || warn "bb: CAN'T CONNECT TO bbd SERVER @ $server", next; # select((select(SOCK), $| = 1)[0]); # unbuffer the socket print SOCK $message; close (SOCK); } debug("Host list done\n"); }
Print usage
sub Usage { print STDERR <<EOF; bb: incorrect number of arguments Format: <IP-ADDR> <DATA> EOF exit(1); }
Ralph Mitchell
Ralph Mitchell wrote:
On Thu, Mar 20, 2008 at 5:43 PM, Charles Jones <jonescr at cisco.com <mailto:jonescr at cisco.com>> wrote:
Henrik, I'm talking about the connection protocol, not the message protocol. So that I can write code that can connect to a BBDISPLAY and send/receive data, without shelling out and using a bb binary. I've tried telnetting to port 1984 and typing various commands, and also using netcat, none of which seem to work, so I suspect that hobbitd is expecting to see some certain characters before it will accept a command. -CharlesWould bb.pl be of any use to you?? As found on deadcat.net <http://deadcat.net>:
sub bb_send { my ($bbdisp, $machinelist, $message) = @_; my (%machine, @machinelist) = (); @machinelist = ($bbdisp ne "0.0.0.0 <http://0.0.0.0>") ? ($bbdisp) : @$machinelist; for my $server (@machinelist) { my ($port, $iaddr, $paddr, $proto); # Variable réseau # don't send the message twice to the same machine next if $machine{$server}; $machine{$server} = 1; debug("Host: $server\n"); $iaddr = inet_aton($server) || warn "bb: Unknown host: $server\n", next; $paddr = sockaddr_in($PORT, $iaddr); $proto = getprotobyname('tcp'); socket(SOCK, PF_INET, SOCK_STREAM, $proto) || warn "bb: Can't open stream socket\n", next; connect(SOCK, $paddr) || warn "bb: CAN'T CONNECT TO bbd SERVER @ $server", next; # select((select(SOCK), $| = 1)[0]); # unbuffer the socket print SOCK $message; close (SOCK); } }
Indeed! From looking at that code, it is just a simple TCP connection...Hmm I guess I need to go see why my test code didn't work :-) Thanks!
-Charles
The description of the "Message Syntax" in the man-page is what you need to know. Hobbit uses plain TCP, and data being transferred is plain text. I.e.
- connect to tcp port 1984
- send "status www,foo,com.mytest green"
- close the connection
Regards, Henrik
On Thu, Mar 20, 2008 at 03:43:10PM -0700, Charles Jones wrote:
Henrik,
I'm talking about the connection protocol, not the message protocol. So that I can write code that can connect to a BBDISPLAY and send/receive data, without shelling out and using a bb binary. I've tried telnetting to port 1984 and typing various commands, and also using netcat, none of which seem to work, so I suspect that hobbitd is expecting to see some certain characters before it will accept a command.
-Charles
Henrik Stoerner wrote:
On Thu, Mar 20, 2008 at 10:29:40AM -0700, Charles Jones wrote:
Speaking of such, is the protocol for the bb command published anywhere?
See the bb(1) man-page.
participants (6)
-
bewhite@fellowes.com
-
greg.hubbard@eds.com
-
henrik@hswn.dk
-
jonescr@cisco.com
-
ralphmitchell@gmail.com
-
Shea.Graeme.A@edumail.vic.gov.au