首页
社区
课程
招聘
[原创]shoooo第一轮第一题答案
2007-8-23 14:25 19271

[原创]shoooo第一轮第一题答案

2007-8-23 14:25
19271
shoooo
838405472332423720261026354715956758738482324289317921799389786304955753823247004600360577050547786394427232991199118963196873841547633292371026202615473595575883845232728921793179738998639495675342328700360046055705254768630442423229118911996399689384054773324237


pediy
6050595875347004126102683845289996878633442991141792174775347062595054793371021460036531442997988687384028921219911844783371605159557537700312620266384728989688863944239113179317457536706159515476337402136004653944219797868838452898121891194476337360505956753470061261026738452890968786304429911717921746753470635950547733710216600365304429979986873846289212139118447733716052595575357003126402663846289896898639442091131796174575357061595254763372021360066539442097978689384528931218911


#include <windows.h>
#include <stdio.h>


BYTE status[] = {0, //第一个不用
                 0, 0, 1, 1, 0, 0, 0, 1, 1};

char name[] = "shoooo";
DWORD hash;

BYTE key[0x1000] = {0};
DWORD keyindex = 0;


void __declspec(naked) GetHash()
{
	__asm
	{
		pushad
		mov ebp, offset name
		mov ebx, 0x13572468
	start:
		movzx eax, byte ptr [ebp]
		test eax, eax
		je end
		inc ebp
		add eax,ebx
		imul eax,eax,0x3721273
		add eax,0x24681357
		mov esi,eax
		shl esi,0x19
		sar eax,7
		or esi,eax
		mov ebx,esi
		jmp start
	end:
		mov hash, ebx
		popad
		retn
	}
}

void SetStatus()
{
	DWORD	i;
	for (i=1; i<9; i++)
	{
		status[i] = (hash>>i) & 1;
	}
	status[9] = 1;
}

void turn(DWORD index)
{
	DWORD	i;
	if (index == 1)
	{
		status[1] ^= 1;
	}
	else if (index == 2)
	{
		if (status[1] == 0)
			turn(1);
		status[2] ^= 1;
	}
	else if (index>=3 && index <=9)
	{
		if (status[index-1] == 0)
			turn(index-1);
		for (i=index-2;i>=1;i--)
			if (status[i] == 1)
				turn(i);
		status[index] ^= 1;
	}
	key[keyindex++] = index;
}

void main()
{
	GetHash();
	SetStatus();

	DWORD i;
	for (i=9; i>=1; i--)
	{
		if (status[i] == 1)
			turn (i);
	}

	DWORD tmp;
	for (i=0; i<keyindex; i++)
	{
		tmp = hash;
		tmp = tmp>>(i%0x1F);
		tmp = tmp %10;

		if (key[i] < tmp)
			key[i] += 10;
		key[i] = key[i]-tmp+0x30;
	}
	printf("%s\n", key);
}

[CTF入门培训]顶尖高校博士及硕士团队亲授《30小时教你玩转CTF》,视频+靶场+题目!助力进入CTF世界

上传的附件:
收藏
点赞0
打赏
分享
最新回复 (6)
雪    币: 398
活跃值: (343)
能力值: (RANK:650 )
在线值:
发帖
回帖
粉丝
shoooo 16 2007-8-23 14:37
2
0
控制台的
如果有需要, 我整个gui的
雪    币: 398
活跃值: (343)
能力值: (RANK:650 )
在线值:
发帖
回帖
粉丝
shoooo 16 2007-8-23 14:43
3
0
有个笔误
movzx eax, byte ptr [ebp] -> movsx eax, byte ptr [ebp]
雪    币: 5141
活跃值: (363)
能力值: (RANK:170 )
在线值:
发帖
回帖
粉丝
zmworm 4 2007-8-23 14:51
4
0
要有输入的地方,而不是写死在代码中,要不让人家怎么输入?
看题目要求:“在注册机中任意输入用户名”

主流程差不多,不要在小问题上出差错,哈.
快改一改
雪    币: 398
活跃值: (343)
能力值: (RANK:650 )
在线值:
发帖
回帖
粉丝
shoooo 16 2007-8-23 14:53
5
0
那我个整个界面的
雪    币: 398
活跃值: (343)
能力值: (RANK:650 )
在线值:
发帖
回帖
粉丝
shoooo 16 2007-8-23 15:15
6
0
带输入输出的
上传的附件:
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
长风破浪 2007-10-13 16:43
7
0
好好学习一下.
游客
登录 | 注册 方可回帖
返回