Compare commits
3 Commits
nat_runner
...
trunk
Author | SHA1 | Date |
---|---|---|
BraydonKains | 6bad2a5465 | 5 years ago |
BraydonKains | fdc98af9cc | 5 years ago |
BraydonKains | 30f642ceaa | 5 years ago |
@ -1,14 +0,0 @@
|
|||||||
# Am I going to use this? Probably not tbh
|
|
||||||
enum State
|
|
||||||
LISTEN
|
|
||||||
ESTABLISHED
|
|
||||||
SYN_SENT
|
|
||||||
SYN_RECV
|
|
||||||
LAST_ACK
|
|
||||||
CLOSE_WAIT
|
|
||||||
TIME_WAIT
|
|
||||||
CLOSED
|
|
||||||
CLOSING
|
|
||||||
FIN_WAIT1
|
|
||||||
FIN_WAIT2
|
|
||||||
end
|
|
@ -1,14 +0,0 @@
|
|||||||
require "../modules/command_runner"
|
|
||||||
require "../records/nat_record"
|
|
||||||
|
|
||||||
class NatOperator
|
|
||||||
def initialize(nat_data = "")
|
|
||||||
if nat_data.empty?
|
|
||||||
nat_data = CommandRunner.run_nat
|
|
||||||
end
|
|
||||||
records = nat_data.each_line
|
|
||||||
records = records.each.select(/^tcp/)
|
|
||||||
@nat_records = Array(NatRecord).new
|
|
||||||
records.each { |s| @nat_records << NatRecord.new s }
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,33 +0,0 @@
|
|||||||
require "../modules/record_helpers"
|
|
||||||
|
|
||||||
class NatRecord
|
|
||||||
getter proto : String
|
|
||||||
getter recv_q : Int
|
|
||||||
getter send_q : Int
|
|
||||||
getter address : String
|
|
||||||
getter port
|
|
||||||
getter f_address : String
|
|
||||||
getter f_port : String
|
|
||||||
getter state : String
|
|
||||||
|
|
||||||
def initialize(record : String)
|
|
||||||
tok_record = RecordHelpers.clean_record(record)
|
|
||||||
|
|
||||||
@proto = tok_record[0]
|
|
||||||
@recv_q = tok_record[1].to_i
|
|
||||||
@send_q = tok_record[2].to_i
|
|
||||||
@address, @port = RecordHelpers.ser_address_port(tok_record[3])
|
|
||||||
@f_address, @f_port = RecordHelpers.ser_address_port(tok_record[4])
|
|
||||||
@state = tok_record[5]
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s
|
|
||||||
puts "%s, " * 8 % [
|
|
||||||
@proto,
|
|
||||||
@recv_q, @send_q,
|
|
||||||
@address, @port,
|
|
||||||
@f_address, @f_port,
|
|
||||||
@state
|
|
||||||
]
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,15 +0,0 @@
|
|||||||
Active Internet connections (servers and established)
|
|
||||||
Proto Recv-Q Send-Q Local Address Foreign Address State
|
|
||||||
tcp 0 0 0.0.0.0:27036 0.0.0.0:* LISTEN
|
|
||||||
tcp 0 0 127.0.0.1:57343 0.0.0.0:* LISTEN
|
|
||||||
tcp 0 0 0.0.0.0:60337 0.0.0.0:* LISTEN
|
|
||||||
tcp 0 0 127.0.0.1:27060 0.0.0.0:* LISTEN
|
|
||||||
tcp 0 0 0.0.0.0:57621 0.0.0.0:* LISTEN
|
|
||||||
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN
|
|
||||||
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
|
|
||||||
tcp 0 0 192.168.0.36:45332 172.217.164.206:443 ESTABLISHED
|
|
||||||
tcp 0 0 192.168.0.36:36012 140.82.114.4:443 ESTABLISHED
|
|
||||||
tcp 0 0 192.168.0.36:39648 140.82.113.5:443 ESTABLISHED
|
|
||||||
tcp 0 0 192.168.0.36:35658 149.154.175.53:443 ESTABLISHED
|
|
||||||
tcp 1 0 192.168.0.36:56858 35.186.224.53:443 CLOSE_WAIT
|
|
||||||
tcp6 0 0 :::22 :::* LISTEN
|
|
Loading…
Reference in New Issue