Network programing with bash

In my last article I showed how to use file descriptors in shell scripts. If your shell happens to be bash you can even have a file descriptor map to a network socket.

When executing a command on a /dev/tcp/$host/$port pseudo-device, Bash opens a TCP connection to the associated socket.

 
Posted on Jan 30, 2008 by: Fred Cirera @ 17:50 Leave a comment Comments: 0

File descriptors in shell

Usually people don't know or have forgotten that they can open file descriptors in shell.

Open a file descriptor in shell can be useful for two things. Manipulate several input and output as the same time, and for performance.

 
Posted on Jan 30, 2008 by: Fred Cirera @ 12:31 Leave a comment Comments: 1

Email obfuscation

Email harvester traverse the Web looking for email signatures in web pages. In the sole purpose of building large databases of email addresses to send spam.

That's why it is always a good idea to not publish your email address on a web page, but sometime you absolutely need to be contacted and you need to post your email address.

On web pages you have no control, such as forums, blogs or commercial websites, you can use a service like KasMail [kasmail.com] to create a temporary email address. When you need to enter your email somewhere you use that temporary email address. This email address is only valid a short period of time (from few days to several month) and then it is automatically deleted by KasMail. Email harvesters will send the spam to an expired email address.

Sometimes though, you need to publish your personal email address. What you can do is to obfuscate your address so the harvesters will miss it. Here is the recipe I often use myself.

If you have a Mac, UNIX, or Linux type the following line in a terminal window, to encrypt your email address. If you have Windows installed on your computer, install a real OS.
$ echo 'booba@gump.com' | openssl base64
Ym9vYmFAZ3VtcC5jb20K

$ echo 'booba@gump.com' | openssl base64
Ym9vYmFAZ3VtcC5jb20K

The string "Ym9vYmFAZ3VtcC5jb20K" is your email address encoded in base 64. Enter the following line in your web pages at the place you want to enter your email address.
<script type="text/javascript">
document.write(atob('Ym9vYmFAZ3VtcC5jb20K'));
</script>

<script type="text/javascript">
document.write(atob('Ym9vYmFAZ3VtcC5jb20K'));
</script>

Voila! An email harvester will see a group of meaningless characters, and a real web browser will display your email address.
 
Posted on Dec 19, 2007 by: Fred Cirera @ 12:05 Leave a comment Comments: 0