Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

bad

Simple netstat alike for TCP only in Ruby
Tuesday, 23 November 2010 11:12
Very simple netstat alike script for TCP only written in Ruby ...


!#/usr/bin/env ruby

PROC_NET_TCP = '/proc/net/tcp' # This should always be the same ...

TCP_STATES = {
'00' => 'UNKNOWN', # Bad state ... Impossible to achieve ...
'FF' => 'UNKNOWN', # Bad state ... Impossible to achieve ...
'01' => 'ESTABLISHED',
'02' => 'SYN_SENT',
'03' => 'SYN_RECV',
'04' => 'FIN_WAIT1',
'05' => 'FIN_WAIT2',
'06' => 'TIME_WAIT',
'07' => 'CLOSE',
'08' => 'CLOSE_WAIT',
'09' => 'LAST_ACK',
'0A' => 'LISTEN',
'0B' => 'CLOSING'
}

SINGLE_ENTRY_PATTERN = Regexp.new(
/^\s*\d+:\s+(.{8}):(.{4})\s+(.{8}):(.{4})\s+(.{2})/
)

File.open(PROC_NET_TCP).each do |i|
i = i.strip
if match = i.match(SINGLE_ENTRY_PATTERN)

local_IP = match[1].to_i(16)
local_IP = [local_IP].pack("N").unpack("C4").reverse.join('.')

local_port = match[2].to_i(16)

remote_IP = match[3].to_i(16)
remote_IP = [remote_IP].pack("N").unpack("C4").reverse.join('.')

remote_port = match[4].to_i(16)

connection_state = match[5]
connection_state = TCP_STATES[connection_state]

puts "#{local_IP}:#{local_port} " +
"#{remote_IP}:#{remote_port} #{connection_state}"

end
end

exit(0)


Simple use-case:


krzysztof@desktop:~$ ./netstat.rb | grep LISTEN | sort
0.0.0.0:17500 0.0.0.0:0 LISTEN
0.0.0.0:2049 0.0.0.0:0 LISTEN
0.0.0.0:21 0.0.0.0:0 LISTEN
0.0.0.0:22 0.0.0.0:0 LISTEN
0.0.0.0:39080 0.0.0.0:0 LISTEN
0.0.0.0:44274 0.0.0.0:0 LISTEN
127.0.0.1:25 0.0.0.0:0 LISTEN
127.0.0.1:4096 0.0.0.0:0 LISTEN
127.0.0.1:4097 0.0.0.0:0 LISTEN
127.0.0.1:631 0.0.0.0:0 LISTEN
127.0.0.1:7634 0.0.0.0:0 LISTEN
127.0.0.1:8192 0.0.0.0:0 LISTEN


You may re-use this code to do something else ... i.e. write Puppet fact or something ...

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/N21eH4t2KNU/12653

 
Sharp's Glassesless 3D Phone Will Hit the US Next Year [Cellphones]
Wednesday, 17 November 2010 09:00
Not just the US, but China and India as well. They haven't said which glassesless 3D phone it'll be, but we've gone on the record as saying their 3D isn't too bad. You know, for a novelty. [Mainichi via 3D-Display-Info] More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/div1BNIVGgw/sharps-glassesless-3d-phone-will-hit-the-us-next-year

 
Is MySpace About to Get Shut Down? [Deathwatch]
Thursday, 04 November 2010 04:20
How bad is the situation for MySpace right now? Pretty bad: Not only is the social networking site losing tons of money, but the chief operating officer of its parent company wants it to rebound "in quarters, not in years." More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/gSuhaDrLaQc/is-myspace-about-to-get-shut-down

 
Boxee Getting Vudu Streaming HD Movie Rentals [Boxee]
Thursday, 28 October 2010 10:39
The D-Link Boxee Box (in addition to Boxee clients for PC and Mac) will offer HD movie rentals when it lands in living rooms in coming weeks, courtesy of a new partnership with Vudu. Vudu's full HD rentals—1080p, Dolby Digital Plus 5.1 Surround Sound—cost 2 bucks a pop for two nights of viewing. Not a bad service to add to Boxee's arsenal, not bad at all. [Press Release] More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/Uwgyg0w2mXI/boxee-getting-vudu-streaming-hd-movie-rentals

 
This Is Sony's $1399 Google TV-Powered Internet TV [Googletv]
Tuesday, 12 October 2010 20:37
We're live at Sony's Internet TV press conference, where we're seeing the "world's first HDTV powered by Google TV" (and its gnarly remote). Not bad at all, $1400 for the 46-inch model, available this weekend. Updated. More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/U66PV_aQgP0/were-about-to-meet-sonys-internet-tv

 
2
Next
End


Page 2 of 2
Taxonomy by Zaragoza Online