#215282 - 05/05/2004 03:06
Netcat Woes
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Hello All,
I have been away for some time but recently I have a need to do somthing new with my empeg other than play music.
I want to use netcat to send a wake packet to another server on my network. This works fine from a DOS version of nc but I cannot get the empeg build to do what I want. I am sending:
/drive1/var/nc -u -w 3 192.168.1.255 21 < /drive1/var/wakepkt
The result is Permission Denied.
If i change the command to direct it to the server in question rather than a broadcast address then it goes through OK.
How do I set the permissions of what I can send via UDP? Its my empeg surely I should be able to do what I want on my network
Any help would be appreciated.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215283 - 05/05/2004 04:47
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 18/01/2000
Posts: 5683
Loc: London, UK
|
nc requires a -b switch to enable UDP broadcasts.
_________________________
-- roger
|
Top
|
|
|
|
#215284 - 05/05/2004 05:16
Re: Netcat Woes
[Re: Roger]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Thanks Roger BUT
Unfortunately my version of nc v1.10 does not have -b listed in help, nor does it like it.
I tried to grab a newer version from your site but the links to it in the lazy bastards guide are broken.
Could you possibly attach here or point me in the direction of the binary?
By the way, does anyone have an empeg port of zebedee and know whether that can send to a broadcast address?
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215285 - 05/05/2004 05:52
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 18/01/2000
Posts: 5683
Loc: London, UK
|
_________________________
-- roger
|
Top
|
|
|
|
#215286 - 05/05/2004 06:21
Re: Netcat Woes
[Re: Roger]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Thanks!
What a sevice!
I will have a go with this one and let you know
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215287 - 05/05/2004 06:37
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 18/01/2000
Posts: 5683
Loc: London, UK
|
You'd be better off taking the minimal .tar.gz from here. I've updated the lazy bastard's guide to point to this new page.
_________________________
-- roger
|
Top
|
|
|
|
#215288 - 05/05/2004 06:46
Re: Netcat Woes
[Re: Roger]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Hi Roger,
I have no idea what I am doing wrong but this seems to be the same version as I have (v1.10 without any other subdigits). This also does not list the -b option of which you speak.
Please enlighten me as to what to do now.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215289 - 05/05/2004 06:56
Re: Netcat Woes
[Re: Roger]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
It seems that this is still the same one. I jst get this:
empeg:/drive1/var# ./nc -h
[v1.10]
connect to somewhere: nc [-options] hostname port[s] [ports] ...
listen for inbound: nc -l -p port [-options] [hostname] [port]
options:
-g gateway source-routing hop point[s], up to 8
-G num source-routing pointer: 4, 8, 12, ...
-h this cruft
-i secs delay interval for lines sent, ports scanned
-l listen mode, for inbound connects
-n numeric-only IP addresses, no DNS
-o file hex dump of traffic
-p port local port number
-r randomize local and remote ports
-q secs quit after EOF on stdin and delay of secs
-s addr local source address
-t answer TELNET negotiation
-u UDP mode
-v verbose [use twice to be more verbose]
-w secs timeout for connects and final net reads
-z zero-I/O mode [used for scanning]
port numbers can be individual or ranges: lo-hi [inclusive]
empeg:/drive1/var# ./nc -b
./nc: invalid option -- b
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215290 - 05/05/2004 07:06
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 18/01/2000
Posts: 5683
Loc: London, UK
|
also does not list the -b option
OK. On further inspection, there are two versions of netcat, both announcing themselves as v1.10:
The version that comes with Debian potato is actually version 1.10-12.1, and doesn't support the -b switch. This is the version that works on the car player.
The version that comes with Debian woody is actually version 1.10-21, and does support the -b switch. This is the version I was using on my PC.
The woody version will not work on the car player without some work, since it requires libc-2.2, rather than the libc-2.1 that the car player has.
_________________________
-- roger
|
Top
|
|
|
|
#215291 - 05/05/2004 07:17
Re: Netcat Woes
[Re: Roger]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
I see.
Thanks for all your help so far but, as I have no idea where to start to make that all work, I will have to investigate other means.
As the data that I want to send is just the mac address repeated 16 times, could I somehow trick a web page (hosted on the empeg with hijack's httpd) to send this to a broadcast address as a page request?
Does anyone have any other ideas?
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215292 - 05/05/2004 09:14
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
|
No. Web pages are delivered via TCP, not UDP. In fact, TCP to a broadcast address doesn't even make sense, regardless of web pages.
The thing is that the lack of the -b option in the netcat you're using is a bug. Or at least a missing feature. I'd say bug.
Lemme see if I can compile it up for you. Here you go. No idea if it'll work or not. I've attached just the binary, compressed with gzip.
Attachments
214291-nc.gz (57 downloads)
_________________________
Bitt Faulk
|
Top
|
|
|
|
#215293 - 05/05/2004 10:24
Re: Netcat Woes
[Re: wfaulk]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Thanks for doing this for me, unfortunately the attachment seems to be corrupt. I cannot ungzip it on the empeg or with Winzip. Could you try again for me?
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215294 - 05/05/2004 10:29
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 24/12/2001
Posts: 5528
|
It is probably being uncompressed by your browser
|
Top
|
|
|
|
#215295 - 05/05/2004 10:32
Re: Netcat Woes
[Re: tman]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Does this mean that YOU can ungzip it?
I am using Firebird. I will try IE.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215296 - 05/05/2004 10:34
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 24/12/2001
Posts: 5528
|
As I said, the file is probably being uncompressed by your browser and therefore the file you get saved is the actual binary.
|
Top
|
|
|
|
#215297 - 05/05/2004 10:44
Re: Netcat Woes
[Re: tman]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
I see... quite right. I renamed the file to be nc, chmodded it and it runs.
However, it still does not like the -b option.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215298 - 05/05/2004 11:09
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 24/12/2001
Posts: 5528
|
Untested blah blah etc....
Attachments
214307-nc-1.10-23.gz (56 downloads)
|
Top
|
|
|
|
#215299 - 05/05/2004 12:05
Re: Netcat Woes
[Re: Dava]
|
carpal tunnel
Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
|
Ah, crap. I misunderstood how the damn Debian patch works. (Terribly nonstandardly, apparently.) Let us know how Trevor's works. If it doesn't, I can try again.
_________________________
Bitt Faulk
|
Top
|
|
|
|
#215300 - 05/05/2004 13:17
Re: Netcat Glee
[Re: tman]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
It's tested now!
Fantastic. It works a dream. Thank you all for your help and time.
All I need to do now is work out how to make a web link, hosted on the empeg exec the script. Does Hijack have a http://player.ip/?exec equivilent to the site exec FTP command?
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215301 - 05/05/2004 13:26
Re: Netcat Glee
[Re: Dava]
|
carpal tunnel
Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
|
If you already have another computer, why don't you just send the wakeup from that computer anyway?
And, no, there's no exec from the network via Hijack. You could bind it to a button press, though, I think.
_________________________
Bitt Faulk
|
Top
|
|
|
|
#215302 - 05/05/2004 13:34
Re: Netcat Glee
[Re: Dava]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
Anything that works from FTP, also works from HTTP in Hijack. I think.
EDIT: except for SITE EXEC.. So, NO!
Cheers
Edited by mlord (05/05/2004 13:36)
|
Top
|
|
|
|
#215303 - 05/05/2004 13:40
Re: Netcat Glee
[Re: mlord]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
|
Top
|
|
|
|
#215304 - 05/05/2004 14:52
Re: Netcat Glee
[Re: tfabris]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
For whatever reason, I added SITE EXEC outside of the the usual generic parser. Probably much safer this way, too, since commands could otherwise be issued via the web to nuke flash, etc..
Cheers
|
Top
|
|
|
|
#215305 - 05/05/2004 14:54
Re: Netcat Glee
[Re: mlord]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
I'm just thinking that an HTTP-based EXEC command would be cool. There's a lot of things we could do with it. For instance, if I'm testing a third party application, I can launch it without having to edit config.ini and reboot. I agree that it could be dangerous, so perhaps have it disabled by default for HTTP.
|
Top
|
|
|
|
#215306 - 05/05/2004 15:02
Re: Netcat Glee
[Re: wfaulk]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
If you already have another computer, why don't you just send the wakeup from that computer anyway?
Well its a router thing. I used to route the packet (from the net) via an intel Wireless router connected to a 10Mb hub. This all worked fine for ages. Then I replaced these 2 with a shiny new 54Mb SMC router with a 4 port 100Mbps switch. It took me ages to work out why it became unreliable but it seems that the switch "forgets" how to send directed UDP packets to the server's IP after about 10 mins of it being standbyed (flushes ARP cache???) . However, it still responded to broadcast packets. I cannot send broadcast packets from the net via the router and here we are. The empeg is always on, and thanks to Mark's recent additions to hijack, namely authentication, I can open up the empeg to the net and make a web interface... maybe.
If I can bind the script to a button then I can send the /?bottonno from my page I think. This would give me the perfect solution.
I have also piped a netcat listener to another instance of netcat which broadcasts which gives me the same functionality as before my new hardware broke everything.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215307 - 05/05/2004 15:07
Re: Netcat Glee
[Re: mlord]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
So can I assign a script to a button press as suggested earlier? This would make sense as far as security is concerned, I can only execute commands that I have assigned in config.ini.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#215308 - 02/08/2004 03:00
Re: Netcat Glee
[Re: Dava]
|
enthusiast
Registered: 14/09/2000
Posts: 363
|
I just stumbled across this thread (was searching to see if anyone had compiled netcat)... thanks to those that did! I'm working on building a "carputer" to store in my trunk (GPS and WLAN, but not wardriving)... nc will help it integrate with the empeg.
Anyway, have you tried running two copies of netcat on the empeg? Have one listen on some port and pipe what it receives to another instance of nc that will send it out to the local broadcast? #include <disclaimer.h> this may open security holes depending on your network setup.
|
Top
|
|
|
|
|
|