Posts Tagged ‘Internet’
Scriptable SSH from PowerShell
Just in the last week, I’ve seen at least four people asking about SSH from PowerShell, and at least three of those specifically were looking for something they could script. That is, they needed a way to make an SSH connection, and then run commands on the remote PC and do switches in their script based on the output of those commands, so they could automate complicated server-side tasks.
Generally, the simplest answer to that is to write the scripts on the server, and then invoke them from PowerShell using the PLink executable which comes with Putty. However, that’s not very satisfactory, and it requires you to know a Linux scripting language like Perl or Python, and also requires you to have uploaded and tested that script ahead of time. Not always practical.
It’s also possible to do this using the NetCmdlets from /n and I’m constantly surprised at how unwilling people are to pay for them.
Well, I’ve already written my own little workaround using SharpSSH, a library I found on SourceForge from years ago, so I figured I’d share it with you. You might want to read the CodeProject Article about the first release of SharpSSH if you want more information about it, but otherwise, just download the binaries, extract them, and put the three dll’s somewhere handy. I keep mine in a “Libraries” folder within my WindowsPowerShell profile directory, so they’re easy to include in a backup of my scripts.
Now, lets say that your task is to ssh into a server, do a process check to see if anyone else is logged in, and if not, restart the server immediately, otherwise, schedule a reboot for midnight. Here’s the script for that:
New-SshSession jaykul huddledmasses.org ## You'll be prompted for a password
if( Invoke-Ssh who '\$'| select-string "^(?!jaykul).*pts/\d" ) {
Invoke-Ssh "shutdown -r 0:00" '\$'
}
else {
Invoke-Ssh "shutdown -r now" '\$'
}
Remove-SshSession
Notice that I use \$ (backslash dollar-sign) as my “expect” text. That’s the last character on my prompt. It occasionally backfires, so you might want to use something more precise, in my case, I usually would store a patters for the full prompt (as a regular expression):
Here’s the script module with the functions you’ll need. Read the rest of this entry »
Google: Comprehensive consumer surveillance and entrenched hostility to privacy
So, Privacy International has made official and extremely public what I’ve been muttering about for years: Google doesn’t care about your privacy. A recent study they published rated Google as the worst internet service. In fact, in light of the results, they actually called the study 347=x-347-553961”>A Race to the Bottom – Privacy Ranking of Internet Service Companies.
We are aware that the decision to place Google at the bottom of the ranking is likely to be controversial, but throughout our research we have found numerous deficiencies and hostilities in Google’s approach to privacy that go well beyond those of other organizations. While a number of companies share some of these negative elements, none comes close to achieving status as an endemic threat to privacy. This is in part due to the diversity and specificity of Google’s product range and the ability of the company to share extracted data between these tools, and in part it is due to Google’s market dominance and the sheer size of its user base. Google’s status in the ranking is also due to its aggressive use of invasive or potentially invasive technologies and techniques.
I can’t really add much information that the news and reviewing
magazines, radio, and blogs have written … The bottom line is that Google’s gathering unbelievable amounts of data, and not providing users with any way to have most of that data deleted. According to Privacy International this is because_they don’t believe_ that they are collecting sensitive information ... even though they track your use of blogs, email, maps, and searches, as well as what links you click on, et. On top of that, their corporate culture leads them to mix together the login, cookie, and tracking data from all their different services without explicitly telling you they will do so, and they retain the data for years. Ultimately they have a “track history of ignoring privacy concerns” and their response to this report doesn’t make one think they’re taking it seriously.
Oh, and just as a postscript, this reaction from Kevin Bankston (an attorney at EFF) to Google’s new street view photos (streams of 360° photos taken from vans driving through dozens of major cities across the US):
There are a lot of people on the Web who are, I think, freaked out by this they find it kind of icky and uncomfortable, I don’t think Google has done anything illegal here, but I do think they’ve done something that’s exceptionally rude.
Microsoft Internet Explorer “Developer Toolbar” release 1.0
The Developer Toolbar finally got out of beta … you can
download it here … and really, you should, if you ever write web apps that have to be debugged on IE — personally I do most of my development work on Firefox, using Firebug and the Firefox Web Developer Toolbar but when I cross-test on IE, sometimes you need to have the DOM-diving, script-debugging, cookie-clearing, css-manipulating tools over there, too.
Silverlight Streaming, Silverlight CLR, Data Services, Ozzie, and IE 8
Microsoft made several big announcements today at MIX07…
CLR in Silverlight
The most exciting announcement I’ve today is that Silverlight will include the Common Language Runtime (CLR) on both Windows and Mac … which means that it will allow development using any .NET-supported languages. They’re even including the open source Dynamic Language Runtime and thus IronRuby (which like IronPython is also open source).
On top of that, these features, plus support for Language Integrated Query language (LINQ) and cross-platform debugging capabilities, are available now in the Silverlight 1.1 Alpha (and will be released more publicly after Silverlight 1.0 comes out this summer?).
Silverlight Streaming
They also announced today that they will offer a media-hosting service for free called Silverlight Streaming! In a move that targets both Adobe’s flash and other media-hosting sites like YouTube and Revver … they will allow developers to stream high -quality video (up to DVD quality) into their Silverlight apps from Microsoft’s servers without any restrictions on branding or embedding (including use in “rich internet applications” — i.e.: outside the browser).
The current package in pre-release offers only 4GB of storage and unlimited bandwidth delivery of up to DVD quality video (700 Kbps), but their plan calls for Microsoft to provide hosting for unlimited Silverlight content and up to a million minutes of free video streaming at 700 Kpbs per site per month … that’s over 5,000 Gigabytes of bandwidth)+*+700+Kbps)+in+gigabytes of streaming per month, for free! They’ll also offer unlimited streaming for a fee, or free, but supported by advertising…
Jasper and Astoria CTPs
Astoria builds on ADO.NET and WCF to allows you to expose a data service for the web which can be consumed via HTTP and since it uses standard HTTP verbs (GET, POST, DELETE, etc) you can even make it accessible as a REST-style resource collection with unique URIs … and simple formats like JSON or plain XML ...
Jasper is another ADO.NET incubation project … aimed at dynamically typed .Net languages like VB.Net or IronPython … it dynamically generates data classes (instead of requiring manual, static configuration … or even code generation which must be kept up to date). It’s built on the Entity Framework (which was postponed until some time in 2008 … after Orcas ships), so it supports rich queries and object-relational mapping and automatic databinding.
Ozzie speaks on Services and Clients…
The orchestration of announcements has many people buzzing about strong leadership and strategy … and the keynote by Ray Ozzie left no doubt about who’s behind that, highlighting the work Microsoft is doing to integrate all the various aspects of their strategy. Ozzie pitched Software-as-a-Service (SaaS) 2.0: web and hosted services which have “grown to embrace the uniquely valuable role of the client.”
IE 8 will require Standards Mode
In a move that only the undisputed king of browsers could hope to pull off, Microsoft has announced that they’ll be requiring web developers to opt in to standards-compliant web design … feel free to take a moment to check for flying pigs.
They’re also planning on making the IE object model more interoperable with other browsers and provide more client-side APIs — including local storage for AJAX apps and more extensibility in the form of a plugin API. Look for it in 2008.
wget for PowerShell
Update: You should look at this other WGet for PowerShell script if what you want is to just download a file and have it work…
I’m probably the last person on the planet to figure out how easy it is to get a basic wget working in PowerShell … but just in case I’m not … here’s a PowerShell script which will download web files to your hard drive.
That’s all it does. This script doesn’t support authentication or anything (even though it does use your computer’s proxy settings), but I think it will be obvious how to extend it, since it’s basically just .Net Framework stuff.
param([string]$url, [string]$path)
if(!(Split-Path -parent $path) -or !(Test-Path -pathType Container (Split-Path -parent $path))) {
$path = Join-Path $pwd (Split-Path -leaf $path)
}
"Downloading [$url]`nSaving at [$path]"
$client = new-object System.Net.WebClient
$client.DownloadFile( $url, $path )
That’s all there is to it. Actually, you really only need the last two lines (and the first line), as long as you understand that the default path will be your user directory rather than the current directory. (like: C:\Users\Joel OR C:\Documents and Settings\Joel\). That means that if you leave off that if(!(Split-Path -parent $path)) stuff, you’ll always have to specify the file starting with a .\ if you want it saved in the folder you’re in (otherwise it gets dumped in your user directory).
Those three lines check if the specified path has a folder in it (and if it’s a valid folder) and if not, they just save the file to the local current folder.
Here are some examples of how you’d use it, assuming you save that into a file called “wget.ps1” and put it in your path. Incidentally, just like in ‘nix shells, ~ represents your user directory … oh, and the generally more PowerShell-like name for the script would be “Get-Url.ps1” or something…
Read the rest of this entry »
Blogging Press Releases and Apologies
One of my myriad email newsletters had a link this week to this Techworld article, entitled: Microsoft admits OneCare flaws … which is basically an article about a couple of blog posts by the AntiMalware Team and the OneCare Team
Corporate communications on spaces.live.com? Really? My company has the whole domain blocked off as being a “Dating/Social” site and prevents access from within the corporate internet…. is that really where you want to make your official Mea Culpa statement? Of course, maybe that’s the point — not only is it on MSN spaces, it’s the first post on a blog that’s been dead since January … maybe they were hoping nobody would notice. And the other blog is even worse: it hasn’t been active since at least October of last year, and then suddenly, this Hello World post
Which begs the question: do news people really leave a blog in their RSS reader after 5 months of inactivity, or did someone at Microsoft email Gregg Keizer, Computerworld and ask him to have a look at their blog and write a story about it? What ever happened to Press Releases? I mean, I’m no “regular Joe user” but if you paid money for OneCare … is this how you expect them to issue apologies and promises to do better? It seems overly informal to me.
Read the rest of this entry »
Firefox Extensions – Web Search Pro
You’ve really got to check out Web Search Pro, a Firefox extension that actually adds a few hot features to Firefox searching.
A new and inovative way to search the web: Drag & DropZones, just drag text on any website, and drop it in one of your 16 fully customizable DropZones, and your search will be started
The “DropZones” actually pop up visually when you drag text, so you can easily make sure you’re searching using the engine of your choice.
The hotkey support in this Web Search Pro is also excellent, so you can set hotkeys for each search engine you use regularly, select text (using the mouse or quick type and the keyboard) and press a hotkey to launch a search. Or, you can press the hotkey without text selected and you’ll get a popup you can type your search query into!
He has buckets of search engines already configured, and you can suggest more or make your own … which is great … but since there is an Open Search format for describing search engines already, why do people keep inventing new formats?
Wikia says: Forget Free … we’ll PAY you
Wikipedia founder Jimmy Wales announced that his for-profit company, Wikia Inc., is ready to give away not just MediaWiki (the software which runs Wikipedia) but also the hosting you need to run it. And even further, if you run what they consider to be a popular website, you can even have the advertising revenue from your wiki.
The only catch is that they appear to be sort of forcing the GNU FDL on you, which could cause problems for people who would prefer some other license (like a Creative Commons license, perhaps?) and although Memory Alpha was able to get a different deal, one doubts that anyone else would — Memory Alpha is a 7-Million hits per month site which brings in some serious ad revenue.
At any rate, Wikia’s OpenServing service will be giving away hosting in a MediaWiki derivative in exchange for links back to Wikia. Not just that, but according to this article on eWeek they are hoping to become a sort of unified hosting based on open source website software such WordPress and Drupal. In fact, they’re open to suggestions, so if you are a web software developer and have some other open source software you’re willing to help them install and maintain on their servers … they want to hear from you.
The Google News Roundup
Lately it seems like Google is spending most of their time, energy, and money on making sure you spend as much time as possible on their website … with enhancements to Google’s RSS Reader and calendars (check out the new built-in weather forecasts) their new shopping checkout service (oh, and don’t miss the $10 off $30 coupon) ... but now they’ve finally found time to add some actual search tools.
Google Code Search lets you search through all the source code Google could find on the web… which is a lot, but not nearly as much as you’d think. I was very disappointed to find that none of the code on SourceForge.net is available … SourceForge has a robots.txt which denies Google (or any other search robot) access to the CVS or SVN code repositories. I can’t imagine why they’d want to do that, apart from avoiding the bandwidth of having Google, Yahoo, and MSN peeking at every file 10 times a day….
Oh, one last thing … they’ve also allowed webmasters to use any of their 1200+ Gadgets on your web page. Previously the Gadgets were only usable on the Google customizable homepage, and via the Google desktop, but now you can host them on your webpage, and all you need is the ability to paste a bit of javascript into your page.
Goodbye Network Neutrality (at least in Norway)
In June 2006 NextGenTel, one of the biggest broadband providers in Norway decided to deliberately limit the bandwidth from the Norwegian Broadcasting Corporation (NRK). Meaning that customers of NextGenTel in Norway will experience a lower quality of service on content from the NRK compared to content from the providers that want to pay NextGenTel for distribution. — eirikso
Basically, the largest Norwegian broadband provider has decided to make some extra cash by holding their bandwidth back and throttling the speed of delivery (to their paying customers) of data from content providers that won’t bribe them to provide full speeds.
In other words: if you’re a NextGenTel customer, you can probably get better bandwidth downloading the NRK‘s content through a proxy than directly. [o.O] Or, put another way: NextGenTel is one step away from full-fledged censoring of data, with bribes as the only way for web sites to ensure content delivery.
I doubt many of my readers use NextGenTel, but just for the record: if you do, you should vote with your krone and switch providers.