Skip to content

pham/blip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

PROGRAM

blip.pl - Blocks and unblocks IPs using iptables.

Usage Examples

Using the Unix iptables can be confusing, blip is a simple interface that un/blocks IPs and put them in a designated chain.

./blip.pl -block 114.80.97.88
./blip.pl -unblock 114.80.97.88

You can pass to it multiple IPs by separating them with commas.

List the blocked IPs:

./blip.pl -list

When you're tired of it all:

./blip.pl -wipe

Options

-verbose <level>

Turns on vebosity.

-bin <path-to-iptables>

Defaults to /sbin/iptables if it's not there, set it yourself.

-chain <chain>

Chain or target to add IPs to. Defaults to BLIP.

NAME

BlockIP.pm - Simple interface for iptables.

SYNOPSIS

$BLIP = BlockIP->new(@ARGV);
$BLIP->commands;

DESCRIPTION

Blocks and unblocks IPs to a special chain called BLIP.

Public Methods

new

Creates the object, subsequently, creates the CHAIN if doesn't exist.

commands (void)

Accepts these command-line args:

-verbose = 2 levels of outputs
-list    = shows current table
-wipe    = remove chain
-block   = block this IP
-unblock = unblock this IP

block (ip)

Blocks an IP if not already blacklisted.

unblock (ip)

Unblocks an IP in the chain.

Private Methods

_init (void)

Prepares iptables to accept un/block of IPs.

_create_chain (void)

Creates a new chain and chain this to INPUT.

_execute (command,[reg-pattern])

Execute command, if passed a regexp, it'll try to match it with the output returns true/false otherwise, return entire output for parsing.

_printf (level,format,@array)

Works just like printf except has a built-in check for -verbose.

HISTORY

20120314 - v1.0 - Created.

v1.0.1 - Remove README. Link README.pod to blip.pl. Change blip to blip.pl. Adds -chain option so user chan specify which chain/target to use.

v1.1 - Add chaining to INPUT for this thing to actually do the blocking. Oops.

AUTHOR

This module by Paul Pham.

COPYRIGHT AND LICENSE

Copyright 2012 by Paul Pham

This program and library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

About

Simple interface for iptables to block IP addresses

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages