i春秋2020新春戰疫賽-re-奇怪的安裝包
新手一枚,如有錯誤(不足)請指正,謝謝!!
個人博客:點擊進入
題目下載:
鏈接: https://pan.baidu.com/s/1N9NFUPITE9xcFCg7tnOPWw 提取碼: 2020
壓縮包,想到NSIS製作壓縮包(其實沒想到
然後使用7-zip打開Install.exe文件,查看[NSIS].nsi文件
找到判斷的代碼
Dialogs::InputBox 1 請輸入key "Input your key" 確定 取消 4 6
; Call Initialize_____Plugins
; SetOverwrite off
; File $PLUGINSDIR\Dialogs.dll
; SetDetailsPrint lastused
; Push 6
; Push 4
; Push 取消
; Push 確定
; Push "Input your key"
; Push 請輸入key
; Push 1
; CallInstDLL $PLUGINSDIR\Dialogs.dll InputBox
DetailPrint "Checking...: $6"
IntCmp $4 1 0 label_415 label_415
StrCmp $6 NSIISSOEASY 0 label_415
MessageBox MB_OK key正確
Dialogs::InputBox 1 請輸入flag "Input your flag" 確定 取消 4 6
; Call Initialize_____Plugins
; AllowSkipFiles off
; File $PLUGINSDIR\Dialogs.dll
; SetDetailsPrint lastused
; Push 6
; Push 4
; Push 取消
; Push 確定
; Push "Input your flag"
; Push 請輸入flag
; Push 1
; CallInstDLL $PLUGINSDIR\Dialogs.dll InputBox
IntCmp $4 1 0 label_415 label_415
Push $6
Call func_429
Pop $6
StrCpy $3 gm`fzd787`7bb,g72d,592b,8`g1,cg96813e8d``|
StrCmp $3 $6 0 label_417
MessageBox MB_OK flag正確,可以愉快的玩遊戲了
Goto label_419
label_415:
MessageBox MB_OK 錯誤的key
MessageBox MB_OK 想辦法找到正確的key把
label_417:
MessageBox MB_OK flag錯誤
MessageBox MB_OK 想辦法找到正確的flag把
label_419:
SectionEnd
Section ; Section_1
WriteUninstaller $INSTDIR\uninst.exe ; $INSTDIR\$INSTDIR\uninst.exe ; !!! ERROR: SKIP possible BadCmd
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\VirtuaNES.exe" "" $INSTDIR\VirtuaNES.exe
WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\VirtuaNES DisplayName $(LSTR_2) ; "VirtuaNES 1.0"
WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\VirtuaNES UninstallString $INSTDIR\uninst.exe
WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\VirtuaNES DisplayIcon $INSTDIR\VirtuaNES.exe
WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\VirtuaNES DisplayVersion 1.0
WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\VirtuaNES URLInfoAbout http://www.baidu.com
WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\VirtuaNES Publisher Ginkgo.
SectionEnd
Function func_429 # 將字符串的每個字符與1異或並返回
Pop $9 # 輸入字符串出棧
StrCpy $3 "" # 給$3拷貝空字符串
StrCpy $0 $9 # 將輸入字符串給$0
StrCpy $1 0 # 將0賦值給$1
label_433:
StrCpy $2 $0 1 $1
StrCmp $2 "" label_443 # 如果取到空字符,就退出循環
Push $2
Call func_445 # 將取出的一個字符,丟入func_445 call進行處理
Pop $2
IntOp $2 $2 ^ 1 # 將字符與1異或後賦值給$2
IntFmt $2 %c $2 # 將$2解釋成字符賦值給$2
IntOp $1 $1 + 1 # $1自加1,遍歷下個字符,直到遍歷所有
StrCpy $3 $3$2 # 將$2拼接到$3後面
Goto label_433
label_443:
Push $3
FunctionEnd
Function func_445 # 返回與字符對應的ASCII碼
Exch $0 # 將傳入的字符給$0
Exch 交換兩個值,如果調用 Exch 沒有指定任何參數,將交換堆棧頂部的兩個數據。
如果指定了一個用戶變量作爲 Exch的參數,變量的值將和堆棧頂部的數據交換。
如果調用 Exch 並指定了一個棧的索引(從 0 開始,0 代表堆棧頂部的棧),將交換堆棧頂部和指定的棧的數據。
; Push $0
; Exch
; Pop $0
Push $1 # 保存$1的值
Push $2 # 保存$2的值
StrCpy $2 1 # 給$2賦值1 (進行計數器的初始化)
label_451:
IntFmt $1 %c $2 # 將$2解釋成字符給$1
StrCmpS $1 $0 0 label_455 # 比較$1和$0 如果相等則退出循環 不相等進行下一次循環
StrCpy $0 $2 # 將$2這個數值給$0
Goto label_458
label_455:
IntOp $2 $2 + 1 # $2自加1
StrCmp $2 255 0 label_451 # $2如果不等於255就返回label_451(循環255次 $2爲計數器)
StrCpy $0 0 # $0賦值0
label_458:
Pop $2 # 恢復$2的值
Pop $1 # 恢復$1的值
Exch $0 # $0的值爲字符對應的ASCII碼
; Push $0
; Exch
; Pop $0
FunctionEnd
大體流程是將輸入的字符串轉換爲ASCII碼然後與1異或,最後與
gm`fzd787`7bb,g72d,592b,8`g1,cg96813e8d``|
進行比較
所以只要我們將密文與1異或然後就是輸入的flag
寫腳本得到flag
flag = ""
strings = "gm`fzd787`7bb,g72d,592b,8`g1,cg96813e8d``|"
for i in strings:
flag += chr(ord(i)^1)
print(flag)
flag爲flag{e696a6cc-f63e-483c-9af0-bf87902d9eaa}