Code Vault

From Sfvlug

Revision as of 23:05, 4 January 2007 by G4rlic (Talk | contribs)

Contents

Note:

What is the best way to contribute code? Should it just be placed here or should a seperate page be created?

Good question, I had intended to leave a lot of that type of decision up to whoever posted something but since this is going to be a community page it might be better to keep it less cluttered so I will suggest making a brief statement here about the code and a link to the page where the actual code lives. The discussion tab Talk:Code Vault can be used for comments rather than making further clutter here. If you haven't gotten the copyright holder's permission to use the code the link should be to the original source.

Here are some examples to give everyone a better idea, we can clean this area up later once we get more contributions:

(Let's say I'm not about the license and don't know if it is OK to reproduce.)

How to contribute code and the organization of this section will be a topic of discussion at the Saturday December 16, 2006 meeting. See Meetings for more information on the meeting.

Access Database to HTML

I have written a bash script that converts Access databases to HTML. Source Code

I know of at least two people in the LUG who were interested in this functionality. Code is GPL.

Process Substitution (or, how to do more with less effort)

Process Substitution is a good way to do things in a single line of script or at the command line, that would otherwise take extra work like writing to temp files.

Python File Slicing

pyFileSlice is a simple utility that will chop out a section of a file that has common starting and ending tags. Pulling out the page referrers section in an Awstats data file for further analysis prompted this little bit of research. After trying 3 methods (one involving regex pattern checking over each element in a list, one involving startswith(), and one that uses startswith() and doesn't read the file all at once) the one presented here works the fastest with the least amount of memory used. Source Code

note: 20061211: alternate method posted for looping through the file.

Generate a report on an Email Dictionary Attack

This is just some Bourne shell script I whipped up while trying to learn more about a dictionary attack hitting my mail server. Messages not delivered to a real user are dropped into /var/spool/mail/bounce in maildir format. Change the numbers following seq to the start and finish messages desired to check. I'm just posting this here primarily as a scrapbook, and for educational purposes.

for A in `seq 137146 200000` ; do
[ -f ../mail/bounce/$A ] || continue
formail -x To < ../mail/bounce/$A | awk '{print $NF}' | tr -d \\< | tr -d \\> | tr A-Z a-z
done | egrep '@example.com$' | sort | uniq -c | less

Contributed by JeffCarlson.


Return to Main Page

Personal tools