Skip to content

Instantly share code, notes, and snippets.

@yobabyte
Created June 15, 2024 03:44
Show Gist options
  • Save yobabyte/39b761004beb0c599a6b0d4eb2f1a51e to your computer and use it in GitHub Desktop.
Save yobabyte/39b761004beb0c599a6b0d4eb2f1a51e to your computer and use it in GitHub Desktop.
sgdasm example #1
<?php
/* Auto-generated by SGDasm (PHP: 80000; Bytecode: v31) */
function wp_attachment_is($type, $post)
{
/*
wp_attachment_is:
; (lines=74, args=2, vars=6, tmps=26)
; wp_example.obf.php:2-45
0000 CV0($type) = RECV 1 1022
0001 CV1($post) = RECV_INIT 2 null
0002 X0 = INIT_FCALL_BY_NAME 1 string("get_post")
0003 X0 = SEND_VAR_EX CV1($post)
0004 V6 = DO_FCALL_BY_NAME
0005 X1 = ASSIGN CV1($post) V6
0006 T8 = BOOL_NOT CV1($post)
0007 X0 = JMPZ T8 0009
0008 X0 = RETURN bool(false)
0009 X1 = INIT_FCALL_BY_NAME 1 string("get_attached_file")
0010 X0 = CHECK_FUNC_ARG
0011 V9 = FETCH_OBJ_FUNC_ARG CV1($post) string("ID")
0012 X0 = SEND_FUNC_ARG V9
0013 V10 = DO_FCALL_BY_NAME
0014 X5 = ASSIGN CV2($file) V10
0015 T12 = BOOL_NOT CV2($file)
0016 X0 = JMPZ T12 0018
0017 X0 = RETURN bool(false)
0018 X5 = INIT_FCALL 2 2 string("str_starts_with")
0019 T13 = FETCH_OBJ_R CV1($post) string("post_mime_type")
0020 X0 = SEND_VAL T13
0021 T14 = CONCAT CV0($type) string("/")
0022 X1 = SEND_VAL T14
0023 V15 = DO_ICALL
0024 X0 = JMPZ V15 0026
0025 X0 = RETURN bool(true)
0026 X9 = INIT_FCALL_BY_NAME 1 string("wp_check_filetype")
0027 X0 = SEND_VAR_EX CV2($file)
0028 V16 = DO_FCALL_BY_NAME
0029 X11 = ASSIGN CV3($check) V16
0030 T18 = ISSET_ISEMPTY_DIM_OBJ (empty) CV3($check) string("ext")
0031 X0 = JMPZ T18 0033
0032 X0 = RETURN bool(false)
0033 T19 = FETCH_DIM_R CV3($check) string("ext")
0034 X14 = ASSIGN CV4($ext) T19
0035 T21 = FETCH_OBJ_R CV1($post) string("post_mime_type")
0036 T22 = IS_NOT_IDENTICAL T21 string("import")
0037 X0 = JMPZ T22 0040
0038 T23 = IS_IDENTICAL CV0($type) CV4($ext)
0039 X0 = RETURN T23
0040 X0 = SWITCH_STRING CV0($type) array("image" => int(256), "audio" => int(480), "video" => int(736)) 0071
0041 T24 = IS_EQUAL CV0($type) string("image")
0042 X0 = JMPNZ T24 0048
0043 T24 = IS_EQUAL CV0($type) string("audio")
0044 X0 = JMPNZ T24 0055
0045 T24 = IS_EQUAL CV0($type) string("video")
0046 X0 = JMPNZ T24 0063
0047 X0 = JMP 0071
0048 X19 = ASSIGN CV5($image_exts) array(0 => string("jpg"), 1 => string("jpeg"), 2 => string("jpe"), 3 => string("gif"), 4 => string("png"), 5 => string("webp"), 6 => string("avif"))
0049 X13 = INIT_FCALL 3 3 string("in_array")
0050 X0 = SEND_VAR CV4($ext)
0051 X1 = SEND_VAR CV5($image_exts)
0052 X2 = SEND_VAL bool(true)
0053 V26 = DO_ICALL
0054 X0 = RETURN V26
0055 X14 = INIT_FCALL 3 3 string("in_array")
0056 X0 = SEND_VAR CV4($ext)
0057 X15 = INIT_FCALL_BY_NAME 0 string("wp_get_audio_extensions")
0058 V27 = DO_FCALL_BY_NAME
0059 X1 = SEND_VAR V27
0060 X2 = SEND_VAL bool(true)
0061 V28 = DO_ICALL
0062 X0 = RETURN V28
0063 X16 = INIT_FCALL 3 3 string("in_array")
0064 X0 = SEND_VAR CV4($ext)
0065 X17 = INIT_FCALL_BY_NAME 0 string("wp_get_video_extensions")
0066 V29 = DO_FCALL_BY_NAME
0067 X1 = SEND_VAR V29
0068 X2 = SEND_VAL bool(true)
0069 V30 = DO_ICALL
0070 X0 = RETURN V30
0071 T31 = IS_IDENTICAL CV0($type) CV4($ext)
0072 X0 = RETURN T31
0073 X0 = RETURN null
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment