- UID
- 2
- 精华
- 积分
- 7736
- 威望
- 点
- 宅币
- 个
- 贡献
- 次
- 宅之契约
- 份
- 最后登录
- 1970-1-1
- 在线时间
- 小时
|
楼主 |
发表于 2015-2-1 22:27:21
|
显示全部楼层
本帖最后由 元始天尊 于 2015-2-1 22:29 编辑
接上面所述,既然知道 fastdns在测速时的api调用序列,通过调用栈就可以知道其实还是调用的ws2_32中的函数,如下:
WS2_32!socket
WS2_32!setsockopt
WS2_32!htons
WS2_32!sendto
WS2_32!select
WS2_32!shutdown
WS2_32!closesocket
针对每个函数,我编写了相应的命令以输出更有用的信息(超强^_^可以用于其他软件):
bp WS2_32!socket "~.;.printf \"socket: af=%d type=%d protocol=%d \",poi(esp+4),poi(esp+8),poi(esp+0x0C);gu;.printf \"socket=%d\\n\",eax;gc"
bp WS2_32!setsockopt "~.;.printf \"setsockopt: socket=%d level=%d optname=%d optval=%d optlen=%d\\n\",poi(esp+4),poi(esp+8),poi(esp+0x0c),poi(poi(esp+0x10)),poi(esp+0x14);gc"
bp WS2_32!htons "~.;.printf \"htons: port=%d\\n\",poi(esp+4)&0xffff;gc"
bp WS2_32!sendto "~.;r $t0=poi(poi(esp+0x14)+4);.printf \"sendto: socket=%d ip=%d.%d.%d.%d:%d send=\\n\",poi(esp+4),$t0&0xff,($t0>>8)&0xff,($t0>>0x10)&0xff,($t0>>0x18)&0xff,poi(poi(esp+0x14)+2)&0xffff;db poi(esp+8) lpoi(esp+0x0C);gc"
bp WS2_32!select "~.;.printf \"select: socket=%d timeout=%d.%ds\\n\",poi(poi(esp+8)+4),poi(poi(esp+0x14)),poi(poi(esp+0x14)+4);gc"
bp WS2_32!shutdown "~.;.printf \"shutdown: socket=%d how=%d\\n\",poi(esp+4),poi(esp+8);gc"
bp WS2_32!closesocket "~.;.printf \"closesocket: socket=%d\\n\",poi(esp+4);gc"
得到运行结果如下:
Create thread 1:2b48
. 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: *** WARNING: Unable to verify checksum for FastDNS.exe
*** ERROR: Symbol file could not be found. Defaulted to export symbols for FastDNS.exe -
FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
socket: af=2 type=2 protocol=0 socket=976
. 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
setsockopt: socket=976 level=65535 optname=32 optval=0 optlen=4
. 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
sendto: socket=976 ip=4.2.2.1:13568 send=
01c284b0 11 a9 01 00 00 01 00 00-00 00 00 00 03 77 77 77 .............www
01c284c0 09 6d 69 63 72 6f 73 6f-66 74 03 63 6f 6d 00 00 .microsoft.com..
01c284d0 01 00 01 ...
. 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
select: socket=976 timeout=2.0s
. 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
Create thread 5:17b8
. 5 Id: 31f8.17b8 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
socket: af=2 type=2 protocol=0 . 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
shutdown: socket=976 how=1
. 1 Id: 31f8.2b48 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
closesocket: socket=976
socket=924
. 5 Id: 31f8.17b8 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
setsockopt: socket=924 level=65535 optname=32 optval=0 optlen=4
. 5 Id: 31f8.17b8 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 5 Id: 31f8.17b8 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
sendto: socket=924 ip=4.2.2.2:13568 send=
01c28b38 20 d8 01 00 00 01 00 00-00 00 00 00 03 77 77 77 ............www
01c28b48 09 6d 69 63 72 6f 73 6f-66 74 03 63 6f 6d 00 00 .microsoft.com..
01c28b58 01 00 01 ...
. 5 Id: 31f8.17b8 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 5 Id: 31f8.17b8 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
select: socket=924 timeout=2.0s
(31f8.17b8): Unknown exception - code 0eedfade (first chance)
Create thread 1:24ec
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
socket: af=2 type=2 protocol=0 . 5 Id: 31f8.17b8 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
shutdown: socket=924 how=1
. 5 Id: 31f8.17b8 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
closesocket: socket=924
socket=1020
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
setsockopt: socket=1020 level=65535 optname=32 optval=0 optlen=4
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
sendto: socket=1020 ip=4.2.2.3:13568 send=
01c1d740 17 dd 01 00 00 01 00 00-00 00 00 00 03 77 77 77 .............www
01c1d750 09 6d 69 63 72 6f 73 6f-66 74 03 63 6f 6d 00 00 .microsoft.com..
01c1d760 01 00 01 ...
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
select: socket=1020 timeout=2.0s
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
Create thread 5:3b0
. 5 Id: 31f8.3b0 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
socket: af=2 type=2 protocol=0 socket=516
. 5 Id: 31f8.3b0 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
setsockopt: socket=516 level=65535 optname=32 optval=0 optlen=4
. 5 Id: 31f8.3b0 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 5 Id: 31f8.3b0 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
sendto: socket=516 ip=4.2.2.4:13568 send=
01c29614 4b 87 01 00 00 01 00 00-00 00 00 00 03 77 77 77 K............www
01c29624 09 6d 69 63 72 6f 73 6f-66 74 03 63 6f 6d 00 00 .microsoft.com..
01c29634 01 00 01 ...
. 5 Id: 31f8.3b0 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
shutdown: socket=1020 how=1
. 1 Id: 31f8.24ec Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
closesocket: socket=1020
. 5 Id: 31f8.3b0 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
select: socket=516 timeout=2.0s
(31f8.3b0): Unknown exception - code 0eedfade (first chance)
Create thread 1:1f80
. 1 Id: 31f8.1f80 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
socket: af=2 type=2 protocol=0 . 5 Id: 31f8.3b0 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
shutdown: socket=516 how=1
. 5 Id: 31f8.3b0 Suspend: 1 Teb: 7fe99000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
closesocket: socket=516
socket=1020
. 1 Id: 31f8.1f80 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
setsockopt: socket=1020 level=65535 optname=32 optval=0 optlen=4
. 1 Id: 31f8.1f80 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 1 Id: 31f8.1f80 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
sendto: socket=1020 ip=4.2.2.5:13568 send=
01c38304 66 79 01 00 00 01 00 00-00 00 00 00 03 77 77 77 fy...........www
01c38314 09 6d 69 63 72 6f 73 6f-66 74 03 63 6f 6d 00 00 .microsoft.com..
01c38324 01 00 01 ...
. 1 Id: 31f8.1f80 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 1 Id: 31f8.1f80 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
select: socket=1020 timeout=2.0s
(31f8.1f80): Unknown exception - code 0eedfade (first chance)
Create thread 2:2ea0
. 2 Id: 31f8.2ea0 Suspend: 1 Teb: 7ffd7000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
socket: af=2 type=2 protocol=0 socket=828
. 2 Id: 31f8.2ea0 Suspend: 1 Teb: 7ffd7000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
setsockopt: socket=828 level=65535 optname=32 optval=0 optlen=4
. 1 Id: 31f8.1f80 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
shutdown: socket=1020 how=1
. 1 Id: 31f8.1f80 Suspend: 1 Teb: 7ffda000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
closesocket: socket=1020
. 2 Id: 31f8.2ea0 Suspend: 1 Teb: 7ffd7000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
WS2_32!htons
. 2 Id: 31f8.2ea0 Suspend: 1 Teb: 7ffd7000 Unfrozen
Start: FastDNS!Rtflabelinitialization$qqrv+0x25458 (0043d310)
Priority: 0 Priority class: 32 Affinity: f
。。。。。。。。。。。。
按单个线程来分析,得到api调用序列如下:
线程2b48:
socket
setsockopt
htons 53
sendto
select
recvfrom
htons 13568
shutdown
closesocket
发现sub_40970C sub_40EA3C为重要函数,可以从中分析出流程
今天分析到这里,以后再分析
|
|