Scripting

Apt-Get HTTP Proxy — One-Liner

I have a few Debian servers that are behind a firewall and they don’t have direct access to the internet. “Protected Servers”.  I occasionally have to update their packages via a web proxy in the DMZ. I know there a countless ways to do this, but I wanted a one-liner that i can use without having to modify the apt-get application or my hosts default proxy settings.

Hope this helps someone else, cheers!

http_proxy="http://172.16.0.5:3128" apt-get update

 

Java Code — Blocklist2ACL 2.0 Released!!

**Updated 2.0.1 (rc1)**

Hey all, due to the success of the Blocklist2ACL.hta script from this previous post, I decided to port the code over from VBscript to Java. In effort to make the program more stable, cross-platform comparable, and future proof. I’ve received a few comments and PMs from users explaining that the Internet Explorer requirement was giving them issues. This is true, the old script relied heavily on Internet Explorer and what version you were running. Well enough of that, as I was able to port the code over to Java (no, not JavaScript), which has it’s own runtime objects and classes that I was able to utilize.

Here are some screenshots:

 Requirements:
JRE1.7+, grab it here.

Download:
Blocklist2ACL20rc1

SHA1      = 9DD863BBF0A5BC2EE110EF6C6F899F7AAC2A0ABD
SHA-256 = 245CA6DE2A93800742BD16B6506C6C3241A9E62410E294B76734875AB89A636C

VBscript — IP Blocklist to Cisco ASA access-list

**This article is old, see new Blocklist2ACL 2.0 project.**


Hi folks! A little script I wrote with VBscript that pulls in IP blocklists from different third party URLs and converts them in to well-formatted Cisco ASA access-lists.  The idea stemed from the old days of running PeerGuardian and Moblock to inhibit known malicious or unwanted IP address from attempting to connect and stopping them right then and there on your computer’s firewall. It is similar to URL Blocklists that focus on URLs and Domain Names, but instead filering is done by IPs only. I wanted to take this IP Blocklist concept that has primarly been done at the Desktop Fireweall layer and abstract it to the Network Firewall. In this case a Cisco ASA that way all traffic that any connection that crosses the Firewall will be filtered by this list.

The script is fairly straightforward and the source code is below so you may look through it. Feel free to improve upon it and share it with others. I have a few years of writing vbscripts, but am in no way a professional coder. Also, if you by any chance know Linux Shell or Qt and could potentially port this to Linux or even better JAVA for platform independence, let me know!! That would be sweet.

Video Tutorial

Continue reading…

Linux — MRTG in Minutes!

MRTG is one of those tools a Network Engineer has on his/her toolbelt. MRTG allows the graphing of trending network activity for a wide range of devices. It uses SNMP to query a host and poll it’s network information and statistics. It can be used with Routers, Switches, Linux Hosts, etc.

I’m going to run MRTG against a Linux Router(running IPtables), a HP PowerConnect Switch, a Cisco Router, and an ESXi host. Anyway….Let’s get started.

Continue reading…

Squid Proxy — EasyList to SquidGuard Expression List Conversion

Hi all! It’s seems to be difficult to keep up with the EasyList expression lists, and to make matters more confusing, the conversion from one EasyList expression list to SquidGuard can be cumbersome. There are a few article out on Google that people have posted their own SED files to convert from EasyList to squidGuard, that will manipulate the EasyList expression list and convert it to be compatible with SquidGuard. However, most are outout of date and will cause squidGuard to fail to initialize the expression list when issuing a

>squidGuard -C all

Continue reading…

Linux — ASCII Art in Terminal Sessions

I was wondering today…I used to see this screenshot of a ASCII cow in a terminal that was giving some sort of advice or fortune. After a little googling I found the application fortune which shows you a simple fortune when run from a terminal on linux/unix. I also found the application cowsay which is the app that shows the ASCII art of animals with a comic balloon. By default a cow, however there are many others. I chose tux.

$ fortune | cowsay
 _______________________________________
/ Don't go around saying the world owes 
| you a living. The world owes you      |
| nothing. It was here first.           |
|                                       |
 -- Mark Twain                         /
 ---------------------------------------
           ^__^
           (oo)_______
            (__)       )/
                ||----w |
                ||     ||

 

Why the pipe? because fortune echos a string, and cowsay reads in a string.

Now the problem was I had to type the command every single time. To solve this we turn to your users .bashrc file. Located ~/.bashrc for Ubuntu users. Edit the file with your favorite text editor and add the following lines at the bottom.

if [ -x /usr/games/cowsay -a -x /usr/games/fortune ]; 
then fortune | cowsay 
fi

 


(if statement checks to make sure both cowsay and fortune are installed)
Now, everytime you open a terminal or command prompt you’ll have a cool animal telling you a fortune!

Sources:
http://askubuntu.com/questions/16428/showing-a-cowsays-in-every-new-terminal-session
Cool Android app here. This will send SMS text messages from your phone as cowsay!!