技术宅的结界

 找回密码
 立即注册→加入我们

QQ登录

只需一步,快速开始

搜索
热搜: 下载 VB C 实现 编写
查看: 499|回复: 1
收起左侧

【VB6】从汇编角度看vb的字符串

[复制链接]

25

主题

75

帖子

1009

积分

用户组: 版主

UID
1821
精华
6
威望
57 点
宅币
759 个
贡献
31 次
宅之契约
0 份
在线时间
186 小时
注册时间
2016-7-12
发表于 2017-4-10 18:49:33 | 显示全部楼层 |阅读模式

欢迎访问技术宅的结界,请注册或者登录吧。

您需要 登录 才可以下载或查看,没有帐号?立即注册→加入我们

x
本帖最后由 Ayala 于 2017-4-10 18:52 编辑

写了个简单的C2替换原C2 在原C2目录新建立一个文件夹org把原C2放进去 追加输出.asm文件
参考 https://www.0xaa55.com/forum.php ... tid=1881&ctid=2
[C] 纯文本查看 复制代码
char * __stdcall GetCommandLineA();
int main()
{	
	char buf[256]={0};
	sprintf(&buf,"org\\%s -Fa foo.asm",GetCommandLineA());
	return system(&buf);;
}

[Visual Basic] 纯文本查看 复制代码
Sub foo(ByVal str1 As String, ByRef str2 As String)
    
End Sub

Sub Main()
    Dim str As String
    str = "0xAA55·技术宅的结界"
    foo str, str
End Sub

Sub too()
    Dim str As String
    str = "0xAA55·技术宅的结界"
    str = "论坛"
    
End Sub

[Asm] 纯文本查看 复制代码
	
TITLE	Module1
	.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
_DATA	SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA	ENDS
CONST	SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST	ENDS
_BSS	SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS	ENDS
_TLS	SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS	ENDS
text$1	SEGMENT PARA USE32 PUBLIC ''
text$1	ENDS
;	COMDAT ?foo@Module1@@AAGXXZ
text$1	SEGMENT PARA USE32 PUBLIC ''
text$1	ENDS
;	COMDAT ?Main@Module1@@AAGXXZ
text$1	SEGMENT PARA USE32 PUBLIC ''
text$1	ENDS
;	COMDAT ?too@Module1@@AAGXXZ
text$1	SEGMENT PARA USE32 PUBLIC ''
text$1	ENDS
FLAT	GROUP _DATA, CONST, _BSS
	ASSUME	CS: FLAT, DS: FLAT, SS: FLAT
endif
PUBLIC	?foo@Module1@@AAGXXZ				; Module1::foo
EXTRN	__imp_@__vbaStrCopy:NEAR
EXTRN	__imp_@__vbaFreeStr:NEAR
EXTRN	___vbaExceptHandler:NEAR
EXTRN	__except_list:DWORD
;	COMDAT CONST
; File Module1
CONST	SEGMENT
$S25	DB	02H, 00H
	DB	04H, 00H
	DB	00H, 00H, 00H, 00H
	DD	FLAT:$L24
CONST	ENDS
;	COMDAT ?foo@Module1@@AAGXXZ
text$1	SEGMENT
_str1$ = 8
_str1$ = -20
__$SEHRec$ = -16
?foo@Module1@@AAGXXZ PROC NEAR				; Module1::foo, COMDAT
; File Module1
; Line 1
	push	ebp
	mov	ebp, esp
	sub	esp, 8
	push	OFFSET FLAT:___vbaExceptHandler
	mov	eax, DWORD PTR fs:__except_list
	push	eax
	mov	DWORD PTR fs:__except_list, esp
	sub	esp, 8
	push	ebx
	push	esi
	push	edi
	mov	DWORD PTR __$SEHRec$[ebp+8], esp
	mov	DWORD PTR __$SEHRec$[ebp+12], OFFSET FLAT:$S25
	mov	edx, DWORD PTR _str1$[ebp]
	lea	ecx, DWORD PTR _str1$[ebp]
	mov	DWORD PTR _str1$[ebp], 0
	call	DWORD PTR __imp_@__vbaStrCopy
	push	$L55
$L50:
; Line 3
$L24:
	lea	ecx, DWORD PTR _str1$[ebp]
	call	DWORD PTR __imp_@__vbaFreeStr
$L53:
	ret	0
$L55:
	mov	ecx, DWORD PTR __$SEHRec$[ebp]
	pop	edi
	pop	esi
	mov	DWORD PTR fs:__except_list, ecx
	pop	ebx
	mov	esp, ebp
	pop	ebp
	ret	8
?foo@Module1@@AAGXXZ ENDP				; Module1::foo
text$1	ENDS
PUBLIC	?Main@Module1@@AAGXXZ				; Module1::Main
EXTRN	___vba@056067A4:BYTE
;	COMDAT CONST
; File Module1
CONST	SEGMENT
$S33	DB	02H, 00H
	DB	04H, 00H
	DB	00H, 00H, 00H, 00H
	DD	FLAT:$L32
CONST	ENDS
;	COMDAT ?Main@Module1@@AAGXXZ
text$1	SEGMENT
_str$ = -20
__$SEHRec$ = -16
?Main@Module1@@AAGXXZ PROC NEAR				; Module1::Main, COMDAT
; File Module1
; Line 5
	push	ebp
	mov	ebp, esp
	sub	esp, 8
	push	OFFSET FLAT:___vbaExceptHandler
	mov	eax, DWORD PTR fs:__except_list
	push	eax
	mov	DWORD PTR fs:__except_list, esp
	sub	esp, 8
	push	ebx
	push	esi
	push	edi
	mov	DWORD PTR __$SEHRec$[ebp+8], esp
	mov	DWORD PTR __$SEHRec$[ebp+12], OFFSET FLAT:$S33
; Line 7
	mov	edx, OFFSET FLAT:___vba@056067A4
	lea	ecx, DWORD PTR _str$[ebp]
	mov	DWORD PTR _str$[ebp], 0
	call	DWORD PTR __imp_@__vbaStrCopy
; Line 8
	mov	ecx, DWORD PTR _str$[ebp]
	lea	eax, DWORD PTR _str$[ebp]
	push	eax
	push	ecx
	call	?foo@Module1@@AAGXXZ			; Module1::foo
	push	$L67
$L62:
; Line 9
$L32:
	lea	ecx, DWORD PTR _str$[ebp]
	call	DWORD PTR __imp_@__vbaFreeStr
$L65:
	ret	0
$L67:
	mov	ecx, DWORD PTR __$SEHRec$[ebp]
	pop	edi
	pop	esi
	mov	DWORD PTR fs:__except_list, ecx
	pop	ebx
	mov	esp, ebp
	pop	ebp
	ret	0
?Main@Module1@@AAGXXZ ENDP				; Module1::Main
text$1	ENDS
PUBLIC	?too@Module1@@AAGXXZ				; Module1::too
EXTRN	___vba@056067C8:BYTE
;	COMDAT CONST
; File Module1
CONST	SEGMENT
$S40	DB	02H, 00H
	DB	04H, 00H
	DB	00H, 00H, 00H, 00H
	DD	FLAT:$L39
CONST	ENDS
;	COMDAT ?too@Module1@@AAGXXZ
text$1	SEGMENT
_str$ = -20
__$SEHRec$ = -16
?too@Module1@@AAGXXZ PROC NEAR				; Module1::too, COMDAT
; File Module1
; Line 11
	push	ebp
	mov	ebp, esp
	sub	esp, 8
	push	OFFSET FLAT:___vbaExceptHandler
	mov	eax, DWORD PTR fs:__except_list
	push	eax
	mov	DWORD PTR fs:__except_list, esp
	sub	esp, 8
	push	ebx
	push	esi
	push	edi
	mov	DWORD PTR __$SEHRec$[ebp+8], esp
	mov	DWORD PTR __$SEHRec$[ebp+12], OFFSET FLAT:$S40
; Line 13
	mov	esi, DWORD PTR __imp_@__vbaStrCopy
	mov	edx, OFFSET FLAT:___vba@056067A4
	lea	ecx, DWORD PTR _str$[ebp]
	mov	DWORD PTR _str$[ebp], 0
	call	esi
; Line 14
	mov	edx, OFFSET FLAT:___vba@056067C8
	lea	ecx, DWORD PTR _str$[ebp]
	call	esi
	push	$L77
$L72:
; Line 16
$L39:
	lea	ecx, DWORD PTR _str$[ebp]
	call	DWORD PTR __imp_@__vbaFreeStr
$L75:
	ret	0
$L77:
	mov	ecx, DWORD PTR __$SEHRec$[ebp]
	pop	edi
	pop	esi
	mov	DWORD PTR fs:__except_list, ecx
	pop	ebx
	mov	esp, ebp
	pop	ebp
	ret	0
?too@Module1@@AAGXXZ ENDP				; Module1::too
text$1	ENDS
END


本帖被以下淘专辑推荐:

0

主题

8

帖子

75

积分

用户组: 小·技术宅

UID
2266
精华
0
威望
2 点
宅币
63 个
贡献
0 次
宅之契约
0 份
在线时间
5 小时
注册时间
2017-2-21
发表于 2017-4-18 12:17:02 | 显示全部楼层
   新人表示没用过VB,一开始就接触的VC   

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|技术宅的结界 ( 滇ICP备16008837号|网站地图

GMT+8, 2018-5-25 18:37 , Processed in 0.078282 second(s), 17 queries , Gzip On, Memcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表