TechProsaic

I write about great software, Internet technology, cool gadgets, and The Next Big Thing.

January 11th, 2008

PoshXmpp - New PowerShell wrapper for agsXMPP library

Jabber Powershell

Jaykul from huddledmasses.org has just released the first public version of his new XMPP utility for PowerShell called PoshXmpp.  As I mentioned the other day, there is some interest lately in combining XMPP with PowerShell.  With Jaykul’s tools, you now have a basic Jabber client for your Windows command-line.  But more than that is the possibilities it raises for stuff like the example below.  (In PowerShell terms, PoshXmpp is a “snapin” which is a collection of “cmdlets”.)

Connect-Chat — connect to MUC chats: try “PowerShell%irc.freenode.net@irc.im.flosoft.biz” to connect to the PowerShell IRC channel. NOTE: messages from these come the same way as regular chat messages… you have to Receive-Message to see anything. You could Receive-Message -Loop > log.txt ….

The homepage is here, and the code is here (requires PowerShell to be installed first).

January 7th, 2008

PowerShell Script: Send-XmppMessage

Jabber Powershell

A user at PowerShellCommunity.org asked how to send a Jabber message using PowerShell.  There is a set of commercial cmdlets available from /n software that can do this (and a lot more), but they are a little pricey for the casual user.  As luck would have it, PowerShell makes it super easy to work with .NET stuff and I happened to know there was a few .NET libraries already in existence.  After reviewing what was available, I decided on Alex Gnauck’s excellent agsXMPP SDK.

It took a bit of work to translate the C# examples to PowerShell, but there was another guy at AG-Software forums who was working on this as well and he had an example I could work with.  Also, Alex was a great help in some troubleshooting.

Next step–a Jabber bot.  :)

So, without further ado, the code (script repository link):

   1: # Download XMPP SDK from http://www.ag-software.de/index.php?page=agsxmpp-sdk
   2: function Send-XmppMessage {
   3:     param (
   4:         $From = $( Throw “You must specify a Jabber ID for the sender.” ),
   5:         $Password, # Leave blank to be prompted for password
   6:         $To = $( Throw “You must specify a Jabber ID for the recipient.” ),
   7:         $Body = $( Throw “You must specify a body for the message.” )
   8:     )
   9:     
  10:     # This function reads a string from the host while masking with *’s.
  11:     function Read-HostMasked( [string]$prompt=“Password” ) {
  12:         $password = Read-Host -AsSecureString $prompt; 
  13:         $BSTR = [System.Runtime.InteropServices.marshal]::SecureStringToBSTR($password);
  14:         $password = [System.Runtime.InteropServices.marshal]::PtrToStringAuto($BSTR);
  15:         [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR);
  16:         return $password;
  17:     }
  18:     # Set path accordingly.
  19:     $assemblyPath = $(resolve-path $profiledir\Assemblies\agsXMPP.dll)
  20:     [void][reflection.assembly]::LoadFrom( $assemblyPath )
  21:     $jidSender         = New-Object agsxmpp.jid( $From )
  22:     $jidReceiver     = New-Object agsxmpp.jid ( $To )
  23:     $xmppClient     = New-Object agsxmpp.XmppClientConnection( $jidSender.Server )
  24:     $Message         = New-Object agsXMPP.protocol.client.Message( $jidReceiver, $Body )
  25:     
  26:     # The following switches may assist in troubleshooting connection issues.
  27:     # If SSL and StartTLS are disabled, then you can use a network sniffer to inspect the XML
  28:     #$xmppClient.UseSSL                     = $FALSE
  29:     #$xmppClient.UseStartTLS                 = $FALSE
  30:     
  31:     # Since this function is only used to send a message, we don’t care about doing the 
  32:     # normal discovery and requesting a roster.  Leave disabled to quicken the login period.
  33:     $xmppClient.AutoAgents                     = $FALSE
  34:     $xmppClient.AutoRoster                     = $FALSE
  35:     
  36:     # Use SRV lookups to determine correct XMPP server if different from the server
  37:     # portion of your JID.  e.g. user@gmail.com, the server is really talk.google.com
  38:     $xmppClient.AutoResolveConnectServer     = $TRUE
  39:     if ( !$password ) { $password = Read-HostMasked }
  40:     
  41:     # Open connection, then wait for it to be authenticated
  42:     $xmppClient.Open( $jidSender.User, $Password )
  43:         while ( !$xmppClient.Authenticated ) {
  44:             Write-Verbose $xmppClient.XmppConnectionState
  45:             Start-Sleep 1
  46:         }
  47:     # If server disconnects you, try enabling this
  48:     #$xmppClient.SendMyPresence()
  49:     $xmppClient.Send( $Message )
  50:     # Send is asynchronous, so we must wait a second before closing the connection
  51:     Start-Sleep 1
  52:     $xmppClient.Close()
  53: }
November 15th, 2007

Trying out NetCmdlets

Jabber Powershell

/n software has a PowerShell snapin (a set of cmdlets) called NetCmdlets that I’ve been meaning to check out for some time but never got around to it.  Well, today I needed to do some FTP stuff in PowerShell and I didn’t feel like messing with Sapien’s free FTP COM object as it seemed a bit clunky.  I’ve had this NetCmdlets license offer sitting on my desk for a few months so I went ahead and took the plunge.  :)

I don’t have much to say about them yet except to say it looks really comprehensive.  They charge $99, but you sysadmins out there might want to justify purchasing it if you are getting into using PowerShell to manage your systems.  One really cool thing about these is that it’s all about manipulating many standards-based protocols.  That means cross-platform support.  Oh, and it does XMPP too, niiiice.  (Cross-posting to Planet Jabber… :) )

Here’s a blurb from their website and the readme:

The /n software NetCmdlets extend the features of Microsoft Windows PowerShell with a broad range of network management and messaging capabilities. The current release contains more than 30 Cmdlets providing access to network and host protocols such as SNMP, LDAP, DNS, Syslog, HTTP, WebDav, FTP, SMTP, POP, IMAP, Rexec/RShell, Telnet, and more.

Networking Tools for IT Professionals

The current package contains the following Cmdlets:

  • [get/set]-snmp : Command-line SNMP Management capabilities.  Manage network devices directly from PowerShell.
  • [get/send]-trap : Monitor and send SNMP Traps.
  • [invoke]-ssh : Secure Shell enabled remote access Cmdlet
  • [invoke]-rexec : Remote execution via Rexec
  • [invoke]-rshell : Remote execution via Rshell
  • [get/set]-ftp : FTP file transfer capabilities with advanced proxy and firewall support.
  • [get/set]-ldap : Access Active Directory or OpenLDAP servers through LDAP directory access
  • [get/send]-udp : Send and receive UDP datagrams. Send Wake On LAN requests.
  • [get/send]-nntp : Command-line newsgroup browsing.  Monitor newsgroup postings and post messages to newgroup servers directly from PowerShell.
  • [get/send]-syslog : Syslog server and client for LAN event monitoring and reporting.
  • [get/set]-tftp : TFTP file transfer Cmdlet.
  • [convert]-data : Encoding and decoding utilities including Base64, SHA1, MD5, BinHex, and more.
  • [read/write]-zip : Compressions and decompression Cmdlet supporting Zip, Tar, GZip, and Jar.
  • [get/set]-webdav : WebDav client Cmdlet.
  • [get]-http : Web client Cmdlet with advanced proxy and firewall capabilities.
  • [get]-packet : Monitor network interface traffic.
  • [get]-time : Access network time servers and synchronize machine clocks.
  • [get]-rss : RSS client Cmdlet enables retrieval of RSS Syndicated content.
  • [get]-whois : Domain name Whois lookup.
  • [send]-im : Send Jabber(XMPP) Instant messages.
  • [send]-sms : Send SMS(SMPP) instant messages
  • [send]-ping : Network ping capability to monitor device availability.
  • [get]-trace : Traceroute Cmdlet for determining the path of network packets between hosts.
  • [get/set]-ras : Cmdlets for RAS connectivity.
  • [send]-email : Send HTML emails with file attachments, supports SSL.
  • [get/set]-imap : Retrieve and manage messages, mailboxes and users in an IMAP server.
  • [get]-pop : Retrieve and manage messages in a POP server.

Happy PowerShelling!  (And don’t forget to check out the podcast I co-host, PowerScripting Podcast.)

March 20th, 2007

The Great Roster Test: Who will win?

Jabber

Psi or Spark, who can withstand stpeter’s 1500-user roster?

 

 

Tune in soon to get the results!!  :)

March 3rd, 2007

Octro: Hot new Windows Mobile Jabber client

Jabber

Just came across this on ye blogosphere.  I haven’t yet tried logging into my other XMPP accounts, but it does let you specify a full JID so I’m assuming it will allow this, despite the Google Talk label.

Feature-wise it looks pretty cool.  The GUI is better than most IM clients I’ve seen on Windows Mobile, but not that flashy.  Not sure what to think about the VOIP, I see no evidence of these in the GUI.  Oops, spoke too soon, I see “call” there now.  Neat.  I don’t have many contacts to test it with however.  Add halr9000@gmail.com to your roster and let’s test it out.  :) 

“OctroTalk is currently in BETA, and is available for download. The current download will expire on March31st, 2007.”

Darn, it’s not freeware. 

Here’s the canned bit from their website:

OctroTalk. Mobile Instant Messaging with full voice integration. This always-on product keeps you connected with your buddies, and your buddies reach you whenever, wherever. Works seamlessly over GPRS/EDGE/CDMA/Wifi/Bluetooth data connections, and cuts down your phone bills. OctroTalk now supports GoogleTalk, MSN, AIM, ICQ and Yahoo.

Features:
  • Always on connected to Google Talk with MSN, AIM, ICQ and Yahoo transports
  • Complete VOIP product. Access to PSTN coming soon.
  • Supports Low Bandwidth Codec (even works with EDGE/GPRS/CDMA).
  • Streamlined UI. Optimized for one-handed operation. Today Screen on Pocket PC. Home Screen support for Smartphone.
  • Low CPU usage. Only VOIP product that works on Treo 700w (300 MHz processor).
  • Secure and Encrypted connection to GoogleTalk. Google Talk messages are encrypted using industry standard TLS/SSL.
  • Message Archiving in your GMail Account.
  • BOTs coming soon. Access your computer remotely.

And some screenshots from the manual:

Technorati tags: , ,
September 23rd, 2006

New Psi download graphic

Jabber Psi

A loyal Psi user asked for a button he could use on his site to link to the Psi download page. I had a copy of the new Psi icon that Jason Kim whipped up, so I put something together. If you want to put something like this on your site, the HTML code is below the image.

Click here to download Psi!

<a href="http://psi-im.org/download"
  title="Click here to download Psi!">
<img src="http://psi-im.org/media/download-psi.png"/></a>

September 6th, 2006

Server maintenance

Jabber Psi

The server upon which the Psi website (and this blog) sits will be down for maintenance at times tonight between 8pm and 3am EDT (UTC-4). Sorry for the inconvenience.

## Update @ 0921 ##

Just wanted to let you all know that my partner-admin is a jerk. He went ahead and did the maintenance _this_ morning. “Because he was up”, he said.

So anyway…nevermind! Apparently the maintenance went well. Server might even be faster now.

August 12th, 2006

Microformats — please explain this one to me!

Jabber

As seen on JDEV today, Peter has forwarded a discussion that happened on the microformats.org mailing list to the Jabber community. Apparently this dude in the MF camp heard that the Adium project was working on standardizing an IM chat log format that *gasp* didn’t use microformats! (Melodrama mine.) Of course in the Jabber world we would do it in XML and just define a common set of terms and publish it as a JEP. Happens all the time.

I’m sorry, I don’t get where these MF guys are going. It seems to me that they are trying to make the web more semantic. Fine and good. Took me a while to grok and then find a concrete example. Here’s a draft spec for “adr” or physical address information.

<div class="adr">
 <div class="street-address">665 3rd St.</div>
 <div class="extended-address">Suite 207</div>
 <span class="locality">San Francisco</span>,
 <span class="region">CA</span>
 <span class="postal-code">94107</span>
 <div class="country-name">U.S.A.</div>
</div>

Correct me if I’m wrong, but isn’t this just a superfluous layer of XHTML on top of XML? What they have done is set up a straw man argument–a world in which XML does not exist–and declared there is a problem that they must solve by “building upon existing and widely adopted standards“.

Some other choice marketing-speak used on the site:

Designed for humans first and machines second

highly correlated with semantic XHTML

[using principles of] modularity / embeddability

All of these things perfectly describe XML. They go on to say what Microformats are not, and essentially you can translate the statements as “not XML”. So which is it guys?

Let me provide an equivalent XML (XMPP actually) example:

    <ADR>
      <WORK/>
      <EXTADD>Suite 600</EXTADD>
      <STREET>1899 Wynkoop Street</STREET>
      <LOCALITY>Denver</LOCALITY>
      <REGION>CO</REGION>
      <PCODE>80202</PCODE>
      <CTRY>USA</CTRY>
    </ADR>

Ok. Does the above semantically describe a physical address? Is it easily parseable by both humans and machines? Is it a simple? Built on existing standard? An open way to think about data? It’s even less to type!

You just gotta love standards. There are so freakin’ many to choose from!

June 12th, 2006

Qunu part 2

Jabber

I went ahead and added myself to Qunu and using the jabber service gave it a list of tags on which I consider myself an ‘expert’. Over the past few days I’ve had several invites popup in Psi. I accepted three so far today. The topics requested were Outlook, Firefox and XMPP. The experience was very good for me. I can only assume the user who asked the questions got something out of it because I don’t know if I can view my ratings yet.

As you can see below, its very straightforward. You are invited to a groupchat as if this were any other random chat you wanted to start.

qunu_question.png

BTW I have interviewed the three guys working on this project, I’ll be publishing that soon.

June 9th, 2006

What we’re doing - Psi Forum

Jabber

Check out some news on the Psi front: What we’re doing - Psi Forum

Also, I haven’t seen anything else about this, maybe they want it hush-hush. Oh well. As recently blogged by Justin Kirby, Qunu is an expert matching service. You’ve seen these before, Yahoo and Google and several smaller companies during the dotcom bubble tried their hand at it. The premise is to provide a place for people to ask questions, and then pay a modest amount for someone to come up with the answer. Its like IT consulting on a tiny scale. Of course, the subject could be anything, doesn’t have to be technology-related at all. Qunu takes this model but brings it into the instant world we live in today. So you ask a question, and through some magic on the back end, you are matched up with an expert in the subject–in live chat. How is this different from a livechat thing on hundreds of corporate websites already? The experts aren’t employees–they are you and me. Yes, the back end users Jabber. Duh. It would be pretty boring to me if it didn’t!

I don’t actually know many details at this point, but I plan on digging. You can try it yourself, too. Here’s a quote from Justin’s blog:

* Use the site at alpha.qunu.com. This is simply a custom jabber client via html and javascript.
* Register with quser.alpha.qunu.com
* Add quser.alpha.qunu.com to your roster via a subscribe request
* Add quser@qunu.com to your roster

/me goes to create a Qunu profile.

Close
E-mail It