Categories
Perl

How to Use PAR with Strawberry Perl

If you want to share your cool script with your non scripting buddies, you can convince them to learn perl and install modules, etc. Or you can remote into their machine and do a bunch of work getting stuff working on their machine, or you can use PAR and send them a compiled script.

Categories
Perl

Test List of URLs for Fastest Response

This Perl script will take a list of URLs and sort them by the fastest ping response.

Categories
Perl

Perl Keyword Density Checker

Not so much now, but keyword density used to be a very large factor in determining how well a website ranks. This perl script counts words and tells you what their percentage is:

Categories
Perl

Perl Remove Unwanted HTML

In case you want to remove the extra email such as spans, div, and other junk from a block of text, you can use HTML::Restrict like this:

Categories
Perl

Perl MD5sum Using Digest::MD5

There is a binary utility on most flavors of linux that allows you to compare if a file is exactly the same as another. Here is how you get MD5 info using Perl:

Categories
Perl

Perl Strip Out hrefs

I was importing text into a shopping cart that was provided by the vendor, but they included links back to all their products! I wanted the keywords, but not the links. HTML::TokeParser::Simple did the job:

Categories
Perl

Perl MIME::Base64

Base64 Encoding allows you to convert a binary file into a text message. Sometimes binary is not allowed to be transmitted. Whatever your reason, here is how you create a Base64 encoded file using Perl:

Categories
Perl

Extract IPv4 Address From Text Using Perl

I had a list of IP address and wanted to know what they were – but I didn’t want to do a DNS lookup by hand on each. The list I had was really a chunk of text with IPv4 addresses all over in it. Here is how I extracted them for the report:

Categories
Perl

Perl Check Open Ports

I needed to check a list of jumphosts and see if they were linux or windows. I didn’t want to log in to each one manually and wanted the results of something like nmap saved into a CSV file. I could of grepped through nmap output, but it wouldn’t of formatted the way I wanted. Instead I wrote a small perl script to check for open ports on a list of domains or IPv4 addresses. Here is the perl script to check for open ports:

Categories
Perl

Perl Convert List of Hostnames to IP4 Addresses

Instead of having to type nslookup over and over, let’s script a solution that queries a list. We can then redirect the output into a file and have a nice, CSV output – all automated.