HNCTF_RE复现(一)

news2025/1/19 14:10:05

baby_python 

hnctf.yuanshen.life:33276

网页打不开,只能 nc 连接远程服务器。

运行没有回显

利用pickletools库进行反编译为字节码(不知道为什么)
# Python 3.10.12
from pickle import loads
import pickletools
main = b"\x80\x04ctypes\nFunctionType\n(ctypes\nCodeType\n(I1\nI0\nI0\nI4\nI8\nI67\nCbt\x00\xa0\x01|\x00d\x01\xa1\x02}\x01t\x02|\x01\x83\x01d\x00d\x00d\x02\x85\x03\x19\x00d\x00d\x03\x85\x02\x19\x00}\x00d\x04}\x02t\x03d\x05t\x04|\x00\x83\x01d\x06\x83\x03D\x00]\x11}\x03|\x02t\x05t\x00|\x00|\x03|\x03d\x06\x17\x00\x85\x02\x19\x00d\x07\x83\x02\x83\x017\x00}\x02q\x1d|\x02S\x00(NVbig\nI-1\nI-3\nV\nI0\nI8\nI2\nt(Vint\nVfrom_bytes\nVbin\nVrange\nVlen\nVchr\nt(\x8c\x04\xf0\x9f\x94\xa5\x8c\x04\xf0\x9f\xa4\xab\x8c\x04\xf0\x9f\xa7\x8f\x8c\x04\xf0\x9f\x8e\xb5tVH&NCTF\n\x8c\x04\xf0\x9f\x93\xaeI0\nC\x0c\x00\x01\x0c\x01\x1a\x01\x04\x01\x14\x01 \x01))t\x81cbuiltins\nglobals\n)R\x8c\x04\xf0\x9f\x93\xaet\x81\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0b\x01\xa6&\xf6\xc6v\xa6tN.\xce\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x06\x01.v\x96N\x0e\x85R\x93VDo you know what's the flag??? \n\x85R0g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x06\x01.\xae\x0ev\x96\x85R\x93V> \n\x85R\x85R\x85R\x940g0\nC\x07\x01\xb6\xf6&v\x86N\x85Rg0\nC\x05\x01&\xa6\xa6\xce\x85R\x93Vwelcome to H&NCTF\n\x85R0g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0b\x01\xa6&\xf6\xc6v\xa6tN.\xce\x85R\x93VH&NCTF\n\x85R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x0e\x86\xb6\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0c\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96\x85R\x93g0\nC\n\x01\xce6\xf6\xf6.N\xa6.\x96\x85Rg0\nC\x06\x01\xa66\xc6\x9e\xc6\x85R\x93g2\n\x85Rg1\n\x87R\x85R\x940]\x94I2024\nag0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x0e\x86\xb6\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0c\x01\xfa\xfa&&\x86\xfa\xfat.v\x96\x85R\x93g0\nC\n\x01\xce6\xf6\xf6.N\xa6.\x96\x85Rg0\nC\x06\x01\xa66\xc6\x9e\xc6\x85R\x93g4\n\x85Rg3\n\x87R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x9ev\x86\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x0e\x86\xb6\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0c\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96\x85R\x93(I2024\nI2024\nI2024\nI2024\nI2024\nI2024\nI2075\nI2099\nI2071\nI2082\nI2078\nI2059\nI2047\nI2119\nI2057\nI2078\nI2035\nI2064\nI2069\nI2091\nI2066\nI2052\nI2077\nI2049\nI2067\nI2098\nI2057\nI2072\nI2073\nI2076\nI2047\nI2091\nI2078\nI2058\nI2081\nI2071\nI2062\nI2095\nI2082\nI2066\nI2083\nI2064\nI2077\nlg5\n\x87R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0b\x01\xfa\xfaN\xf6\xfa\xfat.v\x96\x85R\x93g6\ng0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0b\x01\xfa\xfa\xa6\xe6\xfa\xfat.v\x96\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01v\xa66\x85R\x93g5\n\x85RI50\n\x86R\x86R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x11\x01\xfa\xfa\xb6\xa6.\x96.\xa6\xe6\xfa\xfat.\xce\x966\x85R\x93(VOkay,maybe you need a closer examination!\nV \nlg7\n\x86R.g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\x07\x01\xb6\xf6&v\x86N\x85Rg0\nC\n\x01\xce\xa6.\x9eF&v\x86N\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01v\xa66\x85R\x93g1\n\x85R\x85R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\x07\x01\xb6\xf6&v\x86N\x85Rg0\nC\n\x01\xce\xa6.\x9eF&v\x86N\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01v\xa66\x85R\x93g2\n\x85R\x85R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x0e\x86\xb6\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0c\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96\x85R\x93g0\nC\n\x01\xce6\xf6\xf6.N\xa6.\x96\x85Rg0\nC\x06\x01\xa66\xc6\x9e\xc6\x85R\x93g9\n\x85Rg1\n\x87R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x0e\x86\xb6\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0c\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96\x85R\x93g0\nC\n\x01\xce6\xf6\xf6.N\xa6.\x96\x85Rg0\nC\x06\x01\xa66\xc6\x9e\xc6\x85R\x93g2\n\x85Rg8\n\x87R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x05\x01.\xce\x966\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x0e\x86\xb6\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0c\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96\x85R\x93g10\ng11\n\x87R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x9ev\x86\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01\x0e\x86\xb6\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0c\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96\x85R\x93(I72\nI24\nI7\nI107\nI142\nI150\nI112\nI158\nI174\nI172\nI155\nI126\nI69\nI235\nI64\nI229\nI102\nI158\nI118\nI61\nI36\nI12\nI234\nI194\nI71\nI51\nI47\nI82\nI41\nI122\nI121\nI221\nI7\nI119\nI96\nI104\nI246\nI3\nI103\nI153\nI232\nI210\nI7\nI188\nlg12\n\x87R\x85R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0c\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96\x85R\x93g13\ng0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x0b\x01\xfa\xfa\xa6\xe6\xfa\xfat.v\x96\x85R\x93g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x04\x01v\xa66\x85R\x93g12\n\x85RI50\n\x86R\x86R\x940g0\nC\t\x01\xcev\x96.6\x96\xaeF\x85Rg0\nC\x11\x01\xfa\xfa\xb6\xa6.\x96.\xa6\xe6\xfa\xfat.\xce\x966\x85R\x93(VOkay,you get the flag!\nVOh no,maybe you should try again~\nlg14\n\x86R."
# print(loads(main))
print(pickletools.dis(main))
    0: \x80 PROTO      4
    2: c    GLOBAL     'types FunctionType'
   22: (    MARK
   23: c        GLOBAL     'types CodeType'
   39: (        MARK
   40: I            INT        1
   43: I            INT        0
   46: I            INT        0
   49: I            INT        4
   52: I            INT        8
   55: I            INT        67
   59: C            SHORT_BINBYTES b't\x00\xa0\x01|\x00d\x01\xa1\x02}\x01t\x02|\x01\x83\x01d\x00d\x00d\x02\x85\x03\x19\x00d\x00d\x03\x85\x02\x19\x00}\x00d\x04}\x02t\x03d\x05t\x04|\x00\x83\x01d\x06\x83\x03D\x00]\x11}\x03|\x02t\x05t\x00|\x00|\x03|\x03d\x06\x17\x00\x85\x02\x19\x00d\x07\x83\x02\x83\x017\x00}\x02q\x1d|\x02S\x00'
  159: (            MARK
  160: N                NONE
  161: V                UNICODE    'big'
  166: I                INT        -1
  170: I                INT        -3
  174: V                UNICODE    ''
  176: I                INT        0
  179: I                INT        8
  182: I                INT        2
  185: t                TUPLE      (MARK at 159)
  186: (            MARK
  187: V                UNICODE    'int'
  192: V                UNICODE    'from_bytes'
  204: V                UNICODE    'bin'
  209: V                UNICODE    'range'
  216: V                UNICODE    'len'
  221: V                UNICODE    'chr'
  226: t                TUPLE      (MARK at 186)
  227: (            MARK
  228: \x8c             SHORT_BINUNICODE '🔥'
  234: \x8c             SHORT_BINUNICODE '🤫'
  240: \x8c             SHORT_BINUNICODE '🧏'
  246: \x8c             SHORT_BINUNICODE '🎵'
  252: t                TUPLE      (MARK at 227)
  253: V            UNICODE    'H&NCTF'
  261: \x8c         SHORT_BINUNICODE '📮'
  267: I            INT        0
  270: C            SHORT_BINBYTES b'\x00\x01\x0c\x01\x1a\x01\x04\x01\x14\x01 \x01'
  284: )            EMPTY_TUPLE
  285: )            EMPTY_TUPLE
  286: t            TUPLE      (MARK at 39)
  287: \x81     NEWOBJ
  288: c        GLOBAL     'builtins globals'
  306: )        EMPTY_TUPLE
  307: R        REDUCE
  308: \x8c     SHORT_BINUNICODE '📮'
  314: t        TUPLE      (MARK at 22)
  315: \x81 NEWOBJ
  316: \x94 MEMOIZE    (as 0)
  317: 0    POP
  318: g    GET        0
  321: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  332: \x85 TUPLE1
  333: R    REDUCE
  334: g    GET        0
  337: C    SHORT_BINBYTES b'\x01.\xce\x966'
  344: \x85 TUPLE1
  345: R    REDUCE
  346: \x93 STACK_GLOBAL
  347: g    GET        0
  350: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  361: \x85 TUPLE1
  362: R    REDUCE
  363: g    GET        0
  366: C    SHORT_BINBYTES b'\x01\xa6&\xf6\xc6v\xa6tN.\xce'
  379: \x85 TUPLE1
  380: R    REDUCE
  381: \x93 STACK_GLOBAL
  382: g    GET        0
  385: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  396: \x85 TUPLE1
  397: R    REDUCE
  398: g    GET        0
  401: C    SHORT_BINBYTES b'\x01.v\x96N\x0e'
  409: \x85 TUPLE1
  410: R    REDUCE
  411: \x93 STACK_GLOBAL
  412: V    UNICODE    "Do you know what's the flag??? "
  445: \x85 TUPLE1
  446: R    REDUCE
  447: 0    POP
  448: g    GET        0
  451: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  462: \x85 TUPLE1
  463: R    REDUCE
  464: g    GET        0
  467: C    SHORT_BINBYTES b'\x01.\xae\x0ev\x96'
  475: \x85 TUPLE1
  476: R    REDUCE
  477: \x93 STACK_GLOBAL
  478: V    UNICODE    '> '
  482: \x85 TUPLE1
  483: R    REDUCE
  484: \x85 TUPLE1
  485: R    REDUCE
  486: \x85 TUPLE1
  487: R    REDUCE
  488: \x94 MEMOIZE    (as 1)
  489: 0    POP
  490: g    GET        0
  493: C    SHORT_BINBYTES b'\x01\xb6\xf6&v\x86N'
  502: \x85 TUPLE1
  503: R    REDUCE
  504: g    GET        0
  507: C    SHORT_BINBYTES b'\x01&\xa6\xa6\xce'
  514: \x85 TUPLE1
  515: R    REDUCE
  516: \x93 STACK_GLOBAL
  517: V    UNICODE    'welcome to H&NCTF'
  536: \x85 TUPLE1
  537: R    REDUCE
  538: 0    POP
  539: g    GET        0
  542: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  553: \x85 TUPLE1
  554: R    REDUCE
  555: g    GET        0
  558: C    SHORT_BINBYTES b'\x01.\xce\x966'
  565: \x85 TUPLE1
  566: R    REDUCE
  567: \x93 STACK_GLOBAL
  568: g    GET        0
  571: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  582: \x85 TUPLE1
  583: R    REDUCE
  584: g    GET        0
  587: C    SHORT_BINBYTES b'\x01\xa6&\xf6\xc6v\xa6tN.\xce'
  600: \x85 TUPLE1
  601: R    REDUCE
  602: \x93 STACK_GLOBAL
  603: V    UNICODE    'H&NCTF'
  611: \x85 TUPLE1
  612: R    REDUCE
  613: \x85 TUPLE1
  614: R    REDUCE
  615: \x94 MEMOIZE    (as 2)
  616: 0    POP
  617: g    GET        0
  620: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  631: \x85 TUPLE1
  632: R    REDUCE
  633: g    GET        0
  636: C    SHORT_BINBYTES b'\x01.\xce\x966'
  643: \x85 TUPLE1
  644: R    REDUCE
  645: \x93 STACK_GLOBAL
  646: g    GET        0
  649: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  660: \x85 TUPLE1
  661: R    REDUCE
  662: g    GET        0
  665: C    SHORT_BINBYTES b'\x01\x0e\x86\xb6'
  671: \x85 TUPLE1
  672: R    REDUCE
  673: \x93 STACK_GLOBAL
  674: g    GET        0
  677: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  688: \x85 TUPLE1
  689: R    REDUCE
  690: g    GET        0
  693: C    SHORT_BINBYTES b'\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96'
  707: \x85 TUPLE1
  708: R    REDUCE
  709: \x93 STACK_GLOBAL
  710: g    GET        0
  713: C    SHORT_BINBYTES b'\x01\xce6\xf6\xf6.N\xa6.\x96'
  725: \x85 TUPLE1
  726: R    REDUCE
  727: g    GET        0
  730: C    SHORT_BINBYTES b'\x01\xa66\xc6\x9e\xc6'
  738: \x85 TUPLE1
  739: R    REDUCE
  740: \x93 STACK_GLOBAL
  741: g    GET        2
  744: \x85 TUPLE1
  745: R    REDUCE
  746: g    GET        1
  749: \x87 TUPLE3
  750: R    REDUCE
  751: \x85 TUPLE1
  752: R    REDUCE
  753: \x94 MEMOIZE    (as 3)
  754: 0    POP
  755: ]    EMPTY_LIST
  756: \x94 MEMOIZE    (as 4)
  757: I    INT        2024
  763: a    APPEND
  764: g    GET        0
  767: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  778: \x85 TUPLE1
  779: R    REDUCE
  780: g    GET        0
  783: C    SHORT_BINBYTES b'\x01.\xce\x966'
  790: \x85 TUPLE1
  791: R    REDUCE
  792: \x93 STACK_GLOBAL
  793: g    GET        0
  796: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  807: \x85 TUPLE1
  808: R    REDUCE
  809: g    GET        0
  812: C    SHORT_BINBYTES b'\x01\x0e\x86\xb6'
  818: \x85 TUPLE1
  819: R    REDUCE
  820: \x93 STACK_GLOBAL
  821: g    GET        0
  824: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  835: \x85 TUPLE1
  836: R    REDUCE
  837: g    GET        0
  840: C    SHORT_BINBYTES b'\x01\xfa\xfa&&\x86\xfa\xfat.v\x96'
  854: \x85 TUPLE1
  855: R    REDUCE
  856: \x93 STACK_GLOBAL
  857: g    GET        0
  860: C    SHORT_BINBYTES b'\x01\xce6\xf6\xf6.N\xa6.\x96'
  872: \x85 TUPLE1
  873: R    REDUCE
  874: g    GET        0
  877: C    SHORT_BINBYTES b'\x01\xa66\xc6\x9e\xc6'
  885: \x85 TUPLE1
  886: R    REDUCE
  887: \x93 STACK_GLOBAL
  888: g    GET        4
  891: \x85 TUPLE1
  892: R    REDUCE
  893: g    GET        3
  896: \x87 TUPLE3
  897: R    REDUCE
  898: \x85 TUPLE1
  899: R    REDUCE
  900: \x94 MEMOIZE    (as 5)
  901: 0    POP
  902: g    GET        0
  905: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  916: \x85 TUPLE1
  917: R    REDUCE
  918: g    GET        0
  921: C    SHORT_BINBYTES b'\x01\x9ev\x86'
  927: \x85 TUPLE1
  928: R    REDUCE
  929: \x93 STACK_GLOBAL
  930: g    GET        0
  933: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  944: \x85 TUPLE1
  945: R    REDUCE
  946: g    GET        0
  949: C    SHORT_BINBYTES b'\x01\x0e\x86\xb6'
  955: \x85 TUPLE1
  956: R    REDUCE
  957: \x93 STACK_GLOBAL
  958: g    GET        0
  961: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
  972: \x85 TUPLE1
  973: R    REDUCE
  974: g    GET        0
  977: C    SHORT_BINBYTES b'\x01\xfa\xfaN\xf6\x1e\xfa\xfat.v\x96'
  991: \x85 TUPLE1
  992: R    REDUCE
  993: \x93 STACK_GLOBAL
  994: (    MARK
  995: I        INT        2024
 1001: I        INT        2024
 1007: I        INT        2024
 1013: I        INT        2024
 1019: I        INT        2024
 1025: I        INT        2024
 1031: I        INT        2075
 1037: I        INT        2099
 1043: I        INT        2071
 1049: I        INT        2082
 1055: I        INT        2078
 1061: I        INT        2059
 1067: I        INT        2047
 1073: I        INT        2119
 1079: I        INT        2057
 1085: I        INT        2078
 1091: I        INT        2035
 1097: I        INT        2064
 1103: I        INT        2069
 1109: I        INT        2091
 1115: I        INT        2066
 1121: I        INT        2052
 1127: I        INT        2077
 1133: I        INT        2049
 1139: I        INT        2067
 1145: I        INT        2098
 1151: I        INT        2057
 1157: I        INT        2072
 1163: I        INT        2073
 1169: I        INT        2076
 1175: I        INT        2047
 1181: I        INT        2091
 1187: I        INT        2078
 1193: I        INT        2058
 1199: I        INT        2081
 1205: I        INT        2071
 1211: I        INT        2062
 1217: I        INT        2095
 1223: I        INT        2082
 1229: I        INT        2066
 1235: I        INT        2083
 1241: I        INT        2064
 1247: I        INT        2077
 1253: l        LIST       (MARK at 994)
 1254: g    GET        5
 1257: \x87 TUPLE3
 1258: R    REDUCE
 1259: \x85 TUPLE1
 1260: R    REDUCE
 1261: \x94 MEMOIZE    (as 6)
 1262: 0    POP
 1263: g    GET        0
 1266: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
 1277: \x85 TUPLE1
 1278: R    REDUCE
 1279: g    GET        0
 1282: C    SHORT_BINBYTES b'\x01\xfa\xfaN\xf6\xfa\xfat.v\x96'
 1295: \x85 TUPLE1
 1296: R    REDUCE
 1297: \x93 STACK_GLOBAL
 1298: g    GET        6
 1301: g    GET        0
 1304: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
 1315: \x85 TUPLE1
 1316: R    REDUCE
 1317: g    GET        0
 1320: C    SHORT_BINBYTES b'\x01\xfa\xfa\xa6\xe6\xfa\xfat.v\x96'
 1333: \x85 TUPLE1
 1334: R    REDUCE
 1335: \x93 STACK_GLOBAL
 1336: g    GET        0
 1339: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
 1350: \x85 TUPLE1
 1351: R    REDUCE
 1352: g    GET        0
 1355: C    SHORT_BINBYTES b'\x01v\xa66'
 1361: \x85 TUPLE1
 1362: R    REDUCE
 1363: \x93 STACK_GLOBAL
 1364: g    GET        5
 1367: \x85 TUPLE1
 1368: R    REDUCE
 1369: I    INT        50
 1373: \x86 TUPLE2
 1374: R    REDUCE
 1375: \x86 TUPLE2
 1376: R    REDUCE
 1377: \x94 MEMOIZE    (as 7)
 1378: 0    POP
 1379: g    GET        0
 1382: C    SHORT_BINBYTES b'\x01\xcev\x96.6\x96\xaeF'
 1393: \x85 TUPLE1
 1394: R    REDUCE
 1395: g    GET        0
 1398: C    SHORT_BINBYTES b'\x01\xfa\xfa\xb6\xa6.\x96.\xa6\xe6\xfa\xfat.\xce\x966'
 1417: \x85 TUPLE1
 1418: R    REDUCE
 1419: \x93 STACK_GLOBAL
 1420: (    MARK
 1421: V        UNICODE    'Okay,maybe you need a closer examination!'
 1464: V        UNICODE    ' '
 1467: l        LIST       (MARK at 1420)
 1468: g    GET        7
 1471: \x86 TUPLE2
 1472: R    REDUCE
 1473: .    STOP
highest protocol among opcodes = 4

没有技巧,全靠手撕,对着opcode文档直接开撕

整理一下就可以得到

之前NSS上也是有一道给python字节码的题目,只能手撕了。

[原创]死磕python字节码-手工还原python源码-软件逆向-看雪-安全社区|安全招聘|kanxue.com

Python的pyc字节码反编译反汇编相关知识_pycdc-CSDN博客

官方文档:

dis --- Python 字节码反汇编器 — Python 3.12.3 文档

是个大工程,先贴一下别人的复原

import random

random.seed('welcome to H&NCTF')

print("Do you know what's the flag???")
flag = input('> ')
flag = list(flag.encode())
print(flag)

a = [] #加密字符
b = [2024, 2024, 2024, 2024, 2024, 2024, 2075, 2099, 2071, 
    2082, 2078, 2059, 2047, 2119, 2057, 2078, 2035, 2064, 
    2069, 2091, 2066, 2052, 2077, 2049, 2067, 2098, 2057, 
    2072, 2073, 2076, 2047, 2091, 2078, 2058, 2081, 2071, 
    2062, 2095, 2082, 2066, 2083, 2064, 2077]

list1 = list(random.randbytes(len(flag)))

key1 = 'H&NCTF'
key1 = list(str.encode(key1))

key2  = list(random.randbytes(len(key1)))

enc_flag = []
for i in range(len(flag)):
    enc_flag.append((flag[i] ^ key1[i % len(key1)]) + 2024)

if enc_flag == b:
    print('Okay,maybe you need a closer examination!')
else:
    print('')

enc_flag = []
for i in range(len(flag)):
    enc_flag.append((flag[i] ^ key2[i % len(key2)]) ^ (list1[i] ^ key1[i % len(key1)]))

if enc_flag == a:
    print('Okay,you get the flag!')
else:
    print('Oh no,maybe you should try again~')

pickle的调试器

GitHub - Legoclones/pickledbg: A GDB+GEF-style debugger for unloading Python pickles

import random
# 给定的加密过程中的列表 'b'
b = [2024, 2024, 2024, 2024, 2024, 2024, 2075, 2099, 2071,
    2082, 2078, 2059, 2047, 2119, 2057, 2078, 2035, 2064,
    2069, 2091, 2066, 2052, 2077, 2049, 2067, 2098, 2057,
    2072, 2073, 2076, 2047, 2091, 2078, 2058, 2081, 2071,
    2062, 2095, 2082, 2066, 2083, 2064, 2077]
# 加密过程中使用的密钥
key1 = b'H&NCTF'
# 解密过程
flag = []
for i in range(len(b)):
    decrypted_byte = (b[i] - 2024) ^ key1[i % len(key1)]
    flag.append(decrypted_byte)
# 将字节列表转换回字符串
flag_str = bytes(flag).decode()
print("解密后的 flag:", flag_str)
flag = list(flag.encode()) 
# 作用是将输入的 flag 字符串转换成一个字节值的列表
'example'-->b'example'-->[101, 120, 97, 109, 112, 108, 101]
flag_str = bytes(flag).decode()
#逆操作

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1682281.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

记某src通过越权拿下高危漏洞

在挖掘某SRC时,遇到了一个社区网站,社区站点是我在挖掘SRC时比较愿意遇到的,因为它们可探索的内容是较多的,幸运地,通过两个接口构造参数可进行越权,从而获得整个网站用户的信息。 图片以进行脱敏处理。在…

好看的html网站维护源码

源码介绍 好看的html网站维护源码,源码由HTMLCSSJS组成,记事本打开源码文件可以进行内容文字之类的修改,双击html文件可以本地运行效果,也可以上传到服务器里面, 源码截图 源码下载 好看的html网站维护源码

算法分析与设计复习__递归方程与分治

总结自:【算法设计与分析】期末考试突击课_哔哩哔哩_bilibili 1.递归,递归方程 1.1递归条件: 1.一个问题的解可以分解为几个子问题的解; 2.这个问题与分解之后的子问题,除了数据规模不同,求解思路完全一样; 3.存在…

嵌入式:四轴飞行器控制系统

目录 文章主题与命名环境准备四轴飞行器控制系统基础代码示例:实现四轴飞行器控制系统应用场景:航拍与农业喷洒问题解决方案与优化 1. 文章主题 文章主题 本教程将详细介绍如何在STM32嵌入式系统中使用C语言实现四轴飞行器控制系统,包括如…

汇凯金业:贵金属投资如何操作

投资贵金属虽然可能看起来令人生畏,但只要你知道如何操作,就可能会变得实际可行。以下是操作贵金属投资的基本步骤: 1. 了解市场 第一步是学习贵金属投资的基础知识,了解市场的运作方式,类型的区别(如黄金、白银、铂…

【一步一步了解Java系列】:探索Java逻辑控制

看到这句话的时候证明:此刻你我都在努力~ 加油陌生人~ 个人主页: Gu Gu Study ​​ 专栏:一步一步了解Java 喜欢的一句话: 常常会回顾努力的自己,所以要为自己的努…

【面试干货】一个数组的倒序

【面试干货】一个数组的倒序 1、实现思想2、代码实现 💖The Begin💖点点关注,收藏不迷路💖 1、实现思想 创建一个新的数组,然后将原数组的元素按相反的顺序复制到新数组中。 2、代码实现 package csdn;public class…

springboot 引用外配置json文件

场景 一些服务需要记录一些持久化的信息(没有数据库,redis,elasticsearch 可用) 我们就项目启动过程创建一个json 文件去记录工作内容的进程(json 可视化与改动非常方便) 实现效果 代码 application.yml…

【Unity Shader入门精要 第7章】基础纹理(三)

1. 渐变纹理 另外一种对于纹理的使用方式是通过渐变纹理为物体提供漫反射光照效果。 顾名思义,渐变纹理本身就是一张颜色渐变(可以是连续渐变,也可能是突变)的图片,这个渐变的过程模拟的就是光源从不同的角度照射物体…

Git—常用命令

官方 Git - Book (git-scm.com) 常用命令 命令作用git config --global user.name 用户名设置用户作者git config --global user.email 邮箱设置用户邮箱 git init初始化本地仓库git status查看本地仓库状态 git add 文件名 添加到暂存区git commit -m "提交日志…

【K8s】专题四:Kubernetes 安装方法之 Sealos

以下内容均来自个人笔记并重新梳理,如有错误欢迎指正!如果对您有帮助,烦请点赞、关注、转发!欢迎扫码关注个人公众号! 目录 一、Sealos 简介 二、Sealos 下载、安装 三、Sealos 部署 Kubernetes 集群 四、Sealos 常…

vue2人力资源项目9权限管理

页面搭建 <template><div class"container"><div class"app-container"><el-button size"mini" type"primary">添加权限</el-button><el-table-column label"名称" /><el-table-co…

反序列化漏洞【1】

1.不安全的反序列化漏洞介绍 序列化&#xff1a;将对象转换成字符串&#xff0c;目的是方便传输&#xff0c;关键词serialize a代表数组&#xff0c;数组里有三个元素&#xff0c;第一个元素下标为0&#xff0c;长度为7&#xff0c;内容为porsche&#xff1b;第二个元素下标为1…

rk3399 shell 测试串口 sttf

问题&#xff1a; 使用 ubunut shell 来对串口进行测试。 板卡上使用的是 USB 转串口&#xff0c; 使用了一片ch340 原理图如下&#xff1a; 再 ubuntu shell 的测试命令。 这里首先要 insmod 一下 ch340 的驱动&#xff0c;默认会有 /usr/sbin/ch34x.ko&#xff0c; 如果没…

创新指南 | 企业AI战略实施方案探讨(下):如何基于AI重构业务流程并落地实施

人工智能&#xff08;AI&#xff09;的浪潮已经席卷全球&#xff0c;成为推动现代企业发展的强大动力。AI技术不仅提升了企业的运营效率&#xff0c;还催生了新的商业模式和市场机会。本文将深入探讨AI的革新性应用案例&#xff0c;并提供一套企业落地AI的具体实施方案&#xf…

springboot3.0+继续使用springboot2.0配置会显示 `无法自动装配,找不到对应的Bean`解决方法

在 Spring Boot 3.0 中&#xff0c;Spring 团队对自动配置机制进行了重大变更&#xff0c;特别是 spring.factories 文件。spring.factories 文件已被 META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 文件所取代。在springboot3.0继续使用…

SQL使用Groupby分组后,选择每个分组某个值最大的那一行

思路是&#xff1a; 先定位分组后某个值最大的值是多少根据值去全表匹配&#xff0c;得到对应的行 比如有个表&#xff1a; SELECT * FROM my_table按照sku_id分组后&#xff0c;选择record_date最大的那一行的全部值&#xff0c;先分组&#xff1a; SELECT sku_id,max(rec…

四川易点慧电商抖音小店运营秘籍引领电商新潮流

在当今数字化浪潮中&#xff0c;抖音小店作为电商领域的一匹黑马&#xff0c;以其独特的社交属性和庞大的用户基础&#xff0c;正迅速崛起为新的销售增长点。四川易点慧电子商务有限公司&#xff0c;作为电商行业的佼佼者&#xff0c;深谙抖音小店运营的精髓&#xff0c;专业助…

Pytest测试实战

Pytest测试框架是动态语言Python专用的测试框架&#xff0c;使用起来非常的简单&#xff0c;这主要得易于它的设计&#xff0c;Pytest测试框架具备强大的功能&#xff0c;丰富的第三方插件&#xff0c;以及可扩展性好&#xff0c;可以很好的和unittest测试框架能够结合起来在项…

手机如何下载短视频到本地:成都鼎茂宏升文化传媒公

手机如何下载短视频到本地 ​随着移动互联网的迅猛发展&#xff0c;短视频已经成为人们生活中不可或缺的一部分。从娱乐、学习到社交&#xff0c;短视频以其短小精悍、内容丰富的特点&#xff0c;吸引了大量用户的关注。然而&#xff0c;有时我们可能希望将喜欢的短视频保存到…