Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#77180 - 02/03/2002 17:41 Something I'd like to write...
theory
new poster

Registered: 03/01/2002
Posts: 49
Loc: Victoria, BC, Canada
Here's something I'd like to write, but I don't have the h4x0ring skillz:

A program that reads /proc/net/tcp, pulls out the remote ip addresses, converts them from hex to dec, and displays them.

It'd be nice to have something like this built into hijack, and I was thinking about downloading Marks path file and doing it myself but a) I ran into troubles reading from /proc/net/tcp b) I don't know how to format using C. And finally c) I don't know how to write a HEX->DEC converter.

Can anyone offer any assistance?

Thanks
theory

Top
#77181 - 02/03/2002 18:56 Re: Something I'd like to write... [Re: theory]
kimbotha
member

Registered: 30/08/2000
Posts: 157
Loc: London, UK
Is this something you want to write just to have written it...? or do you have some use for it...? Currently you can see the IP address of the empeg in the about screen under the player menus... scroll down and it will give you the serial number of the player and its current IP address...

Cheers

Kim
(can't remember the exact menu items as my empeg is not in front of me...)

Top
#77182 - 03/03/2002 00:30 Re: Something I'd like to write... [Re: kimbotha]
theory
new poster

Registered: 03/01/2002
Posts: 49
Loc: Victoria, BC, Canada
I already knew that you could find out what the ip address of the empeg is. I'd like to find out what the ip addresses are of the machines that are connected to it. i.e. people streaming, browsing and ftping into it.

Top
#77183 - 03/03/2002 02:47 Re: Something I'd like to write... [Re: theory]
TheAmigo
enthusiast

Registered: 14/09/2000
Posts: 363
Give this a try.

It reads from /proc/net/tcp and reformats to decimal numbers.

If you run it without any args, it prints the current status and exits.

The way it's intended to be run is by specifying the name of a fifo as its only arg. Before you run it, do this:

mkfifo /tmp/netstat
(or wherever you want)
then run: hex2dec /tmp/netstat
it will sit waiting for someone to read from /tmp/netstat. When you do, it will convert the current contents of /proc/net/tcp and display them, then it goes back to waiting for another read request. This way, you just background the prog and then you can browse to your empeg at: http://empeg/tmp/netstat and hit refresh in your browser to get an update.

Everytime I click refresh, I see another connection get used... seems a bit odd, I'm not sure what's wrong. So if I click refresh 30 times, the empeg has 30 network connections in use.

When I finish a bit of cleanup, I'll release the source... nothing fancy, just a quick hack without any comments.


Attachments
74990-hex2dec (183 downloads)

_________________________
--The Amigo

Top
#77184 - 04/03/2002 20:20 Re: Something I'd like to write... [Re: TheAmigo]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14491
Loc: Canada
Mmm.. I wonder if somebody could go and hack that into the XML homepage package from Charcoal-whatssissname?

-ml

Top
#77185 - 04/03/2002 20:39 Re: Something I'd like to write... [Re: mlord]
charcoalgray99
enthusiast

Registered: 14/05/2001
Posts: 279
I'd rather have a separate XML for system information. I think that would be a much cleaner solution. Displayserver had a sysinfo page which showed things like temp, serial number, ac/dc power, process table, netstat. I'd like to be able to have all of that info, and format it with my stylesheet.

Tom

Top
#77186 - 04/03/2002 20:40 Re: Something I'd like to write... [Re: charcoalgray99]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14491
Loc: Canada
Well, it's all under /proc ... somewhere.

Top
#77187 - 04/03/2002 20:44 Re: Something I'd like to write... [Re: mlord]
charcoalgray99
enthusiast

Registered: 14/05/2001
Posts: 279
I didn't think it was possible to grab the /proc info from javascript, or is it?

Tom

Top
#77188 - 04/03/2002 20:50 Re: Something I'd like to write... [Re: charcoalgray99]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14491
Loc: Canada
I dunno. It just looks like a bunch of files to any web browser.

Top
#77189 - 04/03/2002 20:57 Re: Something I'd like to write... [Re: mlord]
charcoalgray99
enthusiast

Registered: 14/05/2001
Posts: 279
Well, I'd like to include system info in my XML package. I'm sure other people would find the feature useful also. But without an XML/XSLT output, I don't have a way to format it to look pretty.

Tom

Top
#77190 - 04/03/2002 20:59 Re: Something I'd like to write... [Re: charcoalgray99]
theory
new poster

Registered: 03/01/2002
Posts: 49
Loc: Victoria, BC, Canada
That's a great idea. pull it using javascript. you'd probably have to load it into a separate frame or something, but that's easily doable.

Top
#77191 - 04/03/2002 21:49 Re: Something I'd like to write... [Re: theory]
charcoalgray99
enthusiast

Registered: 14/05/2001
Posts: 279
Hmm, I spent some time on google and couldn't find an example that did anything like this. Can anyone help here?

Tom

Top
#77192 - 04/03/2002 22:00 Re: Something I'd like to write... [Re: charcoalgray99]
TheAmigo
enthusiast

Registered: 14/09/2000
Posts: 363
I don't know javascript. Is it complete enough of a language to do the hex to decimal conversion and text formatting? If so, then it sounds like a good plan. It'd be much more user friendly if you could just have a local .js file do the conversion and display rather than needed another prog running on the empeg.

If anyone wants to do it in JS (or anything else), here's my C source for the above prog. Feel free to copy any code that would be useful.


Attachments
75610-hex2dec.c (172 downloads)

_________________________
--The Amigo

Top
#77193 - 04/03/2002 22:16 Re: Something I'd like to write... [Re: charcoalgray99]
theory
new poster

Registered: 03/01/2002
Posts: 49
Loc: Victoria, BC, Canada
I'm pretty sure it's doable. I know javascript can convert hex to decimal. and I remember doing x-frame scripting, but it was so long ago I forgot how to do it.

Top