复制
收藏
提问
全网

from base64 import * from Crypto.Util.number import * from random import * def inv(bt): return bt[::-1] def flip(bt): res = b'' for i in bt: res += long_to_bytes(256-i) return res def R287(bt): offset = 287 % len(bt) return bt[-offset:] + bt[:-offset] def L37(bt): offset = 37 % len(bt) return bt[offset:] + bt[:offset] def ff(m, lf): for f in lf: m = f(m) return m if __name__ == '__main__': funcList = [b16encode, b32encode, b64encode, b85encode, inv, flip, R287, L37] flag = b'' for i in range(2): shuffle(funcList) flag = ff(flag, funcList) print(flag) # 4644464D5232584E5A4C475556544E4E4D5A474B51324747354E464B3342514D4E564443564B4C4A424E464F53334E4A593247493254494E4A4D57345354574A463545553553544C424957575432494E424647495233544F3551564B5552524B523456434C32574C425657595752524E4251574956534B4C464A47593442524B3557554B33325A4E5A4D53365532564C4A51574955334C504A51564B5552524D4A4B55533443544C424A484B554C5A495A435749565A56494E53554B3342514D4A4345453443534A424C454559544D4A5933474536544447354B464B3342514B464C544B5644464E55344755544C4E4846464749524B4F4A4646564B3342514B425744514C32524C424958435954324C4A585749554A3548553D3D3D3D3D3D4D5559464B3243534A424B5841594B595042584749565449495245564B5552524D56575555364B4F4E5A5458455332554A4658574933444D47424B54473444574C

5月前
全网
文档
学术
百科
知识库
时间不限
自动

理解问题from base64 import * from Crypto.Util.number import * from random import * def inv(bt): return bt[::-1] def flip(bt): res = b'' for i in bt: res += long_to_bytes(256-i) return res def R287(bt): offset = 287 % len(bt) return bt[-offset:] + bt[:-offset] def L37(bt): offset = 37 % len(bt) return bt[offset:] + bt[:offset] def ff(m, lf): for f in lf: m = f(m) return m if __name__ == '__main__': funcList = [b16encode, b32encode, b64encode, b85encode, inv, flip, R287, L37] flag = b'' for i in range(2): shuffle(funcList) flag = ff(flag, funcList) print(flag) # 4644464D5232584E5A4C475556544E4E4D5A474B51324747354E464B3342514D4E564443564B4C4A424E464F53334E4A593247493254494E4A4D57345354574A463545553553544C424957575432494E424647495233544F3551564B5552524B523456434C32574C425657595752524E4251574956534B4C464A47593442524B3557554B33325A4E5A4D53365532564C4A51574955334C504A51564B5552524D4A4B55533443544C424A484B554C5A495A435749565A56494E53554B3342514D4A4345453443534A424C454559544D4A5933474536544447354B464B3342514B464C544B5644464E55344755544C4E4846464749524B4F4A4646564B3342514B425744514C32524C424958435954324C4A585749554A3548553D3D3D3D3D3D4D5559464B3243534A424B5841594B595042584749565449495245564B5552524D56575555364B4F4E5A5458455332554A4658574933444D47424B54473444574C

已完成理解from base64 import * from Crypto.Util.number import * from random import * def inv(bt): return bt[::-1] def flip(bt): res = b'' for i in bt: res += long_to_bytes(256-i) return res def R287(bt): offset = 287 % len(bt) return bt[-offset:] + bt[:-offset] def L37(bt): offset = 37 % len(bt) return bt[offset:] + bt[:offset] def ff(m, lf): for f in lf: m = f(m) return m if __name__ == '__main__': funcList = [b16encode, b32encode, b64encode, b85encode, inv, flip, R287, L37] flag = b'' for i in range(2): shuffle(funcList) flag = ff(flag, funcList) print(flag) # 4644464D5232584E5A4C475556544E4E4D5A474B51324747354E464B3342514D4E564443564B4C4A424E464F53334E4A593247493254494E4A4D57345354574A463545553553544C424957575432494E424647495233544F3551564B5552524B523456434C32574C425657595752524E4251574956534B4C464A47593442524B3557554B33325A4E5A4D53365532564C4A51574955334C504A51564B5552524D4A4B55533443544C424A484B554C5A495A435749565A56494E53554B3342514D4A4345453443534A424C454559544D4A5933474536544447354B464B3342514B464C544B5644464E55344755544C4E4846464749524B4F4A4646564B3342514B425744514C32524C424958435954324C4A585749554A3548553D3D3D3D3D3D4D5559464B3243534A424B5841594B595042584749565449495245564B5552524D56575555364B4F4E5A5458455332554A4658574933444D47424B54473444574C

展开阅读网页

这段代码是一个Python脚本,它定义了几个函数来操作字节字符串,并在脚本的主体部分使用这些函数来生成一个加密的“flag”。下面是对代码的详细解释:

  1. inv(bt): 这个函数接受一个字节字符串bt作为参数,并返回它的逆序字符串bt[::-1]1
  2. flip(bt): 这个函数遍历输入的字节字符串bt,对于每个字节i,它将i转换为对应的整数值,然后计算256-i,最后将结果转换回字节并拼接起来形成新的字符串res2
  3. R287(bt): 这个函数接受一个字节字符串bt,计算偏移量287 % len(bt),然后将bt的最后offset个字节移动到字符串的开头,形成新的字符串。3
  4. L37(bt): 类似于R287,这个函数计算偏移量37 % len(bt),然后将bt的前offset个字节移动到字符串的末尾。4
  5. ff(m, lf): 这个函数接受一个初始值m和一个函数列表lf。它将m作为参数,依次应用列表中的每个函数,最后返回变换后的结果。5
  6. __main__部分,首先定义了一个函数列表funcList,包含了上述定义的函数以及一些用于编码的函数(如b16encodeb32encodeb64encodeb85encode)。然后初始化一个空的字节字符串flag
  7. 接下来,脚本进入一个循环,循环两次。在每次循环中,它随机打乱funcList的顺序,然后使用ff函数对flag应用这些函数。
  8. 最后,脚本打印出经过两次变换后的flag值。

脚本的最后部分是一个长字符串,看起来像是一个经过编码的flag。这个字符串可能是脚本执行后输出的结果,或者是需要解码的目标字符串。678910

更专业一些
转笔记
专业
from base64 import * from Crypto.Util.number import * from random import * def inv(bt): return bt[::-1] def flip(bt): res = b'' for i in bt: res += long_to_bytes(256-i) return res def R287(bt): offset = 287 % len(bt) return bt[-offset:] + bt[:-offset] def L37(bt): offset = 37 % len(bt) return bt[offset:] + bt[:offset] def ff(m, lf): for f in lf: m = f(m) return m if __name__ == '__main__': funcList = [b16encode, b32encode, b64encode, b85encode, inv, flip, R287, L37] flag = b'' for i in range(2): shuffle(funcList) flag = ff(flag, funcList) print(flag) # 4644464D5232584E5A4C475556544E4E4D5A474B51324747354E464B3342514D4E564443564B4C4A424E464F53334E4A593247493254494E4A4D57345354574A463545553553544C424957575432494E424647495233544F3551564B5552524B523456434C32574C425657595752524E4251574956534B4C464A47593442524B3557554B33325A4E5A4D53365532564C4A51574955334C504A51564B5552524D4A4B55533443544C424A484B554C5A495A435749565A56494E53554B3342514D4A4345453443534A424C454559544D4A5933474536544447354B464B3342514B464C544B5644464E55344755544C4E4846464749524B4F4A4646564B3342514B425744514C32524C424958435954324C4A585749554A3548553D3D3D3D3D3D4D5559464B3243534A424B5841594B595042584749565449495245564B5552524D56575555364B4F4E5A5458455332554A4658574933444D47424B54473444574C
不在提醒

更专业内容正在努力生成中
知识树
from base64 import * from Crypto.Util.number import * from random import * def inv(bt): return bt[::-1] def flip(bt): res = b'' for i in bt: res += long_to_bytes(256-i) return res def R287(bt): offset = 287 % len(bt) return bt[-offset:] + bt[:-offset] def L37(bt): offset = 37 % len(bt) return bt[offset:] + bt[:offset] def ff(m, lf): for f in lf: m = f(m) return m if __name__ == '__main__': funcList = [b16encode, b32encode, b64encode, b85encode, inv, flip, R287, L37] flag = b'' for i in range(2): shuffle(funcList) flag = ff(flag, funcList) print(flag) # 4644464D5232584E5A4C475556544E4E4D5A474B51324747354E464B3342514D4E564443564B4C4A424E464F53334E4A593247493254494E4A4D57345354574A463545553553544C424957575432494E424647495233544F3551564B5552524B523456434C32574C425657595752524E4251574956534B4C464A47593442524B3557554B33325A4E5A4D53365532564C4A51574955334C504A51564B5552524D4A4B55533443544C424A484B554C5A495A435749565A56494E53554B3342514D4A4345453443534A424C454559544D4A5933474536544447354B464B3342514B464C544B5644464E55344755544C4E4846464749524B4F4A4646564B3342514B425744514C32524C424958435954324C4A585749554A3548553D3D3D3D3D3D4D5559464B3243534A424B5841594B595042584749565449495245564B5552524D56575555364B4F4E5A5458455332554A4658574933444D47424B54473444574C
如何使用Python进行base64编码?
Python中Crypto.Util.number模块的用途
Python中如何实现字节翻转?
在线客服