11.04.2013 Views

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PC0000 guardproof.info. third.guardproof.info.<br />

*/<br />

Process that with the ’dot’ program, and you have your<br />

first network <strong>di</strong>agram.<br />

In ad<strong>di</strong>tion to the conventional graphic edges, the<br />

descriptor file includes similar format pair-data that<br />

describes services, zone records (sub-graphs?),<br />

blacklisted addresses, and other things which might be<br />

interesting to include in your graph. This ad<strong>di</strong>tional<br />

information could be <strong>di</strong>splayed as <strong>di</strong>fferent node<br />

shapes, colors, line sizes, etc.<br />

The descriptor file can also be read and e<strong>di</strong>ted by a<br />

<strong>Bash</strong> script (of course). You should be able to find<br />

most of the functions required within the<br />

"is_spammer.bash" script.<br />

# End Quickstart.<br />

Ad<strong>di</strong>tional Note<br />

========== ====<br />

Michael Zick points out that there is a "makeviz.bash" interactive<br />

Web site at re<strong>di</strong>ris.es. Can’t give the full URL, since this is not<br />

a publically accessible site.<br />

Un altro script anti-spam.<br />

Esempio A-28. Caccia allo spammer<br />

#!/bin/bash<br />

# whx.sh: "whois" spammer lookup<br />

# Author: Walter Dnes<br />

# Slight revisions (first section) by ABS Guide author.<br />

# Used in ABS Guide with permission.<br />

Appen<strong>di</strong>ce A. Script aggiuntivi<br />

# Needs version 3.x or greater of <strong>Bash</strong> to run (because of =~ operator).<br />

# Commented by script author and ABS Guide author.<br />

E_BADARGS=65 # Missing command-line arg.<br />

E_NOHOST=66 # Host not found.<br />

E_TIMEOUT=67 # Host lookup timed out.<br />

E_UNDEF=68 # Some other (undefined) error.<br />

HOSTWAIT=10 # Specify up to 10 seconds for host query reply.<br />

# The actual wait may be a bit longer.<br />

711

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!