Skip to content

Instantly share code, notes, and snippets.

@yobabyte
Created June 15, 2024 04:13
Show Gist options
  • Save yobabyte/19ef678d033b9c87239cbeef3133465d to your computer and use it in GitHub Desktop.
Save yobabyte/19ef678d033b9c87239cbeef3133465d to your computer and use it in GitHub Desktop.
sgdasm example #2
<?php
/* Auto-generated by SGDasm (PHP: 80000; Bytecode: v31) */
function foo($key, $str)
{
/*
foo:
; (lines=70, args=2, vars=8, tmps=51)
; rc4_example.obf.php:2-26
0000 CV0($key) = RECV 1 1022
0001 CV1($str) = RECV 2 1022
0002 X0 = ASSIGN CV2($s) array()
0003 X1 = ASSIGN CV3($i) int(0)
0004 X0 = JMP 0008
0005 X2 = ASSIGN_DIM CV2($s) CV3($i)
0006 X0 = OP_DATA CV3($i)
0007 X3 = PRE_INC CV3($i)
0008 T12 = IS_SMALLER CV3($i) int(256)
0009 X0 = JMPNZ T12 0005
0010 X5 = ASSIGN CV4($j) int(0)
0011 X6 = ASSIGN CV3($i) int(0)
0012 X0 = JMP 0032
0013 T15 = FETCH_DIM_R CV2($s) CV3($i)
0014 T16 = ADD CV4($j) T15
0015 X0 = INIT_FCALL 1 1 string("ord")
0016 T17 = STRLEN CV0($key)
0017 T18 = MOD CV3($i) T17
0018 T19 = FETCH_DIM_R CV0($key) T18
0019 X0 = SEND_VAL T19
0020 V20 = DO_ICALL
0021 T21 = ADD T16 V20
0022 T22 = MOD T21 int(256)
0023 X15 = ASSIGN CV4($j) T22
0024 T24 = FETCH_DIM_R CV2($s) CV3($i)
0025 X17 = ASSIGN CV5($x) T24
0026 T27 = FETCH_DIM_R CV2($s) CV4($j)
0027 X18 = ASSIGN_DIM CV2($s) CV3($i)
0028 X0 = OP_DATA T27
0029 X20 = ASSIGN_DIM CV2($s) CV4($j)
0030 X0 = OP_DATA CV5($x)
0031 X21 = PRE_INC CV3($i)
0032 T30 = IS_SMALLER CV3($i) int(256)
0033 X0 = JMPNZ T30 0013
0034 X23 = ASSIGN CV3($i) int(0)
0035 X24 = ASSIGN CV4($j) int(0)
0036 X25 = ASSIGN CV6($res) string("")
0037 X26 = ASSIGN CV7($y) int(0)
0038 X0 = JMP 0065
0039 T35 = ADD CV3($i) int(1)
0040 T36 = MOD T35 int(256)
0041 X29 = ASSIGN CV3($i) T36
0042 T38 = FETCH_DIM_R CV2($s) CV3($i)
0043 T39 = ADD CV4($j) T38
0044 T40 = MOD T39 int(256)
0045 X33 = ASSIGN CV4($j) T40
0046 T42 = FETCH_DIM_R CV2($s) CV3($i)
0047 X35 = ASSIGN CV5($x) T42
0048 T45 = FETCH_DIM_R CV2($s) CV4($j)
0049 X36 = ASSIGN_DIM CV2($s) CV3($i)
0050 X0 = OP_DATA T45
0051 X38 = ASSIGN_DIM CV2($s) CV4($j)
0052 X0 = OP_DATA CV5($x)
0053 T47 = FETCH_DIM_R CV1($str) CV7($y)
0054 X1 = INIT_FCALL 1 1 string("chr")
0055 T48 = FETCH_DIM_R CV2($s) CV3($i)
0056 T49 = FETCH_DIM_R CV2($s) CV4($j)
0057 T50 = ADD T48 T49
0058 T51 = MOD T50 int(256)
0059 T52 = FETCH_DIM_R CV2($s) T51
0060 X0 = SEND_VAL T52
0061 V53 = DO_ICALL
0062 T54 = BW_XOR V53 T47
0063 X47 = ASSIGN_OP 8 CV6($res) T54
0064 X48 = PRE_INC CV7($y)
0065 T57 = STRLEN CV1($str)
0066 T58 = IS_SMALLER CV7($y) T57
0067 X0 = JMPNZ T58 0039
0068 X0 = RETURN CV6($res)
0069 X0 = RETURN null
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment