제목 : 두 번째 데이터 보안 경쟁 "중요한 컵"데이터 보안 경쟁 wp

1.pyc

PYC를 사용하여 온라인으로 디 컴파일하여 Python 소스 코드를 얻습니다.
#!/usr/bin/env python
자세한 내용은 https://tool.lu/pyc/를 방문하십시오
# 버전 : 파이썬 3.8
무작위로 가져옵니다
def encrypt_file (file_path) :
Random.seed (114514)
# 경고 : Decompyle은 불완전합니다
file_path='./flag'
Encrypt_file (file_path)
그런 다음 AI 분석을 사용하여 해당 암호 해독 스크립트를 얻으십시오.
무작위로 가져옵니다
OS 가져 오기
def decrypt_data (encrypted_data) :
Random.seed (114514)
decrypted_data=bytearray ()
암호화 _Data:의 바이트 용
key=random.randint (0, 128)
decrypted_data.append (byte ^ 키)
반환 decrypted_data를 반환합니다
def read_file (file_path, mode='rb') :
file:으로 Open (file_path, mode)
return file.read ()
def write_file (file_path, data, mode='wb') :
file:으로 Open (file_path, mode)
file.write (데이터)
def decrypt_file (encrypted_file_path, output_file_path) :
Encrypted_data=read_file (encrypted_file_path)
decrypted_data=decrypt_data (encrypted_data)
write_file (output_file_path, decrypted_data)
__name __=='__ main __': 인 경우
Encrypted_file_path='flag.enc'
output_file_path='flag_decrypted.txt'
decrypt_file (encrypted_file_path, output_file_path)
#flag {u_r_g00d_at_do1n_pyc}

2.MWatch

팁 : 데이터 보안 연구원이 스마트 장치에서 수집 한 데이터를 실시간으로 분석하면 장치 사용자의 가치가 높은 것을 감지합니다. 가장 높은 가치를 분석하는 데 도움이됩니다. flag {md5 (데이터 수집 장치 이름 데이터 수신 장치 이름 값)}
심박수는 여러 번 나타나며 질문에 대한 설명을 바탕으로이를 찾아야합니다. 관련된 심박수 만 확인하십시오
image-20240428205017240

image-20240428205017240

플래그 {MD5 (MI 스마트 밴드 5_REDMI K40_128)}
플래그 {453d8feda5adb6e7b4d54f71a9ce9e14}

3.BabyRSA

팁 : 특정 직원은 소수를 생성하는 초기 값을 가지고 있으며이 알고리즘을 오랫동안 실행했습니다. 이 프로그램은 실수로 터미널하고 실수로 초기 값을 삭제했습니다. 일반 텍스트를 복원 할 수 있습니까?
소스 코드 :
#task.py
#!/usr/bin/env python3
#-*-코딩 : UTF-8-*-
비밀 수입 플래그에서, 초기
crypto.util.number import *에서 *
Sage.all 가져 오기 *
GMPY2에서 IROOT 가져 오기
m=bytes_to_long (flag.encode ())
r=getprime (128)
p=init
# 범위 (R-1) :의 경우
# p +=next_prime (init)
# Iroot (p, 3) [1]==1을 주장하십시오
Q=GetPrime (12)
# n=p*q*r
n=r ** 4*q
e=getprime (17)
c=pow (m, e, n)
print (f'r={r} ')
print (f'e={e} ')
print (f'c={c} ')
# R=28704018843069778047400125757341514899
# e=96001
# c=738558028105627678149797853802027181009675544287719757504995951423791238909 67318475719302732081461863261245786821616331969575131936068848815308298035625
12 비트 소수를 날려 Q를 얻은 다음 해독합니다.
crypto.util.number import long_to_bytes, ververse
r=28704018843069778047400125757341514899
E=96001
c=738558028105627678149797853802027181009675544287719757504995951423791238909 67318475719302732081461863261245786821616331969575131936068848815308298035625
# 지수에 대한 계수가 실제로 r ** 4 여야한다고 가정합니다.
n=r ** 4
# e mod φ (n)의 모듈 식 역수를 계산합니다. 여기서 φ (n)은 (r-1)*(r ** 3)와 같은 r의 함수 일 수 있습니다.
# RSA 암호 해독 공식 M=C^D Mod N에 대해 φ (n)의 올바른 값이 필요합니다. 여기서 d=e^(-1) mod φ (n)
# 여기, φ (n)=r^4 -r^3을 단순화로 가정하면 실제 RSA 설정에 따라이를 조정해야 할 수도 있습니다.
phi_n=r ** 4 -r ** 3
D=역 (E, PHI_N)
# 메시지를 해독합니다
m=pow (c, d, n)
# 번호를 바이트로 변환합니다
메시지=long_to_bytes (m)
인쇄 (메시지)
#FLAG {3B0CE326141EA4F6B5BF2F37EFBD1B42}

4.Backpack

BKZ 알고리즘을 사용하여베이스 세트를 해결하는 배낭 암호화
#!/usr/bin/env python3
#-*-코딩 : UTF-8-*-
Sage.all 가져 오기 *
비밀 수입 플래그에서
crypto.util.number import *에서 *
수학 가져 오기 로그 2
클래스 Knapsack:
def __init __ (self, n, m) :
self.m=[]
self.n=n
self.m=self.pre (m)
self.a=0
self.b=0
def pre (self, m) :
tmp_m=bin (m) [2:]
t=[]
TMP_M:의 TMP 용
T.append (int (TMP))
반환 t
def get_m (self) :
seq=[randint (2 ** 34,2 ** 35) _ 범위 (self.n)]
self.m=seq
def calc_density (self) :
t=log2 (max (self.m))
d=self.n/t
인쇄 (d)
DEF ENC (SELF) :
self.get_m ()
self.calc_density ()
C=0
범위의 t (len (self.m)) :
c +=self.m [t] * self.m [t]
print (f'c={c} ')
print (f'm={self.m} ')
__name __=='__ main __': 인 경우
m=bytes_to_long (flag.encode ())
n=m.bit_length ()
k=Knapsack (n, m)
k.enc ()
# c=231282844744
# M=[27811518167, 19889199464, 19122558731, 19966624823, 25670001067, 30690729665, 23936341812, 31011714749, 30524482330, 2173737493, 19140841231, 33846825616, 17334386491, 28867755886, 29354544582, 21758322019, 27261411361, 31465376167, 26145493792, 27075555, 33514052206, 25397635665, 21970496142, 30801229475, 22405695620, 18486900933, 27071880304, 17919853256, 18072328152, 211080920]
Sagemath에서 실행 :
crypto.util.number import long_to_bytes
C=231282844744
M=[27811518167, 19889199464, 19122558731, 19966624823, 25670001067, 30690729665,
23936341812, 31011714749, 30524482330, 21737374993, 17530717152, 19140841231,
33846825616, 17334386491, 28867755886, 29354544582, 21758322019, 27261411361,
31465376167, 26145493792, 27075307455, 33514052206, 25397635665, 21970496142,
30801229475, 22405695620, 18486900933, 27071880304, 17919853256, 18072328152,
21108080920]
l=block_matrix ([[1, matrix (zz, m) .t], [0, c]]. lll ()
L:의 행
경우 [-1]==0 및 Len (set (행 [:-1])==1: 인 경우
# 마지막 요소를 제외하고 행의 모든 요소를 가정하면 동일합니다.
ANS=[ABS (I)는 연속 I의 경우 [:-1]]
ans=int ( ''. join (map (str, ans)), 2)
print (long_to_bytes (ans))

5.定向数据采集

OpenPyXl 가져 오기
가져 오기 요청
수입 시간
urllib.parse import urlencode에서
burp0_url='http://121.40.65.125:23328/제출'
def def ance_name_and_id (input_file, output_file) :
wb=OpenPyxl.load_workbook (input_file)
ws=wb.active
ws.iter_rows의 행 (min_row=1, max_col=1, max_row=ws.max_row, values_only=true) :
행 [0] : 인 경우
이름, id_number=row [0] .split ( '----') #추출 이름 및 Identity 카드
인쇄 (이름, id_number)
Age=2024-int (id_number [6336010])
if (int (id_number [10:12] 4) :
나이 -=1
sexx=u'male '
burp0_json={ 'jand '위치 ':'as ','sex': sexx}}
sexx2=u'female '
burp0_json1={ 'address':'asd ','age': str (Age), 'Eshnicity':'as ','Experience': '1', 'idcard': id_number,'name': 'a', 'phonenumber':'123123233 ', '위치 ':'as ','sex': sexx2}
try:
r0=requests.post (burp0_url, json=burp0_json)
r1=requests.post (burp0_url, json=burp0_json1)
print (r0.request.body)
print (r0.text, r1.text)
#time.sleep (0.5)
requests.exceptions:을 제외하고
print ( 'err')
#time.sleep (2)
#ws.Append ([name.strip (), id_number.strip ()]))
#wb.save (output_file)
wb.close ()
__name__=='__ 메인 __': 인 경우
input_file='data1.xlsx'
output_file='sequated_data.xlsx'#no 사용, 폐기됩니다
별도의

6.weather

검토 번들 .JS
image-20240428213212351

image-20240428213230335

액세스하려면 매개 변수를 사용하십시오
Image

7.mysql 清理​

팁 :
요구 사항에 따라 데이터베이스에서 일부 사용자 데이터를 완전히 삭제하려면 제공된 MySQL 컨테이너에 연결하고 모든 CTF 테이블을 삭제하십시오. 사용자 ID는 5142, 2123, 1169 및 8623입니다. 이러한 사용자를 철저히 정리해야하며 서버에서 잔여 데이터를 찾을 수 없으며 다른 사용자 데이터를 변경할 수 없습니다. 작업이 성공하면 시스템은 CTF.FLAG 테이블에 플래그 데이터를 입력합니다. (MySQL CTF 사용자 비밀번호 PSWD@123)
user_id in ( '5142', '2123', '1169', '8623').
user_id in ( '5142', '2123', '1169', '8623')에서 transactionhistory에서 삭제;
user_id in in userLog에서 삭제 ( '5142', '2123', '1169', '8623');
user_id ( '5142', '2123', '1169', '8623')가있는 지갑에서 삭제;
id in ( '5142', '2123', '1169', '8623'에서 id inder에서 삭제;
삭제 후 테이블을 재건하고 나머지 데이터를 지우십시오.
ALTER 테이블 사용자 엔진=InnoDB;
ALTER TABLE USERLOG ENGINE=InnoDB;
ALTER TABLE TRANSACTIONHISTORY ENGINE=InnoDB;
Alter Table ShoppingCart Engine=Innodb;
Alter Table Orders Engine=Innodb;
image-20240428213639377

8.幻方

3 단계 매직 스퀘어의 결과는 8 개뿐입니다. 몇 번 더 시도해보십시오.
hashlib을 가져옵니다
무작위로 가져옵니다
가져 오기 문자열
# 문자를 영숫자로 정의하십시오
charset=string.ascii_letters + string.digits
True:
# 숯에서 임의의 4 자 문자열을 생성합니다
rand_str=''.join (random.choice (charset) in range (4)) + 'cyhqp8lsgzyjtnud'
# 문자열의 SHA-256 해시를 계산합니다
hash_output=hashlib.sha256 (rand_str.encode ()). hexDigest ()
# 해시가 대상 해시와 일치하는지 확인하십시오
if hash_output=='11f8af166cc28e24b4646cc300436f4d4bf8e11b2327379331a3eca2d5fc7c0c':
print (rand_str [:4]) # 일치가 발견되면 처음 4 자 인쇄
부서지다
'' ''
[2, 7, 6, 6, 9, 5, 1, 4, 3, 8]
[2, 9, 4, 7, 5, 3, 6, 1, 8]
[4, 3, 8, 9, 5, 1, 2, 7, 6]
[4, 9, 2, 3, 5, 7, 8, 1, 6]
[6, 1, 8, 7, 5, 3, 2, 9, 4]
[6, 7, 2, 1, 5, 9, 8, 3, 4]
[8, 1, 6, 3, 5, 7, 4, 9, 2]
[8, 3, 4, 1, 5, 9, 6, 7, 2]
4 3 8
9 5 1
2 7 6
'' ''
image-20240428214506459
 
뒤로
상단