Fixes for bad smalling code...
...actually it still smells bad, but I fixed the broken
sudoku awk thing.
Have fun.
Graphing of iptables firewalls
Recently I found this
page on how an iptables
firewall could be visualized using the
graphviz package.
I did this thing on my own too, it is kind of different in it's
details, and I found it pretty interesting to anylize simpler
firewalls (just
seeing the structure is pretty
insightful).
Here is some more information on this thing:
- chains w/o policy, i.e. user-defined ones will have a return policy
- line width is the amount of data gone through that rule/policy, it
is scale logarithmically, since there are some rules which have pretty much
no traffic, but others get the bulk of data. Also, the scale is fixed to
a maximum width, which can be specified on the command line
- dashed lines are ones which were not yet hit by any traffic
- built-in targets are 'end states' and displayed as ellipses
- non referenced chains will not be plotted
As noted above some behavior is configurable through some command line switches.
See the "-h" switch and the README file inside the package.
usage
sudo python ipt2dot.py -c | tee filter.dot
dot -Tpng -ofilter.png filter.dot
Though this works fine, i suggest to save dot output to svg and
use e.g.
inkscape to
export a beautiful png ;).
schniff fixes and a dumb sudoku solver
After reading some of my code, in particular schniff.c. I found some
potential bugs and misbehavior (according to the programs help). Those
are fixed now.
Additionally, rough dns decoding, exact-string and extended-regex
matching are implemented. As before, all filters are ANDed together ;).
See
schniff.c for code.
About sudoku; well, some weeks ago, notably before the last exams ;)
I played with depth-first searching and wrote solvers for sudoku and the
n-queens
Problem. There's not really much to say about it.
See
t-sudoku.cpp for an insane
templated implementation, and
sudoku.awk
for the backtracking sudoku solver in the AWK scripting language.
dumb XML parser
I found it interesting how could an XML parser be coded
using c++ and stl. It took me some hours of work and later
refinements took even more hours, that's evolution ;).
The parser itself, as mentioned, is dumb. Dumb in this context
means, regarding anti-features:
- does not know about charsets
- does not know anything about XML Processing Instructions
- does not handle any doctype
- is kind of slow... I think
- not portable and
- not standard
- UGLY UGLY code
and features:
- handles strings or files through iostreams/sstreams
- parses whole document and builds document tree
- simplistic, the structure is as simple as it is dumb ;)
- output a tree-like thing or...
- output an xml document
Throughout all the XML documents I have around here I did not
found one that my parser(lein) failed... (those documents are
written by my self or generated through self written xslt ;o))
I think that's much info... for some 480 lines of code... I did
not made a tarball, it is basically one files containing a simple
introductory comment (which tells you how to compile - using a
modestly recent gnu compiler).
usage
./xmlparse [files...]
I tested it on a solaris express box i have around and linux
width g++ 4.0 or 4.1 (solaris has a gcc 3.4)
newer, better schniff
I experienced those hangings when using schniff - hey, I firstly even
didn't knew why it was hanging (the first 1/100th second I guess)... but then, it
came to my mind that it is just waiting for some packets to arrive!!! What
discovery - well it didn't took long to fix this with select(2) - one of my
favourite system calls.
And just before I forget about it another time - I did a simplistic (read:
not completed!) dns decoder... it does read flags and decodes the name someone's
asking - but that's merely all.
nevertheless, I hope somebody enjoys my small
tool.
venom, an arp poisoning tool - and backup.sh
Venom is a smallish arp poisoning tool that came out of one of the
network programming assignments. I found it quite usable, so I decided
to publish it here.
Currently I am attending a network programming course. The assignment for
next month is a small arp poisoning tool base upon
libnet 1.1. It's
kind of early for the code to be finished, fun I had fun doing it, and
learned to appreciate libnet ;).
My tool is a bit more than the assignment requested, so here is an overview
of what it does:
- N hosts poisoning
- automatically enable ipv4 ip-forwarding (currently only on linux
through the sysctl interface)
- a really slick spinner that uses
Ken Perlin's improved noise
- user definable arp-send delay
- user definable spoof-hwaddress
- for convenience output a tcpdump match for all relevant packets
The current version is
v0.08.
I also added my backup script that does quite a good job on securing
the most important data of my server machine to another computer (which
in turn will write them to dvd from time to time - ok, I am managing this
manually... ;)). See it
here.
rm.c - a small integer op register machine
I was just learning some theory and there was a nice example of a simple
register machine in the book that could do some mathematical operations
on integers. I coded a small tool that does axactly that and it is quite
nice running.
rm.c
There is a sample program and a README in the source itself - just see
and have fun :)
schniff.c - a smallish test network s(ch)niffer AND redo_menu.sh
I wrote this tool some weeks ago when I had trouble with my ADSL. I thought
that it would be nice to see what happens on the line with a self-brew-tool.
Well, that's the result of it... 1 or 2 days of coding - I don't remember ;).
The tool itself is really dead simple, and straightforward coded - no magic
not at all tested, but if anybody wants to see a bad example on how stuff
merely works :).
schniff.c
The other thing - redo_menu.sh - is may way of managing my website menu. The thing
consists of a script that inserts the menu from a menu-template to all html pages.
It's - as usual - not good code, but I never had trouble with it.
redo_menu.sh
getQuote.pl
I added a small script I just wrote... it fetches irc-quotes... but look yourself:
getQuote.pl