weblog d’un abbe

20081211

Ready to assassinate spam

Filed under: Experiments, Fun, Hacking — Tags: , , , , , — abbe @ 2136

Since a week or two, I noticed I suddenly started to get many spams (at the rate of around 10/day) delivered to my gmail inbox. I reported them every time, but that is of not much use. So tired of reporting spams, I started to create filters (in gmail) based on From address, ‘Subject’ etc. to delete them as soon they arrive, and I noticed that some of the ham mails also got deleted due to my filters. So, to get rid of this problem yesternight I installed SpamAssassin (which I’m afraid of installing earlier because I heard of its complex configuration) on my box integrated with postfix instance on my Gentoo GNU/Linux. The installation (thanks to portage) is very easy and integration with postfix is also quite easy and well documented on its wiki. And now, the best part, my SpamAssassin today recognized those mails as spam, which gmail‘s spam filters delivered into my inbox :).

Following is a Gnus hack to report spam as ham and ham as spam :

(defun my-gnus-mark-spam()
  (interactive)
  (gnus-summary-show-raw-article)
  (gnus-summary-save-in-pipe "spamc -L spam")
  (gnus-summary-show-article)
  ;; substitute "nnmaildir:spam" with the name of group holding "spam"
  (gnus-summary-move-article nil "nnmaildir:spam"))

(defun my-gnus-mark-ham()
  (interactive)
  (gnus-summary-show-raw-article)
  (gnus-summary-save-in-pipe "spamc -L ham")
  (gnus-summary-show-article)
  (gnus-summary-respool-article nil))

;; in summary mode use "B s" and "B h" keys to mark a mail as spam and ham
;; respectively for SpamAssassin to learn, and to also move to "spam" maildir
;; or respool mail accordingly
(define-key gnus-summary-mode-map (kbd "B s") 'my-gnus-mark-spam)
(define-key gnus-summary-mode-map (kbd "B h") 'my-gnus-mark-ham)

I could have used Gnus built-in spam filtering, but Gnus is not the only MUA I use ;) . Anyways, happy assassinating spam…;)

Advertisements

20061123

OpenDNS for faster domain name resolution

Filed under: Experiments, Fun — abbe @ 0209

I just discovered a cool service named OpenDNS. OpenDNS provides a free domain name resolution server. The domain name resolution is quite fast and with no noticeable latency. They also provide a phishing filter, where phishing sites were blocked at the time of domain name resolution, and typo-correction.

Fishing G00GL3

So, why not try it.

20061023

Conky

Filed under: Experiments, Hacking — abbe @ 2348

Conky

Conky, a cool lighweight system monitor is now available on Fedora Core 5. I’ve created an SRPM for it, which can be downloaded from http://wahjava.googlepages.com/conky-1.4.2-1.src.rpm . It is just another RPM which I built recently from scratch. And BtW, Fedora Core 6 is going to release tomorrow, so before you install it, why not try this package and comment on my rpmbuilding skills. ;-)

20061013

Anonymizing with The Onion Router

Filed under: Experiments — abbe @ 0000

Well last night, I tried tor (in combination with privoxy). As I’m on Fedora Core 5 AMD64 architecture and there is no prebuilt package available for my platform, so I downloaded its source tarball. Fortunately, it contains tor.spec (which is required for building RPMs). So I tried rpmbuilding on tor.spec but unfortunately that failed. So I hacked my own tor.spec file. In order to build tor using this file, make sure you’ve rpmdevtools package. rpmdevtools will assist you in building RPMs in non-superuser mode. If you’re using rpmdevtools, use rpmdev-setuptree to setup a build tree for you at ~/rpmbuild location. Now, download tor.spec file in {rpmbuild-root}/SPECS. And download tor-0.1.1.24.tar.gz from http://tor.eff.org/ into {rpmbuild-root}/SOURCES. Now start build with rpmbuild -bb {rpmbuild-root}/SPECS/tor.spec. This will result in tor*-0.1.1.24-1.{architecture}.rpm built in {rpmbuild-root}/RPMS/{architecture} directory. Now, since you’ve RPMs you know what to do ;-). After installing tor you can start it with sudo torctl start. You also need to install Privoxy. It is available as an rpm in FC5. For more details, refer to tor docs.

Why do we need an anonymizer ? Good question, I hope this page will answer you.

20061006

Multicasting audio with VLC – II

Filed under: Experiments, Research — abbe @ 1247

Though I’ve no previous plans to release part-II. But unfortunately what I found after some packet sniffing, inspired me to post this next part. This part deals with the reality of multicasting. Multicasting is a good technique that can minimize the unnecessary traffic on the internet, but unfortunately it is not implemented properly (by ISPs, by network devices etc.) . First, read the following dump:

[abbe@chatteau-d-lf ~]$ vlc -I dummy --sout='#duplicate{dst=display,dst=std{access=rtp,\\
> mux=ts,dst=239.1.0.3:1234}}' http://ct4.fast-serv.com:9620 >&2 2>/dev/null &
[1] 24445
[abbe@chatteau-d-lf ~]$ ssh abbe@172.16.0.3
abbe@172.16.0.3's password:
Linux marseilles 2.6.15-27-amd64-generic #1 SMP PREEMPT Sat Sep 16 01:50:50 UTC 2006 x86_64 GNU/Linux

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
You have mail.
Last login: Fri Oct  6 11:02:59 2006
abbe@marseilles:~$ sudo tcpdump -i eth0 ether multicast and dst port 1234
Password:
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
12:04:18.934508 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:19.075196 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:19.223828 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:19.368566 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:19.517352 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:19.666095 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:19.810695 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:19.955592 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:20.100319 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:20.248925 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:20.393607 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:20.542330 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316
12:04:20.686872 IP 172.16.0.2.32805 > 239.1.0.3.1234: UDP, length 1316

13 packets captured
27 packets received by filter
0 packets dropped by kernel
abbe@marseilles:~$ exit
logout
Connection to 172.16.0.3 closed.
[abbe@chatteau-d-lf ~]$ sudo /usr/sbin/tcpdump -i eth2 ether multicast and dst port 1234
Password:
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth2, link-type EN10MB (Ethernet), capture size 96 bytes
12:05:53.730136 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:53.878769 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:54.023399 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:54.171926 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:54.316514 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:54.465112 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:54.609687 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:54.754349 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:54.902971 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:55.047641 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:55.196428 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316
12:05:55.341313 IP 172.16.0.2.32805 > 239.1.0.3.search-agent: UDP, length 1316

12 packets captured
24 packets received by filter
0 packets dropped by kernel

As you can see in the above dump, that the audio is being multicasted to a multicast ethernet address, but the network switch (in my case it is D-Link DES-1026G) is over (or under)-smart :-P. So it is not altering the destination address of the ethernet frame but instead broadcasting (not actually ethernet layer broadcast i.e. not destined for FF:FF:FF:FF:FF:FF MAC address) to all ethernet ports. Hence this is a virtual multicasting (or simulation of multicast ;-) ). So before going for any network device, make sure it supports multicasting properly (if you plan to multicast in future). And at last, I would like to thank Gautam for sharing his Late W. Richard Steven‘s UNP book, his knowledge, and that multiple unicast anecdote :-D with me.

20060925

Multicasting audio with VLC

Filed under: Experiments, Fun — abbe @ 1909

Well, right now I’m leaving for Bangalore. So before leaving I think I should describe my today’s adventure with multicasting audio in local network via VLC. There is an internet radio station that plays cool oldies (of 50s 60s etc.) named MadhurSangeet.com. The problem I’ve is it supports only 15 clients (as of today). So, if multiple users (of my network) all stream individually, also waste the bandwidth of my connection and also the server’s connection. So I thought if I connect one of my computer to the MadhurSangeet.com and can then multicast that stream in rest of my network.

Now, what software shall I use ? First thing that came into my mind is IceCast, but looking into its docs, I’ve found that it doesn’t support multicasting. So then I decided to checkout VLC also. Seeing into docs, I found it supports multicasting. :)

Then I downloaded VLC from Ubuntu repositories, and started it. And then in the Open Network Stream dialog box I found this option Stream output. So there I opted for streaming to an multicast IP address. And then clicked on OK button and it started streaming.

So, after this I download VLC at other clients (in my network) also and gave the chosen multicast IP address and port in Open Network Stream dialog box there. And it worked :).

20060510

ReactOS

Filed under: Experiences, Experiments — abbe @ 1524

ReactOS, a Free and Open Source OS, compatible with Windows NT.

ReactOS Boot Loader Screen
ReactOS Boot Loader Screen
ReactOS Splash Screen
ReactOS Splash Screen
ReactOS Command Prompt
ReactOS Command Prompt
ReactOS About box
ReactOS About box
ReactOS Registry Editor
ReactOS Registry Editor

Screen shots of ReactOS, taken by me, on QEmu. There are more screenshots available at: http://www.reactos.org/xhtml/en/screenshots.html .

20060427

Even I worked on PA-RISC too

Filed under: Experiences, Experiments — abbe @ 0428

Well, today I worked on PA-RISC processor based system, like one of my friend Gautam who worked on it @ his university.

Well, I was looking for some information on PA-RISC processors. I was surprised to know that most of its processors (forgot to mention, it is actually a family of processors) don’t have L2 caches, recent ones (so big, 64 MiB L2 cache of PA-RISC vs. my 2 MiB L2 Cache of Pentium 4 ;-) ), and 2 processors in mid generation have L2 caches. Anyways, you can read more about PA-RISC processors, @…..

Now, comes to the GNU/Linux play with the box. The PA-RISC box runs Debian GNU/Linux (Linux pa64 2.6.15-1-parisc64 #2 Mon Mar 6 17:39:49 GMT 2006 parisc64 GNU/Linux). A session with box is displayed below:

21287@pa64:~$ cat /proc/cpuinfo
processor       : 0
cpu family      : PA-RISC 2.0
cpu             : PA8600 (PCX-W+)
cpu MHz         : 400.000000
model           : 9000/785/B2000
model name      : Kazoo W+
hversion        : 0x00005d00
sversion        : 0x00000481
I-cache         : 512 KB
D-cache         : 1024 KB (WB, 0-way associative)
ITLB entries    : 160
DTLB entries    : 160 - shared with ITLB
bogomips        : 796.67
software id     : 2003331839

21287@pa64:~$ cat /proc/meminfo
MemTotal:      1793744 kB
MemFree:         33096 kB
Buffers:         67936 kB
Cached:         917148 kB
SwapCached:          0 kB
Active:         784156 kB
Inactive:       715640 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      1793744 kB
LowFree:         33096 kB
SwapTotal:      524280 kB
SwapFree:       524192 kB
Dirty:             352 kB
Writeback:           0 kB
Mapped:         586212 kB
Slab:           226992 kB
CommitLimit:   1421152 kB
Committed_AS:   839260 kB
PageTables:      10520 kB
VmallocTotal:   245728 kB
VmallocUsed:      3764 kB
VmallocChunk:   241600 kB
21287@pa64:~$ mount
/dev/sda5 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev type tmpfs (rw,size=10M,mode=0755)
/dev/sda1 on /mnt/sda1 type ext3 (rw)
21287@pa64:~$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:10:83:FF:6D:23
          inet addr:192.168.1.7  Bcast:255.255.255.255  Mask:255.255.255.0
          inet6 addr: fe80::210:83ff:feff:6d23/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:54875344 errors:1 dropped:0 overruns:0 frame:0
          TX packets:93060665 errors:415 dropped:0 overruns:0 carrier:243
          collisions:5825773 txqueuelen:1000
          RX bytes:15922891349 (14.8 GiB)  TX bytes:41259342948 (38.4 GiB)
          Interrupt:65 Base address:0xf00

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1281187 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1281187 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:118301798 (112.8 MiB)  TX bytes:118301798 (112.8 MiB)

21287@pa64:~$ ping -b 192.168.1.255
WARNING: pinging broadcast address
PING 192.168.1.255 (192.168.1.255) 56(84) bytes of data.
64 bytes from 192.168.1.5: icmp_seq=1 ttl=255 time=0.624 ms
64 bytes from 192.168.1.4: icmp_seq=1 ttl=64 time=1.11 ms (DUP!)
64 bytes from 192.168.1.3: icmp_seq=1 ttl=255 time=2.04 ms (DUP!)
64 bytes from 192.168.1.6: icmp_seq=1 ttl=64 time=3.27 ms (DUP!)
64 bytes from 192.168.1.5: icmp_seq=2 ttl=255 time=0.482 ms
64 bytes from 192.168.1.4: icmp_seq=2 ttl=64 time=0.645 ms (DUP!)
64 bytes from 192.168.1.3: icmp_seq=2 ttl=255 time=0.880 ms (DUP!)
64 bytes from 192.168.1.6: icmp_seq=2 ttl=64 time=1.06 ms (DUP!)

--- 192.168.1.255 ping statistics ---
2 packets transmitted, 2 received, +6 duplicates, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.482/1.266/3.271/0.884 ms
21287@pa64:~$ lspci
0000:00:0c.0 Ethernet controller: Digital Equipment Corporation DECchip 21142/43 (rev 41)
0000:00:0d.0 Multimedia audio controller: Analog Devices AD1889 sound chip
0000:00:0e.0 IDE interface: National Semiconductor Corporation 87415/87560 IDE (rev 03)
0000:00:0e.1 Bridge: National Semiconductor Corporation 87560 Legacy I/O (rev 01)
0000:00:0e.2 USB Controller: National Semiconductor Corporation USB Controller (rev 02)
0000:00:0f.0 SCSI storage controller: LSI Logic / Symbios Logic 53c895a (rev 01)
0000:01:00.0 3D controller: Hewlett-Packard Company Visualize FXe (rev 03)
21287@pa64:~$ who
the1     pts/0        Apr 19 13:12 (192.168.1.5)
the1     pts/11       Apr 17 19:12 (192.168.1.11)
21233    pts/53       Apr 26 13:51 (dslb-082-083-234-190.pools.arcor-ip.net)
the1     pts/36       Apr 17 19:13 (192.168.1.11:0.0)
1444     pts/72       Apr 26 11:02 (80-219-149-147.dclient.hispeed.ch)
the1     pts/80       Apr 26 14:30 (adsl-68-23-47-109.dsl.chcgil.ameritech.net)
21287    pts/2        Apr 26 15:01 (61.246.76.12)
21225    pts/77       Apr 20 02:07 (s010600045a2d8536:S.0)
21225    pts/69       Apr 20 02:19 (s010600045a2d8536:S.1)
21287@pa64:~$ lsusb
Bus 001 Device 002: ID 05a4:9760 Ortek Technology, Inc.
Bus 001 Device 001: ID 0000:0000

And hey, I even ran a X application (xedit) also, not on my DISPLAY but some other user’s ;-) . I even tried to sudo, but I’m not in /etc/sudoers ;-) . I even have a webpage of mine hosted there @ http://unixclan.no-ip.org/~21287/. And I even worked on Compaq Alpha (when ?? guess…).

Although, I dream to have one day my own PA-RISC box, my own Alpha box, my own IA-64 box, my own MIPS box, my own PowerPC box, my own PowerPC (64bit) box, my own Sparc box, any other processor box you can think of, and my own processor box. BTW, I’m not interested in processors, but in their boxes ;-) .

This post is dedicated to Gautam (the person who always inspire me).

Good Morning

20060326

Outlook Express to mbox conversion

Filed under: Experiments, Hacking — abbe @ 0242

Yesterday, I was at my dad’s office. He recently migrated some of his office PCs to Linux. One of the big problems encountered after transition to Linux is migration of e-mails from his previous e-mail client Microsoft Outlook Express 6 (on Microsoft Windows). I’m already using Evolution since November’ 2005 (since I got an internet connection at my place :-D). I’ve heard of Outport for export of mails from Microsoft Outlook Express. So, I downloaded and installed it on his Windows OS. And then started it but it terminated with an error saying Microsoft Outlook is not installed. Oops, but we’re not using Microsoft Outlook. So, all the hope of exporting mail from Outlook Express was lost till I got an idea

The idea to export a folder was to select all mails in any folder, and then using DnD feature provided by Windows (drag-and-drop), drag them to a Explorer window and drop them (a CommonDialog will work too but I’ve not tried that). This will copy all mails in as .EML files in the current directory in Explorer window. The good thing about these .EML files are they’re plain text files representing a mail in MIME format which mbox file uses.

An mbox file looks like below. When mbox is passed to file utility for recognition it recognizes as ASCII mail text, with very long lines. Whenever a new mail arrives it is appended to mbox with a starting line similar to From tycoon@someorganization.tld Tue Jul 31 13:21:11 2008. This line is not part of MIME specification.

From evolution@novell.com Tue Sep 25 07:45:12 2001
Return-Path: <evolution@novell.com>
Received: from pop.novell.com (IDENT:mail@localhost [127.0.0.1]) by
        pop.novell.com (8.9.3/8.9.3) with ESMTP id HAA20680; Tue, 25 Sep 2001
        07:45:12 -0400
Received: from smtp.novell.com (smtp.novell.com [141.154.95.10]) by
        pop.novell.com (8.9.3/8.9.3) with ESMTP id HAA20659 for
        <evolution@novell.com>; Tue, 25 Sep 2001 07:45:10 -0400
Received: (qmail 5610 invoked from network); 25 Sep 2001 11:45:02 -0000
Received: from smtp.novell.com (HELO localhost) (141.154.95.10) by
        pop.novell.com with SMTP; 25 Sep 2001 11:45:02 -0000
From: "The Evolution Team" <evolution@novell.com<
To: Evolution Users <evolution@novell.com>
Content-Type: multipart/related; type="multipart/alternative"; boundary="=-t4dRE6cqcdSBHOrMdTQ1"
X-Mailer: Evolution/1.1.99 (Preview Release)
Date: 7 September 2005 14:45:00 +0300
Message-Id: <1001418302.27070.20.camel@spectrolite>
Mime-Version: 1.0
Subject: Welcome to Evolution!
Sender: evolution@novell.com
Errors-To: evolution@novell.com
....
....

So, now you know where to hack. ;-). Just wrote a simple shell script (or an operating system driver ;-) ) that concatenates each file and delimits them with the line similar to From tycoon@someorganization.tld Tue Jul 31 12:40:33 2008. Most of the mail programs doesn’t consider this line to be meaningful (I think so) and consider it as a mail delimiter. So a fake line need resembling above needs to added before each mail entry. The from address and date are instead extracted from From: and Date: MIME headers. So basic pseudocode is

  1. Create a empty [mbox file]
  2. Initialize default delimiter [line]
  3. For each [file] in [list of files] do {
  4. Echo [line] to the [mbox file] in append mode1.
  5. Type [file] to the [mbox file] in append mode1.
  6. }

I’m not providing any shell script to do this job for you. Since one of the major pillars in GNU/Linux is Software Toolbox philosphy. And if you’re learning these utilities, this might be a good project for you. If you’re lucky enough somebody might have posted the script as comment in my blog. ;-)

1HINT: cat abcd.txt >>file_opened_in_append_mode.

20060311

an AWKward day

Filed under: Experiments — abbe @ 1754

A day towards learning AWK. Although I’ve not planned my day to learn AWK, but it happened accidentally (or by chance ;-)). Today, I was in my practical class, and there I saw an old machine is running Fedora Core 1. I thought what I can do with that system, since the system doesn’t has any development tools. It has tools without documentation. Then I thought AWK might be there so, why not learn AWK. Because, I’ve tried learning AWK previously too many times, but wasn’t successful (it was not tough, but because I don’t know what to do with that language). So today, I thought why not XMLify, the /etc/passwd (one of the primary target of awk tutorials) and /etc/group. And then, I opened its infopages by executing info awk. but oops info is displaying its manpages. Then I recalled that on GNU/Linux machines AWK comes GAWK, so I did info gawk. And started reading Getting started.

So, within half-an hour I’ve produced my AWK script to XMLify /etc/passwd and /etc/group. Here I’m giving my AWK script to /etc/passwd.

# passwd2xml.awk: An AWK script to transform /etc/passwd file into passwd.xml
BEGIN { 
 FS=":";
 print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<passwd>";
}
/:/  {
 printf "\t<user id=\"%s\" uid=\"%s\" gid=\"%s\" home=\"%s\" comment=\"%s\" password=\"%s\" shell=\"%s\"/>\n", $1, $3, $4, $6, $5, $2, $7;
}
END {
 print "</passwd>";
}

You can execute this script and then pipe that output to xmllint to check for well-formedness of the document as shown below:

[wahjava@pc awk]$ awk -f passwd2xml.awk /etc/passwd |xmllint -

GAWK also comes for Windows and available here.

BTW, this script is not the correct way to XMLify the /etc/passwd since XMLifying needs entitifying some characters e.g. <, > etc.

Older Posts »

Blog at WordPress.com.