Function at 0x407670
Capabilities:
Encode data using xor
Encrypt data using twofish
Get file size
Read file on windows
Write file on windows

Disassembly:
sub esp, 0x26c
mov eax, dword [0x5b0c20]
xor eax, esp
mov dword [esp + 0x268], eax
mov eax, dword [esp + 0x278]
push ebx
mov ebx, dword [esp + 0x278]
mov dword [esp + 0x10], eax
mov dword [eax], 0
push esi
mov eax, 0x5b2994
mov edx, ebx
push edi
mov dword [esp + 0x10], 0xffffffff
mov dword [esp + 0x14], 0
sub edx, eax
jmp 0x4076c0
movzx ecx, word [eax]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x4076c0
lea edx, [esp + 0x6c]
mov eax, ebx
sub edx, ebx
jmp 0x4076e0
movzx ecx, word [eax]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x4076e0
lea eax, [esp + 0x6c]
add eax, 0xfffffffe
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x4076f6
mov ecx, dword [str.comboot.bin]
mov edx, dword [0x55163c]
mov dword [eax], ecx
mov ecx, dword [0x551640]
mov dword [eax + 4], edx
mov edx, dword [0x551644]
mov dword [eax + 8], ecx
mov ecx, dword [0x551648]
mov dword [eax + 0xc], edx
mov edx, dword [0x55164c]
mov dword [eax + 0x10], ecx
mov dword [eax + 0x14], edx
movzx eax, byte [esp + 0x27c]
dec eax
cmp eax, 0xa
ja case.default.0x407749
jmp dword [eax*4 + 0x407e0c]
mov edi, ebx
add edi, 0xfffffffe
mov ax, word [edi + 2]
add edi, 2
test ax, ax
jne 0x407755
mov esi, str.boot_aes.com
jmp 0x407a21
mov eax, ebx
add eax, 0xfffffffe
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x407770
mov ecx, dword [str.boot_tf.com]
mov dword [eax], ecx
mov edx, dword [0x551608]
mov dword [eax + 4], edx
mov ecx, dword [0x55160c]
mov dword [eax + 8], ecx
mov edx, dword [0x551610]
mov dword [eax + 0xc], edx
mov ecx, dword [0x551614]
mov dword [eax + 0x10], ecx
mov edx, dword [0x551618]
mov dword [eax + 0x14], edx
jmp 0x407a2a
mov eax, ebx
add eax, 0xfffffffe
jmp 0x4077c0
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x4077c0
mov ecx, dword [str.boot_bf.com]
mov dword [eax], ecx
mov edx, dword [0x5515f0]
mov dword [eax + 4], edx
mov ecx, dword [0x5515f4]
mov dword [eax + 8], ecx
mov edx, dword [0x5515f8]
mov dword [eax + 0xc], edx
mov ecx, dword [0x5515fc]
mov dword [eax + 0x10], ecx
mov edx, dword [0x551600]
mov dword [eax + 0x14], edx
jmp 0x407a2a
mov eax, ebx
add eax, 0xfffffffe
jmp 0x407810
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x407810
mov ecx, dword [str.boot_ca.com]
mov dword [eax], ecx
mov edx, dword [0x5515d8]
mov dword [eax + 4], edx
mov ecx, dword [0x5515dc]
mov dword [eax + 8], ecx
mov edx, dword [0x5515e0]
mov dword [eax + 0xc], edx
mov ecx, dword [0x5515e4]
mov dword [eax + 0x10], ecx
mov edx, dword [0x5515e8]
mov dword [eax + 0x14], edx
jmp 0x407a2a
mov eax, ebx
add eax, 0xfffffffe
jmp 0x407860
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x407860
mov ecx, dword [str.boot_go.com]
mov dword [eax], ecx
mov edx, dword [0x5515c0]
mov dword [eax + 4], edx
mov ecx, dword [0x5515c4]
mov dword [eax + 8], ecx
mov edx, dword [0x5515c8]
mov dword [eax + 0xc], edx
mov ecx, dword [0x5515cc]
mov dword [eax + 0x10], ecx
mov edx, dword [0x5515d0]
mov dword [eax + 0x14], edx
jmp 0x407a2a
mov eax, ebx
add eax, 0xfffffffe
jmp 0x4078b0
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x4078b0
mov ecx, dword [str.boot_se.com]
mov dword [eax], ecx
mov edx, dword [0x5515a8]
mov dword [eax + 4], edx
mov ecx, dword [0x5515ac]
mov dword [eax + 8], ecx
mov edx, dword [0x5515b0]
mov dword [eax + 0xc], edx
mov ecx, dword [0x5515b4]
mov dword [eax + 0x10], ecx
mov edx, dword [0x5515b8]
mov dword [eax + 0x14], edx
jmp 0x407a2a
mov eax, ebx
add eax, 0xfffffffe
jmp 0x407900
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x407900
mov ecx, dword [str.boot_rc.com]
mov dword [eax], ecx
mov edx, dword [0x551590]
mov dword [eax + 4], edx
mov ecx, dword [0x551594]
mov dword [eax + 8], ecx
mov edx, dword [0x551598]
mov dword [eax + 0xc], edx
mov ecx, dword [0x55159c]
mov dword [eax + 0x10], ecx
mov edx, dword [0x5515a0]
mov dword [eax + 0x14], edx
jmp 0x407a2a
mov edi, ebx
add edi, 0xfffffffe
jmp 0x407950
mov ax, word [edi + 2]
add edi, 2
test ax, ax
jne 0x407950
mov esi, str.b_aesxts.com
jmp 0x407a21
mov eax, ebx
add eax, 0xfffffffe
jmp 0x407970
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x407970
mov ecx, dword [str.b_tfxts.com]
mov dword [eax], ecx
mov edx, dword [0x55155c]
mov dword [eax + 4], edx
mov ecx, dword [0x551560]
mov dword [eax + 8], ecx
mov edx, dword [0x551564]
mov dword [eax + 0xc], edx
mov ecx, dword [0x551568]
mov dword [eax + 0x10], ecx
mov edx, dword [0x55156c]
mov dword [eax + 0x14], edx
jmp 0x407a2a
mov eax, ebx
add eax, 0xfffffffe
jmp 0x4079c0
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x4079c0
mov ecx, dword [str.b_sexts.com]
mov dword [eax], ecx
mov edx, dword [0x551544]
mov dword [eax + 4], edx
mov ecx, dword [0x551548]
mov dword [eax + 8], ecx
mov edx, dword [0x55154c]
mov dword [eax + 0xc], edx
mov ecx, dword [0x551550]
mov dword [eax + 0x10], ecx
mov edx, dword [0x551554]
mov dword [eax + 0x14], edx
jmp 0x407a2a
mov edi, ebx
add edi, 0xfffffffe
jmp 0x407a10
mov ax, word [edi + 2]
add edi, 2
test ax, ax
jne 0x407a10
mov esi, 0x551524
mov ecx, 6
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
mov edi, dword [sym.imp.KERNEL32.dll_CreateFileW]
push ebp
push 0
push 0x80
push 3
push 0
push 1
push closesocket
lea eax, [esp + 0x88]
push eax
call edi
mov ebp, eax
cmp ebp, 0xffffffff
jne 0x407a6f
or eax, eax
pop ebp
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x268]
xor ecx, esp
call fcn.00524d83
add esp, 0x26c
ret
movzx eax, byte [esp + 0x280]
push eax
call fcn.00407600
add esp, 4
push 0
mov esi, eax
push ebp
imul esi, esi, 0xb000
call dword [sym.imp.KERNEL32.dll_GetFileSize]
lea ecx, [esi + 0xb000]
cmp eax, ecx
jb 0x407dc8
push 0
push 0x80
push 4
push 0
push 1
push 0xc0000000
push ebx
call edi
mov dword [esp + 0x14], eax
cmp eax, 0xffffffff
je 0x407dc8
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
push 0
push esi
push ebp
call edi
mov ebx, dword [esp + 0x14]
cmp eax, esi
jne 0x407dcc
push 0
push 0
push 0
push ebx
call edi
test eax, eax
jne 0x407dcc
push eax
lea edx, [esp + 0x14]
push edx
push 0xb000
push 0x5b48e0
push ebp
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x407dcc
cmp dword [esp + 0x10], 0xb000
jne 0x407dcc
xor ecx, ecx
jmp 0x407b20
xor eax, eax
movzx edx, byte [eax + 0x59f200]
xor byte [ecx + eax + 0x5b48e0], dl
movzx edx, byte [eax + 0x59f201]
xor byte [ecx + eax + 0x5b48e1], dl
movzx edx, byte [eax + 0x59f202]
xor byte [ecx + eax + 0x5b48e2], dl
movzx edx, byte [eax + 0x59f203]
xor byte [ecx + eax + 0x5b48e3], dl
add eax, 4
cmp eax, 0x200
jl 0x407b22
add ecx, 0x200
cmp ecx, 0xb000
jl 0x407b20
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
lea eax, [esp + 0x14]
push eax
push 0x8800
push 0x5b48e0
push ebx
call edi
test eax, eax
je 0x407dcc
cmp dword [esp + 0x10], 0x8800
jne 0x407dcc
push 0
push 0
push 0
push ebp
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
test eax, eax
jne 0x407dcc
push eax
lea ecx, [esp + 0x14]
push ecx
push 0xb000
push 0x5b48e0
push ebp
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x407dcc
cmp dword [esp + 0x10], 0xb000
jne 0x407dcc
xor ecx, ecx
jmp 0x407bf0
xor eax, eax
movzx edx, byte [eax + 0x59f200]
xor byte [ecx + eax + 0x5b48e0], dl
movzx edx, byte [eax + 0x59f201]
xor byte [ecx + eax + 0x5b48e1], dl
movzx edx, byte [eax + 0x59f202]
xor byte [ecx + eax + 0x5b48e2], dl
movzx edx, byte [eax + 0x59f203]
xor byte [ecx + eax + 0x5b48e3], dl
add eax, 4
cmp eax, 0x200
jl 0x407bf2
add ecx, 0x200
cmp ecx, 0xb000
jl 0x407bf0
mov esi, 0x50
push esi
lea eax, [esp + 0x24]
push 0x61
push eax
call fcn.00526520
add esp, 0xc
push 0
lea ecx, [esp + 0x14]
push ecx
push esi
lea edx, [esp + 0x2c]
push edx
push ebx
call edi
test eax, eax
je 0x407dcc
cmp dword [esp + 0x10], esi
jne 0x407dcc
push 0
lea eax, [esp + 0x14]
push eax
push 0xb000
push 0x5b48e0
push ebx
call edi
test eax, eax
je 0x407dcc
cmp dword [esp + 0x10], 0xb000
jne 0x407dcc
call fcn.00407330
test eax, eax
je 0x407dbe
push 0
lea ecx, [esp + 0x14]
push ecx
push esi
lea edx, [esp + 0x2c]
push edx
push ebx
call edi
test eax, eax
je 0x407dcc
cmp dword [esp + 0x10], esi
jne 0x407dcc
push 0
push ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
cmp eax, 0x42000
jb 0x407dcc
push 0
push 0
push 0x37000
push ebp
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0x37000
jne 0x407dcc
push 0
lea eax, [esp + 0x14]
push eax
push 0xb000
push 0x5b48e0
push ebp
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x407dcc
cmp dword [esp + 0x10], 0xb000
jne 0x407dcc
xor ecx, ecx
jmp 0x407d40
xor eax, eax
movzx edx, byte [eax + 0x59f200]
xor byte [ecx + eax + 0x5b48e0], dl
movzx edx, byte [eax + 0x59f201]
xor byte [ecx + eax + 0x5b48e1], dl
movzx edx, byte [eax + 0x59f202]
xor byte [ecx + eax + 0x5b48e2], dl
movzx edx, byte [eax + 0x59f203]
xor byte [ecx + eax + 0x5b48e3], dl
add eax, 4
cmp eax, 0x200
jl 0x407d42
add ecx, 0x200
cmp ecx, 0xb000
jl 0x407d40
push 0
lea eax, [esp + 0x14]
push eax
push 0x5000
push 0x5b48e0
push ebx
call edi
test eax, eax
je 0x407dcc
cmp dword [esp + 0x10], 0x5000
jne 0x407dcc
mov ecx, dword [esp + 0x1c]
mov dword [ecx], 1
mov dword [esp + 0x18], 1
jmp 0x407dcc
mov ebx, dword [esp + 0x14]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebp
call esi
cmp dword [esp + 0x18], 0
jne 0x407de7
cmp ebx, 0xffffffff
je 0x407de4
push ebx
call esi
or ebx, 0xffffffff
mov eax, ebx
jmp 0x407a56
mov ecx, dword [esp + 0x274]
pop edi
pop esi
pop ebx
xor ecx, esp
or eax, 0xffffffff
call fcn.00524d83
add esp, 0x26c
ret