• 11 odgovora
  • 6.431 pregleda
Šta ovo radi ? 07.05.2002. u 07:12 · pre 297 meseci #1
Evo jednog source koda za enkripciju fajla:
Ja bih točno trebao znati što on radi jer se baš ne poznajem s tim.
Svaki koment posamičnog reda bi dobro došao, a što me najbolje zanima je algoritam ove enkripcije.

Code:

/* my l33t 3ncrypt10n pr0gr4m - K4v1n.
*/
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <process.h>
#include <io.h>
#include <sysstat.h>

unsigned char buffer[1024],state[256],x,y;
int infile,
    outfile,
    len;
char *pwd;

void init_crypt(char *keydata)
{ unsigned int i,keylen;
  unsigned char index1,index2;
  char newpass[100];
  x=0;
  y=0;
  keylen=strlen(keydata);
  printf("Key:%s, Length:%d",keydata,strlen(keydata));
  strcpy(newpass,"H4ck3d4ndCr4ck3d");
  strcat(newpass,keydata);
  for(i=0;i<256;i++)
    state[ i ]=(unsigned char)(i*73);
  index1=0;
  index2=0;
  for(i=0;i<256;i++)
  { index2+=keydata[index1]+state[ i ];
    x=state[index2];
    state[index2]=state[ i ];
    state[ i ]=x;
    index1=(index1+1)%keylen;
  }
  x=0;
}

void process_string(unsigned char *inoutstring,unsigned int length)
{ unsigned char a,b;
  while(length--)
  { a=state[++x];
    y+=a;
    b=state[y];
    state[y]=a;
    a+=b;
    state[x]=b;
    (*inoutstring++)^=state[a];
  }
}

void main(int argc,char *argv[])
{ if(argc!=4)
  { printf("Usage : encrypt <infile> <outfile> <password>n");
    exit(1);
  }
  if ((infile=open(argv[1],O_BINARY))==-1)
  { printf("Can't Open : %sn",argv[1]);
    exit(1);
  }
  if((outfile=open(argv[2],O_WRONLY|O_CREAT|O_BINARY,S_IWRITE))==-1)
  { printf("Can't Open : %sn",argv[2]);
    exit(1);
  }
  pwd=argv[3];
  init_crypt(pwd);
  for(;;)
  { if((len=read(infile,buffer,1024))==0)break;
    process_string(buffer,len);
    write(outfile,buffer,len);
  }
  close(outfile);
  close(infile);
}



poz Boris
Potpis
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
Re: Šta ovo radi ? 08.05.2002. u 18:42 · pre 297 meseci #2
Poprilicno losa kriptografija koliko mogu da vidim na prvi pogled.
Potpis
Dejan Lekic
software engineer, MySQL/PgSQL DBA, sysadmin
Re: Šta ovo radi ? 09.05.2002. u 07:24 · pre 297 meseci #3
Da, ali je fora u tom, da treba riješiti ovaj primjer Da ovo.

Može malo detalnije o ovom programu ?
Potpis
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
Re: Šta ovo radi ? 19.02.2003. u 14:46 · pre 288 meseci #5
You must find what is in the pcx file.

You must let us know the answer it contains.

Unfortunately it came from the hard drive of Kevin, the hacker of Midas. Kevin is refusing to cooperate with us, but we don't believe that he is needed as we think we have everything necessary to solve this little annoyance.

We found the source code to Kevins encryption program, as well as the program itself. The only thing we don't know is the password.

Our analysts tell us that they suspect Kevin would use an easy to remember password but they suspect that he would use some kind of hacker speak alteration to make it difficult for us. We want you to investigate and solve the problem for us. Good luck.

Potpis
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
Re: Šta ovo radi ? 24.02.2003. u 10:49 · pre 288 meseci #6
"HACK AND CRACK"

4= "A"
3d = "space"

hah...


Re: Šta ovo radi ? 25.02.2003. u 07:29 · pre 288 meseci #8
Not valid pcx ?
Dali je to uopste graphic file ?

C:\1>encrypt pwd.pcx 1.pcx "HACK AND CRACK"
Key:HACK AND CRACK, Length:14
C:\1>

Dali treba još transformacija ("H4ck3d4ndCr4ck3d") to elleet ?

pa ni "Hack and crack " ne odgovara
C:\1>encrypt pwd.pcx 2.pcx "Hack and crack "
Key:Hack and crack , Length:15
C:\1>

Probat cu sa dictionary brute-force ellite i pregledom pcx headera.
Potpis
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
Re: Šta ovo radi ? 25.02.2003. u 10:09 · pre 288 meseci #9
probaj sa drugim delimiterima
3D u ASCII tabeli je "="
Re: Šta ovo radi ? 26.02.2003. u 07:49 · pre 288 meseci #10
Da mislim da je stvarno nesto oko elite abecede i onog startnog stringa, sada probavam sa brute forceom (elite dictionary).
4=A
7=T
3=E
...

No poslje treba deenkriptirati taj pcx i pregledati dali su headeri onog pcx-a stvarno pravilni headeri (dali je to graficka slika), kad upotrebljavam elite mislim da ce se headeri umalo poklopiti sa headerom kod pcx formata i izdati konacno rjesenje.
Potpis
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
Re: Šta ovo radi ? 27.02.2003. u 14:28 · pre 287 meseci #11
Ovde se najvrovatinije radi o nekoj vrsti "public key" enkripcije (RSA) pri cemu je javni deo kljuca string "H4ck3d4ndCr4ck3d" u kombinaciji sa password-om u komandnoj liniji. Za primarni broj se koristi niz od 256 elemenata u formi a=i*73
73 je ovde taj prost broj (mali u odnosu na RSA koji ima 129 cifara RSA129)
Dekripcija ovakvog koda bi se svela na odredjivanje celog kljuca i "brute force" napadom na string iz komandne linije. Ceo kljuc bi mogao se dobiti na po osnovu dekripcionog algoritma za RSA.

Ko je razumeo razumeo je..... ja nisam skroz:))) ali to je to...
Re: Šta ovo radi ? 23.09.2003. u 22:11 · pre 281 meseci #12
Evo, jedan mi je malo pomogao, no nece da da keyword ...

1.)dictionary attack
-Ddecodirao je sa pogođenim keywordom, pcx slika treba da bude prava pcx (bytes 80 to 127 = 0)

Help :
Prvo je probao sa svima slovima u dictionary-u, a poslje je zamenio slova sa brojevima (3=e, 4=a, 0=o), dokle nije dosao do rjesenja.

Ima tko dobar dictionary ?
... Josh mi nije uspjelo.
Potpis
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme