Tag Archives: tech

Spidering hacks


Yesterday I bought Kevin Hemenway’s book “Spidering Hacks”. It seems, at first glance, to be an amazingly useful book. While I don’t expect that there’s much in here that I could not figure out on my own, with time and motivation, I think that the book provides a box of tools that will save me an enormous amount of those two precious comodoties.

And, I should note, the acknowledgements of the book speak of me lovingly, and I just could not resist:

… to Rich and Ken for being my scapegoats (“well, hey, at least I’m not that late”) …

heh, heh

Morbus++

Rotating an image with Image::Magick and Perl

While messing with photos, I needed a simple way to rotate an image that didn’t involve loading up Gimp or Paint Shop, or whatever. Here it is.

What I don’t get is that it segfaults every time I run it. However, the image is always created correctly. Any tips would be welcome. Meanwhile, I’m rotating images with less pain.

Usage: rotateimage img deg where img is the path to the image, and deg is the number of degrees through which you want to rotate it, with the default being 90 counterclockwise.

#!/usr/bin/perl
use Image::Magick;
my $image = Image::Magick->new;
my $deg = $ARGV[1] || 90;

print "Reading $ARGV[0]n";
open (IMAGE, $ARGV[0]);
$image->Read(file=>*IMAGE);
close(IMAGE);

$image->Rotate($deg);
$filename = $ARGV[0];
$filename =~ s/(.*).(.*)$/$1.new.$2/;
print "Writing $filenamen";
open(IMAGE, ">$filename");
$image->Write(file=>*IMAGE, $filename=>$filename);
close(IMAGE);

Don’t run unexpected attachments

OK, folks, repeat after me: Don’t run unexpected attachments.

If you get email, and it has an attachment, and either you’re not actually expecting it, or the message body does not clearly explain what the attchment is, then delete it. It’s just that simple.

If it was from someone you know, contact them personally and ask them what it was that they sent you.

The latest worm/virus is yet another testament that people simply *refuse* to learn this simple lesson. But this one makes it stand out even more.

I mean, come on folks. The subject line is “Hi” and the message body is “Testy test”. Doesn’t this suggest to *anyone* that this is not legitimate email? And, yet, there are reports of *millions* of infected machines.

Once again, the Postfix rules:

In header_checks:

^Subject: Hi$ DISCARD Beagle virus/worm

and in mime_header_checks.regexp

/name=”?(.*).(ade|adp|asx|bas|bat|chm|cmd|com|cmp|crt|do|exe|hlp|hta|hta|inf|ins|isp|jse|lnk|mnb|mde|msc|msi|msp|mst|pcd|reg|rm|scr|pif|scr|sct|shs|url|vbe|vbs|vxd|wsc|wsf|wsh|xl)”?$/ REJECT For security reasons we reject attachments of this type

This particular worm is a combination of mail server administrator incompetence (or negligence) and people persistent refusal to use a smidgen of common sense when reading email. This is exactly the sort of worm that should have died before it ever infected the first person.

*Sheesh*

Braindamaged patents

Just when you think that patents can’t get any stupider, you see an article like this.

In summary, the patent claims to own the idea of someone having both MyName@somewhere.com (email address) and MyName.somewhere.com (web site).

I have to shake my head in amazement that someone could *be* that stupid. And I wish, not for the first time, that someone with deep pockets would start a massive class action lawsuit against the US Patent Office for gross negligence, gross misuse of public funding, and general stupidity.

On *several* of my machines, I’m using mod_rewrite to map username.domain.com to a web site for every username on the machine. That user, by definition, of course, has an email address of username@domain.com for that particular domain.

Note that *many* companies have been doing this for the last ten years, not least of which is Demon Internet, in England, one of the largest ISPs on the planet, I think.

Also, note that the recipe for doing this appears in the Apache documentation, in a document called the rewrite guide. See the section called Virtual User Hosts on the page http://httpd.apache.org/docs/misc/rewriteguide.html

Also note that the recipe for doing this appears in Apache Cookbook.

Also note that people have been doing this since the VERY FIRST DAY that there was such a thing as the World Wide Web.

The fact that the patent office can give out patents for stuff that have been part of common practice since day one is absolutely absurd, and possibly criminal. The patent office is way out of hand. We all knew that. But things like this make it so apparent that it’s mind boggling that the US courts are content to sit around and allow frivolous lawsuits like this to be filed on a regular basis.

SCO sucks

First, I want to be completely clear that i hate SCO for technical reasons, not for legal, financial, or corporate reasons. The OS, not the company, is a festering heap of dung. And not in a nice way, either.

I have now been attempting to boot a SCO server for 4 hours. I consider myself moderately knowledgeable about Unix-like operating systems. This should not be this hard.

I think that I should be permitted to testify in the SCO trial, if it indeed ever comes to trial. My role would be to laugh mockingly each time SCO suggests that someone would want to copy their code.

Then, during breaks in the trial, I can set up a mud pie stand on the corner, and sue the Mrs Smith’s pie company for stealing my ideas. I could submit evidence such as “Hey, they’re both pies! It should be obvious!” and then I could send bills to everyone making pies at home.

It’s pure genius!

Confusing spam

I continue to find spam confusing.

Why would someone send out hundreds of spam messages, for example, with no body text? For a while, I just assumed that there was some attachment that I wasn’t seeing because I wasn’t using Outbreak, or that there was some hidden HTML. But, no, there’s nothing at all. I looked at the mbox, and it’s just a blank message.

The business of sending a misleading subject line I sort of understand – to get people to read a message that they would not otherwise read. But when the subject line is “load insect ambrosial”, who’s going to read that?

Oh, and here’s a fun one. I’ve gotten several messages lately where it was apparent that the spammer didn’t quite know how to use their software. For example, the subject line might be %RND_CHARS(8-20) which, presumably, was supposed to generate a string of 8 to 20 random characters.

Another thing recently has been a series of messages with the following subject line:

is could be your Ticket…|Don’t let this slip through your fingers….|The Stars are the Limit…|It222s your time to Come Aboard…|Don’t miss the Train…To your Dreams…|Awesome Opportunity!|Secrets of the Rich Finally Revealed!|See What the “Heavy Hitters” do not want you to know!|Generate Massive Wealth!|Show Me!|Accumulate Massive Wealth!|At Last, Secrets of the Rich and Powerful Finally Revealed!|See What We’ve Never Been Shown Before!|The Last One You Will Ever Need!|WOW! Please Check This One Out, You Won’t Be Sorry!|Staying’ Home and Loving’ It!|Opportunity Express!|Secrets of Internet Millionaires!|Change Your Future Forever!|Finally, an Answer to Your Prayers!|The World’s Greatest Opportunity!|The Most Realistic Program Ever!|Top of the Line Opportunity!|Once In A Lifetime Opportunity!|An Opportunity You Can’t Keep to Yourself!|This One is Really Easy!|You%}

So, I can only presume here that the spammer is a complete moron (I mean, even more than regular spammers) and could not figure out how to get the software to pick just one of the titles. The good news is that you can take that entire list and feed it directly into your spam filtering, and catch that entire category of spam in one easy step. Very helpful of them, don’tcha think?

My daughter is a hacker

Disclaimer: For those of you who are not already familiar with this fact, you should know that the media consistently misuses the term “hacker.” A hacker is someone who enjoys tinkering (usually with technology), experimenting, and playing. What the media refers to as “hackers” are more accurately referred to as “crackers”, which are folks that maliciously try to break in where they are not wanted. This has been a public service message.

So, this morning, while I was in the shower, my daughter discovered how to change all of my desktop settings on Enlightenment. She was very pleased with herself for this discovery. I tried very hard not to dampen her spirits.

So, now, she has her own login. And although she does not (yet) know the password, this is a frightening new step in her path of hackerness. She has set her own desktop background. She has customized the menus.

At least she’s not destroying my desktop settings any more. And I don’t *think* she can do any major damage.

On the other hand, perhaps I should put her account in some kind of chroot jail, or get her her own computer …

Helpful hint to spammers

Dear spammers,

Here’s a helpful tip.

If you have to misspell your product’s name in order to get it into my inbox, this should be a clue that I DON’T WANT IT!

I do not want your V@|1um or your X(a)n@x.

I do not want to 3nl@rge my |ips or my p3n1s, and I do not want to c|3@n my c0|0n.

Is that clear?