Compare commits
2
Commits
77298515c2
...
3796635494
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3796635494 | ||
|
|
2091d65381 |
No files matched your search
@@ -14,6 +14,7 @@ struct thread_data
|
||||
socketnum dd ? ; Commands socket
|
||||
state dd ? ; disconnected/logging in/logged in/..
|
||||
passivesocknum dd ? ; when in passive mode, this is the listening socket
|
||||
pasv_tries dd ? ; ports tried for the current PASV
|
||||
datasocketnum dd ? ; socket used for data transfers
|
||||
permissions dd ? ; read/write/execute/....
|
||||
buffer_ptr dd ?
|
||||
@@ -847,7 +848,13 @@ cmdPASV:
|
||||
lea edx, [ebp + thread_data.datasock]
|
||||
mov esi, sizeof.thread_data.datasock
|
||||
|
||||
.next_port: ; TODO: break the endless loop
|
||||
movzx eax, word [pasv_end]
|
||||
movzx ebx, word [pasv_start]
|
||||
sub eax, ebx
|
||||
inc eax
|
||||
mov [ebp + thread_data.pasv_tries], eax ; number of ports in the range
|
||||
|
||||
.next_port:
|
||||
call nextpasvport
|
||||
mov ax, [pasv_port]
|
||||
xchg al, ah
|
||||
@@ -855,7 +862,16 @@ cmdPASV:
|
||||
|
||||
mcall bind
|
||||
cmp eax, -1
|
||||
je .next_port
|
||||
jne .bound
|
||||
dec dword [ebp + thread_data.pasv_tries] ; only count a port once bind failed
|
||||
jnz .next_port
|
||||
|
||||
; The range is exhausted, do not spin here forever
|
||||
call close_data_sock
|
||||
call close_pasv_sock
|
||||
jmp socketerror
|
||||
|
||||
.bound:
|
||||
|
||||
; And set it to listen!
|
||||
mcall listen, , 1
|
||||
|
||||
@@ -172,6 +172,14 @@ start:
|
||||
invoke ini.get_int, path, str_pasv, str_end, 5000
|
||||
mov [pasv_end], ax
|
||||
|
||||
; an inverted range would leave no port to bind, fall back to the defaults
|
||||
mov ax, [pasv_start]
|
||||
cmp ax, [pasv_end]
|
||||
jbe @f
|
||||
mov word [pasv_start], 2000
|
||||
mov word [pasv_end], 5000
|
||||
@@:
|
||||
|
||||
mov [alive], 1
|
||||
|
||||
mainloop:
|
||||
|
||||
Reference in new issue
Block a user