network sniffer
This commit is contained in:
@@ -131,23 +131,21 @@ function Socket.connect(host, port)
|
||||
os.cancelTimer(timerId)
|
||||
|
||||
if msg.type == 'CONN' then
|
||||
|
||||
socket.dport = dport
|
||||
socket.connected = true
|
||||
-- Logger.log('socket', 'connection established to %d %d->%d',
|
||||
-- host, socket.sport, socket.dport)
|
||||
|
||||
_G.transport.open(socket)
|
||||
|
||||
return socket
|
||||
|
||||
elseif msg.type == 'REJE' then
|
||||
socket:close()
|
||||
return false, 'Password not set on target or not trusted'
|
||||
end
|
||||
end
|
||||
until e == 'timer' and id == timerId
|
||||
|
||||
socket:close()
|
||||
|
||||
return false, 'Connection timed out'
|
||||
end
|
||||
|
||||
|
||||
@@ -119,14 +119,8 @@ function Util.signum(num)
|
||||
end
|
||||
end
|
||||
|
||||
function Util.clamp(lo, num, hi)
|
||||
if num <= lo then
|
||||
return lo
|
||||
elseif num >= hi then
|
||||
return hi
|
||||
else
|
||||
return num
|
||||
end
|
||||
function Util.clamp(num, low, high)
|
||||
return num < low and low or num > high and high or num
|
||||
end
|
||||
|
||||
-- http://lua-users.org/wiki/SimpleRound
|
||||
|
||||
Reference in New Issue
Block a user