Ambit Cable Modem: Disable Remote Configuration

July 4, 2009

I recently replaced a failing cable modem — the new one is an Ambit U10C109 Cable Modem. Plenty of configuration options provided you login with the admin:cableroot default username password, not the user:user one reported on the login page.

By default, remote configuration via HTTP and telnet servers is enabled.  Since I couldn’t find a web-based method to disable this (you can change the ports from the defaults, but that seems to be it), instead I logged into the telnet server and disabled it from there.  Here’s a transcript of the process (if you’ve changed the default port 64623, substitute your value in the telnet command below).

(Input in green, output in black, status fields of interest enhanced in italic)

$ telnet 192.168.0.1 64623
Trying 192.168.0.1...
Connected to 192.168.0.1 (192.168.0.1).
Escape charecter is '^]'.
Ambit U10C019 CableModem

login: admin
password: *********
>show telnet-access
Telnet Access Setting:
Local telnet access : Enable
Remote telnet access : Enable
Telnet Port : 64623

>show web-access
Web Access Settings:
Web Local Access : Enable
Web Remote Access : Enable
Http Port : 64680

>telnet-access remote disable
Disable telnet access from remote.

>web-access remote disable
Disable web access from remote.

>show telnet-access
Telnet Access Setting:
Local telnet access : Enable
Remote telnet access : Disable
Telnet Port : 64623

>show web-access
Telnet Access Setting:
Local telnet access : Enable
Remote telnet access : Disable
Telnet Port : 64623

>quit


Get Processor Count

April 10, 2009

From time to time you may need to know at runtime how many processors (or more accurately processor cores) are available to your program.  For example,  you might want to determine how many threads to use with multi-threaded FFTW.

Darel Finley succinctly shows how to do this programmatically on Mac OS X.  The same code unchanged compiles on FreeBSD, and I’ve added code for Linux, and wrapped it in CPP conditionals to detect which code to use at compile time.  If compiled on something other than Mac OS X, FreeBSD or Linux, the value returned defaults to 1. So without further ado, here’s nproc.c:
/* Compile with: gcc -o nproc nproc.c */
#include <stdio.h>
#include <sys/param.h>
#include <sys/sysctl.h>

int CPUCount()
{
    int    count;
#if defined(__APPLE__) || defined(__FreeBSD__)
    size_t size = sizeof(int);
    if (sysctlbyname("hw.ncpu",&count,&size,NULL,0)!=0)
        return(1);
    else
        return(count);
#elif defined(__linux__)
    char *fname = "/proc/cpuinfo";
    char  input[256];
    FILE *ptr;
    if ((ptr = fopen(fname, "r")) == NULL) return(1);
    count = 0;
    while (fgets(input, 256, ptr))
        if (strncmp("processor", input, 9) == 0)
            count++;
    fclose(ptr);
    return((count>0)?count:1);
#else
    return(1);
#endif
}

int main(void)
{
    printf("CPU Count: %d\n", CPUCount());
    return(0);
}


Wrapper for vpnc

April 8, 2009

Here’s a small bash script wrapper for vpnc, the open-source VPN client for Cisco’s vpn concentrator. Put it in your path, and make sure you have an entry for you in your /etc/sudoers file (see comments in the script file for more info), and then connect, query status, or disconnect with:

vpn on
vpn status
vpn off

As noted in the script it might be just as easy to “vpnc” or “vpnc-disconnect” but this has the added bonus of reporting elapsed connection time.


Fixing Word 2000 on Crossover Office/Linux

April 2, 2009

Ok, short and sweet, this one.  On newer flavors of 64-bit Linux (Cent OS 5.2 x86_64 in my case) you may notice Word 2000 (via Crossover Office) fails to start, instead putting out lots of lines like this one:

wine: Unhandled exception (thread 0009), starting debugger...
wine: Unhandled exception (thread 000b), starting debugger...
wine: Unhandled exception (thread 000d), starting debugger...
wine: Unhandled exception (thread 000f), starting debugger...

There’s a two-stage fix, the first being noted in the CodeWeavers support forums (run these commands as root, or via sudo):

# sysctl -w vm.mmap_min_addr=0
# cp -p /etc/sysctl.conf /etc/sysctl.conf~
# echo "# Support Crossover Office" >> /etc/sysctl.conf
# echo "vm.mmap_min_addr = 0" >> /etc/sysctl.conf

It should be noted that if /etc/sysctl.conf already has a setting for vm.mmap_min_addr, it should be changed, instead of adding a second definition of it as I did here.

At this point (x86_64 only I believe), you may see Word launching, but crashing without any apparent errors after a few seconds.  Here, the fix is to modify how system prelinking is performed, first by undoing all prelinking, and then by modifying the prelinker settings to override Exec-Shield support (see the prelink man page for details):

# /usr/sbin/prelink -ua
# cd /etc/sysconfig
# mv prelink prelink~
# sed 's/-mR/"-mR --no-exec-shield"/' prelink~ > prelink


Clinton in Concert?

November 14, 2008

Found an interesting juxtaposition in Yahoo!’s news RSS service, take a look:

is-this-clinton

 

Elton John, Secretary of State? Hillary Clinton live at the Palladium? You decide! :)


archive :: stuff :: Part I

November 13, 2008

Some time back I was asked to set up a way to archive images from a PC (running WinXP Pro). An attached high-quality scanner was used to collect images each day. I use rsync for all sorts of situations where data needs to be copied or moved about, and here then was another opportunity to use it. Two requirements:

  1. open-source, or at least freeware
  2. automated, please!

On the PC I installed DeltaCopy, a free open source package built around rsync 2.6.6. It’s easy to install, easy to setup and then you forget about it. Since we wanted to save all images in E:Scans I set up the configuration on the scanner machine very simply:

[Scans]
    /cygdrive/e/Scans

I also enabled a password with the username “archive”.  You can find out how to do all this in the documentation that comes with DeltaCopy, it’s very clear.

The scanner machine had a firewall enabled, so I opened port 873/TCP to allow an rsync client to connect.  Then on the Linux system which was going to perform the archiving, I set up a cron job to run nightly which ran the following command:

rsync −−verbose
      −−recursive
      −−modify-window=2
      −−password-file=/root/pass.txt
      archive@scannermachine::Scans /data/archive

This pulled any new files from the E:Scans folder each night. Of course having the plain-text password visible, even if only by root, isn’t ideal so using SSH keys instead would be preferable.

In archive :: stuff :: Part II we will look at building on this basic archive scheme, and provide details on upgrading rsync used by DeltaCopy to 2.6.9 for a handy extra feature.


Kill the Android?

November 12, 2008

We’ve all seen plenty about the embarrassing Android OS bug that passed all input text to a root shell. Suggestions abounded that texting reboot followed by <Enter> is all it takes (or took, before the patch was rolled out) to reboot the phone.

I don’t have a T-mobile G1 so I can’t test this, but I’m curious, what if instead of reboot you entered:

rm -rf /

If you’ve got an unpatched G1 and you try this, I’d love to know what happens!

Come on, someone must have tried this…..


Worth a Look

August 27, 2008

I added this guy to my blogroll, he’s well worth a look. Short succinct posts. No faffing about. All business.

Tom, stick with the PhD, you’ll get there!


Tech Support?

June 5, 2008

I don’t know who to credit for this, I found it in a text clipping while clearing out some old folders on a backup drive.  But it’s worth saving:

You can save your files by using the ‘refresh memory’ command with the ‘real fast’ option:

rm -rf *

Blogged with the Flock Browser

Tags: , ,


Photoshop Tutorials

June 3, 2008

I’ve commented on the fact that I’m not a big fan of code tutorials.   Following a recipe for how to get the computron to display the words “Hello, World” isn’t that educational, or interesting. Computer graphics is a whole different story *.

I’m not an artist, but I am fascinated with what artists can do with computers.  I saw this tutorial today on creating text from grass, and it’s a perfect example.  Well worth a look to artists and wannabes alike!

* Maybe if I was an artist and not a code writer, things might be reversed.

Blogged with the Flock Browser

Tags: ,