A life inside a shell

bash$ tiagosh

Kopete and libmsn

kopete & libmsn

Last weeks I’ve been playing with kopete and libmsn.
I don’t know if it will become part of upstream kopete development,
but at least now I am able to send/receive files and offline messages.
Features up to this moment:

- send/receive regular messages
- send/receive offline messages
- file transfer.
- multi-chat (more than 2 people)
- display pictures transfer
- chat while in invisible mode
- “Listening to” and “Personal Messages” support
- Nudges

kopete TODO list:
- voice clip
- ink support
- improve address book management
- formatted messages (fonts and colors)
- winks (argh, I’m not sure about this one yet)
- custom emoticons (not sure about this one too =)

libmsn TODO list:
- webcam

February 24, 2008 Posted by tiagosh | kopete, libmsn | | 16 Comments

Hijacking kernel functions

When I was developing RNAT I needed to change one kernel function (ip_options_compile), but I didn’t want the users to recompile their kernels. So then I discovered here that it was possible to hijack a kernel function by using a kernel module, and it solved my problem for that moment.

To exemplify the hijacking process, the code below shows how to hijack sys_mkdir() system call, preventing any user from creating a directory.

Don’t forget to change the old_sys_mkdir pointer to your real sys_mkdir() function.

——————- newmkdir.c —————-

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>

MODULE_LICENSE(”GPL”);

static spinlock_t kern_lock = SPIN_LOCK_UNLOCKED;
unsigned long slock_flags;

#define LOCK_KERN spin_lock_irqsave(&kern_lock, slock_flags)
#define UNLOCK_KERN spin_unlock_irqrestore(&kern_lock, slock_flags)

static unsigned char pr_jump[7]=”\xbf\x00\x00\x00\x00″ /* mov $0,%edi */
“\xff\xe7″; /* jmp *%edi */
static unsigned char pr_save[7];

unsigned char * old_sys_mkdir = (unsigned char *) 0xc01c79d0; /* grep sys_mkdir$ /proc/kallsyms */

/* function prototype from /usr/include/linux/syscalls.h */
asmlinkage long new_sys_mkdir(const char __user *pathname, int mode)
{
printk(”Tried to create: %s, mode: %d\n”, pathname, mode);
/* return Access Denied */
return -EACCES;
}

static int __init new_sys_mkdir_init(void)
{
/* fill pr_jump zero’s with the pointer to our new_sys_mkdir() */
*(long *)&pr_jump[1] = (long)new_sys_mkdir;
LOCK_KERN;

/* replace the inital 7 bytes from the original sys_mkdir() with our jump to  new_sys_mkdir() */
memcpy(pr_save, old_sys_mkdir, 7);
memcpy(old_sys_mkdir, pr_jump, 7);

UNLOCK_KERN;
return 0;
}

static void __exit new_sys_mkdir_exit(void)
{
LOCK_KERN;
/* copy the old initial 7 bytes back */
memcpy(old_sys_mkdir, pr_save, 7);
UNLOCK_KERN;
}

module_init(new_sys_mkdir_init);
module_exit(new_sys_mkdir_exit);

——————– Makefile —————-

obj-m := newmkdir.o

KDIR := /lib/modules/`uname -r`/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

October 7, 2007 Posted by tiagosh | RNAT, general information, xnx | | 1 Comment

Annoying problems, fast workarounds

Last months I’ve been facing a weird Xorg problem: eventually the keyboard and mouse hangs.

The only thing I know is that a simple VT switch solves the problem. I was getting used to ssh my pc from another one and do a “chvt 1; chvt 7″, but yesterday Claudio suggested me to map one acpi event to do that, and it worked.

Now, when I lose the keyboard and mouse control, all I need to do is unplug the ac cable (it is a laptop) and plug it again.

September 27, 2007 Posted by tiagosh | general information, xnx | | No Comments

Rise RNAT, Rise!

RNAT logo

Good news!

RNAT was accepted on sulcomp. (Congresso Sul Catarinense de Computação)

So probably I’ll be there (Criciúma) trying to explain in 15 minutes the RNAT project. Wow!

:)

September 3, 2007 Posted by tiagosh | RNAT | | 2 Comments

unhidden

Hi,

Last months I’ve been working on porting libmsn to MSNP15. Yesterday I decided to talk with Mark Rowe about uploading the code to the mainstream development tree.

He agreed and added me as admin on libmsn project.

For those who want to test some of the library capabilities, there will be msntest command line program after the build.

I’ve been using msntest with my main msn passport (to receive oim’s and to talk when in invisible status) and everything is ok up to this moment. Anyway, more tests are needed.

My changes on libmsn are on sourceforge svn. There will be too much work until the first release, so, patches and discussion about the library layout are welcome.

Thank you all who have offered help on development and have commented on previous posts.

(svn co https://libmsn.svn.sourceforge.net/svnroot/libmsn libmsn)

September 3, 2007 Posted by tiagosh | libmsn | | 8 Comments

YAFBS2

Yet another foo bar song 2

http://www.youtube.com/watch?v=Pqd1rtxhbBc

August 22, 2007 Posted by tiagosh | guitar, music | | 1 Comment

YAFBS

Yet another foo bar song.

Sometimes I like to create my own songs.

August 17, 2007 Posted by tiagosh | music | | 4 Comments

libcurl2opensslsockets

First of all, the best cover ever: http://www.youtube.com/watch?v=FjeMDvCdrtc

No comments. It reminds me Anton Maiden. Don’t you know Anton Maiden? Shame on you.

If you are not a geek, you dont need to continue reading below :)

As in AC/DC song: It’s a long way if you wanna… do things in the right way.

libcurl is a great library which provides ways to open and manage sockets and http requests in a simple form. I was using it to help libmsn development, but as I intend to keep libmsn as independent as possible, I’ve decided to use openssl sockets instead of libcurl. The best part is now the code is prepared to handle non-block sockets, even when using ssl connections, which is, in my opinion, a big requirement to not block the whole library (as we can have many sockets alive at a time) when we are requesting something through SOAP, for example.

The code is broken and I’m working to fix it, but I must admit it is a very boring work.

July 28, 2007 Posted by tiagosh | libmsn | | 8 Comments

OIM? Yes!

Hi,

Sunny Sunday: a good day to develop OIM (Offline Instant Messages) to libmsn.

Yes, now libmsn has full OIM support (receiving, sending and deleting).

I could write here all my feelings about the protocol, SOAP and XML parsing, but I’m trying to avoid this kind of discussion because I can discover very soon that it was really needed to do something I don’t know yet (btw, xml text inside another xml text node?? I think there are too many ways to not need to do that. I hope I’m wrong, really!).

Next step is try to finish Address Book management (add groups, add user, move user to group..). All these operations are made now through SOAP requests (oh my..!!). Wish me luck.

see ya!

July 16, 2007 Posted by tiagosh | libmsn | | 10 Comments

She wolf

Hi

some people asked me about posts involving music, because computing is a very boring subject. I agree with them, music is much more interesting than computing, so there goes she wolf (by megadeth) video played by me. I know it’s not equal to the original version, but this is how I like to play it =)

The sound quality is horrible because I used a standard PC microphone. I intend to improve this recording process next time. Probably you don’t know this song yet, but I can ensure you it is very cool. Enjoy.

 

July 8, 2007 Posted by tiagosh | music | | 2 Comments