#!/usr/bin/puppybasic
include "/usr/lib/wxbasicscript/basefunctions.inc"

shell("adsl-status > /tmp/adsltraffic.tmp")

tmp = readfiletolist("/tmp/adsltraffic.tmp")
removefile("/tmp/adsltraffic.tmp")

for each theline in tmp

if instr( theline , "inet addr") > 1 then

  ip = cutleft( theline , ":")
  ip = cutrightfromleft( ip , " ")

end if

if instr( theline , "bytes") > 1 then

  received = cutleft( theline , ":")
  received = cutrightfromleft( received , " ")

  sent = cutleft( theline , "TX bytes:")
  sent = cutrightfromleft( sent , " ")

end if


next

Sum = (sent + received) / 1000000

xmessage( " -nearmouse " & ip & " received: " & received & " sent: " & sent)
xmessage( " -nearmouse Summe:" & Sum & " MB")
