Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TIP] Sys/sID Email crypt [krymail]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
koma
Advocate
Advocate


Joined: 06 Jun 2003
Posts: 2702
Location: Italy

PostPosted: Sun Dec 05, 2004 1:01 pm    Post subject: [TIP] Sys/sID Email crypt [krymail] Reply with quote

Ciao!
Andando sul sito di _sys/sid http://gensid.altervista.org/ ho notato che la sua email era sostituita da un codice di C.
Incuriosito prima ho pensato fosse un errore del suo sito del php o in generale... ma ho notato che si trattava di una funzione con tanto di librerie in testa quindi non una porzione di programma ma un programma completo.
Creo quidi un user senza alcun provilegio se nn quello di usare gcc ed eliminare la sua home e lancio questo programmino... ci rimango malissimo quando leggo che è la sua email!
Mi sono innamorato così tanto di quella cosa che ho pregato sys di farmi un programma che emulasse quello che ha fatto (e l'ha fatto) ho deciso quindi di condividerlo con voi direi che è a dir poco perfetto sto codice :)
CODICE
Code:
/* [ krymail.c ]
 ************************************************
 * Compile With: gcc -Wall krymail.c -o krymail *
 ************************************************
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include <stdio.h>

int main(int argc, char **argv) {   
   unsigned char i;
   char *mmail;
   
   if (argc <= 1) {
      printf("Usage: \r\n");
      printf("  %s [ mail ]\r\n", argv[0]);
      return(1);
   }
   mmail = argv[1];
   
   printf("#include <stdio.h>\r\n\r\n");
   printf("int main() {\r\n");
   printf("   unsigned char i;\r\n");
   printf("   unsigned char mail[] = {");
   
   for (i=0; mmail[i] != '\0'; i++) {
      (mmail[i] > 100) ? (mmail[i] += 3) : (mmail[i] -= 7);
      if (!(i % 7)) {
         printf("%d, ", mmail[i]);
      } else if (!(i % 3)) {
         printf("0x%X, ", mmail[i]);
      } else if (!(i % 2)) {
         printf("0%o, ", mmail[i]);
      } else {
         if (mmail[i] == '\'' || mmail[i] == '\"') {
            printf("'\\%c', ", mmail[i]);
         } else {
            printf("'%c', ", mmail[i]);
         }
      }
      if (i%6 == 0) printf("\r\n            ");
   }
   printf("'\\0'};\r\n\r\n");
   printf("   for (i=0; mail[i] != '\\0'; i++) { \r\n");
   printf("      (mail[i] > 100) ? (mail[i] -= 3) : (mail[i] += 7);\r\n");
   printf("       printf(\"%%c\", mail[i]);\r\n");
   printf("   }\r\n");
   printf("   printf(\"\\r\\n\"); \r\n");
   printf("   return(0);\r\n");
   printf("}\r\n\r\n");
   return(0);
}


Come da commento compiliamolo con
Code:
gcc -Wall krymail.c -o krymail

e convertiamo la nostra email in codice C
Code:

$./krymail email@about.me >> miaemail.c

Dopodichè testiamo il risultato:
Code:
gcc miaemail.c -o miaemail

nessun errore chiaramente se usate i caratteri normali per le email ;)
Code:
$ ./miaemail
email@about.me

ed ecco il codice per questa email
Code:

#include <stdio.h>

int main() {
   unsigned char i;
   unsigned char mail[] = {104,
            'p', 0132, 0x6C, 0157, '9', 0x5A,
            91, 0162, 0x78, 0167, '\'', 0x70,
            'h', '\0'};

   for (i=0; mail[i] != '\0'; i++) {
      (mail[i] > 100) ? (mail[i] -= 3) : (mail[i] += 7);
       printf("%c", mail[i]);
   }
   printf("\r\n");
   return(0);
}

Spero vi piaccia!
Ciao da koma e grazie ancora sys/sid
_________________
http://www.youtube.com/watch?v=_yoJI-Tl94g GLORY GLORY HYPNOTOAD
Back to top
View user's profile Send private message
gaffiere
Guru
Guru


Joined: 13 Nov 2003
Posts: 406
Location: Provincia Milano

PostPosted: Sun Dec 05, 2004 1:20 pm    Post subject: Reply with quote

carina come cosa! :)
non ne vedo al momento nessuna utilità pratica, ma è cmq interessante.
anzi: suggerimenti per un eventuale utilizzo?

see ya
_________________
Thomaz "Gaffiere"
Middle-Earth XP2200+, 1Gb Ram, 80Gb + 160Gb Hd, SbLive!, Nvidia 6800GT AGP8x
Gentoo Gnu/Linux 2.6.12-gentoo-r10
Back to top
View user's profile Send private message
koma
Advocate
Advocate


Joined: 06 Jun 2003
Posts: 2702
Location: Italy

PostPosted: Sun Dec 05, 2004 1:23 pm    Post subject: Reply with quote

evitare lo spam readng cioè quello spam provocato dall'esplorazione dei siti da parte di bot che leggono le email. ormai non basta nemmeno + il formato email[at]dominio[.]qualcosa perchè lo capiscono ugualmente le soluzioni sono soltanto due le immagini o una scrittura ancora più complessa (e inutile secondo me dato che ormai qst bot sono molto ben autimatizzati)
_________________
http://www.youtube.com/watch?v=_yoJI-Tl94g GLORY GLORY HYPNOTOAD
Back to top
View user's profile Send private message
Dhaki
Guru
Guru


Joined: 16 Jun 2004
Posts: 325
Location: Ticino - CH

PostPosted: Sun Dec 05, 2004 1:45 pm    Post subject: Reply with quote

Ehehehe :lol:

Direi che come idea é originale, no? Adesso lo provo subito :P , anche solo per provarlo. Bravi Sys & Koma!
Back to top
View user's profile Send private message
oRDeX
Veteran
Veteran


Joined: 19 Oct 2003
Posts: 1325
Location: Italy

PostPosted: Sun Dec 05, 2004 1:59 pm    Post subject: Reply with quote

spaccaaaa
Back to top
View user's profile Send private message
koma
Advocate
Advocate


Joined: 06 Jun 2003
Posts: 2702
Location: Italy

PostPosted: Sun Dec 05, 2004 2:03 pm    Post subject: Reply with quote

comunque funziona anche per criptare un po' di messaggi del tipo
Code:
#include <stdio.h>

int main() {
   unsigned char i;
   unsigned char mail[] = {60,
            'l', 0132, 0x72, 031, 'u', 0x5A,
            106, 0132, 0x7D, 0175, 'l', 0x19,
            ']', 104, 0x6F, 031, 'i', 0x72,
            'u', 0170, 112, 031, ']', 0x6C,
            '', 0152, 0x68, 113, 'w', 0x72,
            'r', 031, 0x74, 0170, 104, 0x76,
            'w', 0162, 0x19, 0160, 'h', 118,
            'v', 0132, 0x6A, 0152, 'l', 0x72,
            25, 037777777741, 0x19, 0166, 'w', 0x5A,
            'w', 114, 0x19, 0134, 'u', 0x6C,
            's', 0167, 90, 0167, 'r', 0x19,
            '\', 0162, 0x71, 25, 'n', 0x75,
            '|', 0160, 0x5A, 0154, 111, 0x19,
            '3', 075, '\0'};

   for (i=0; mail[i] != '\0'; i++) {
      (mail[i] > 100) ? (mail[i] -= 3) : (mail[i] += 7);
       printf("%c", mail[i]);
   }
   printf("\r\n");
   return(0);
}

_________________
http://www.youtube.com/watch?v=_yoJI-Tl94g GLORY GLORY HYPNOTOAD
Back to top
View user's profile Send private message
oRDeX
Veteran
Veteran


Joined: 19 Oct 2003
Posts: 1325
Location: Italy

PostPosted: Sun Dec 05, 2004 2:08 pm    Post subject: Reply with quote

Effettivamente, visto che "l'algoritmo di criptazione è fisso":
Code:

for (i=0; mail[i] != '\0'; i++) {
      (mail[i] > 100) ? (mail[i] -= 3) : (mail[i] += 7);
       printf("%c", mail[i]);
   }
   printf("\r\n");

lo si può usare per passare messaggi segreti scambiandosi solo il vettore contenente i caratteri criptati:
Code:

mail[] = {60,
            'l', 0132, 0x72, 031, 'u', 0x5A,
            106, 0132, 0x7D, 0175, 'l', 0x19,
            ']', 104, 0x6F, 031, 'i', 0x72,
            'u', 0170, 112, 031, ']', 0x6C,
            '', 0152, 0x68, 113, 'w', 0x72,
            'r', 031, 0x74, 0170, 104, 0x76,
            'w', 0162, 0x19, 0160, 'h', 118,
            'v', 0132, 0x6A, 0152, 'l', 0x72,
            25, 037777777741, 0x19, 0166, 'w', 0x5A,
            'w', 114, 0x19, 0134, 'u', 0x6C,
            's', 0167, 90, 0167, 'r', 0x19,
            '\', 0162, 0x71, 25, 'n', 0x75,
            '|', 0160, 0x5A, 0154, 111, 0x19,
            '3', 075, '\0'};
Back to top
View user's profile Send private message
randomaze
Bodhisattva
Bodhisattva


Joined: 21 Oct 2003
Posts: 9985

PostPosted: Sun Dec 05, 2004 2:27 pm    Post subject: Reply with quote

Beh io avevo una cosa simile come signature per un tot. di tempo... e avevo fatto anche la guida su gentoo italia
_________________
Ciao da me!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum