Wednesday, November 14, 2007
First Gen Zune Firmware Update
I don't know anyone who has covered this topic on how to update your zune to the latest firmware. It's very simple, go to zune.net and get the new software front end. Once you have installed that over your old front end, plug in your first get Zune. It will automatically detect that you need to update your firmware. Once you tell it to begin, the process takes approx 8-10 minutes. That's it!
Friday, November 9, 2007
Compiling a Custom Kernel for Ubuntu
- Install necessary packages:
- apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
- Download the kernel sources from www.kernel.org
- Extract them
- ln -s linux-kernel-version linux
- change directory into "linux"
- Copy the current kernel's config:
- cp /boot/config-`uname -r` ./.config
- Start the GUI kernel configuration
- make menuconfig
- Save the config
- Start the compile
- make-kpkg clean
- fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
- After it's done compiling, which may take 30 minutes or much more you will have to .deb packages in the /usr/src directory, install them
- dpkg -i kernel-image-2.6.23-custom_10.00.Custom_i386.deb
- dpkg -i kernel-headers-2.6.23-custom_10.00.Custom_i386.deb
- verify that the entries are in grub
- vi /boot/grub/menu.lst
- reboot
Friday, November 2, 2007
Regular Expression Generator for IP Addresses
Very useful if you want to match something for a particular range of IPs:
http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55572
http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55572
Monday, October 29, 2007
Sorting IP Addresses with Linux/Unix "sort"
Recently I was doing a site survey of all active IPs on our network. I used nmap for this function and dumped all responding IP addresses to a text file. I don't have to worry about PC's not responding to the ping due to a personal firewall since our PC's here do not have one turned on; they are all protected by our corporate firewall. To find all responding IP's I ran the following command line for nmap:
IP addresses are a strange animal, they aren't really "numbers" per se due to multiple decimal points and they aren't really words, they are a sort of hybrid. Because of this using sort without so pretty specific command line arguments won't give you what you want, which is numerically proper sorting.
Also, nmap outputs a bunch of junk text which I'm not interested in at all, I want this removed and just want the IP addresses themselves. Since I've done this survey over and over again I'm going to have dozens of the same IP address show up in the file, I only want to see it listed once. After all is said and done this is the command line I finished with to give me the output I was looking for:
From there I can do with it what I like. ;)
/usr/bin/nmap -n -sP xxx.xxx.xxx.xxx-xxx xxx.xxx.xxx.xxx-xxx >> /home/myUserName/IPdb/site1IPsUp.txtI did this for several times a day, several days a week for a couple weeks to make sure I had gotten the most complete picture possible, then I tried to sort them...
IP addresses are a strange animal, they aren't really "numbers" per se due to multiple decimal points and they aren't really words, they are a sort of hybrid. Because of this using sort without so pretty specific command line arguments won't give you what you want, which is numerically proper sorting.
Also, nmap outputs a bunch of junk text which I'm not interested in at all, I want this removed and just want the IP addresses themselves. Since I've done this survey over and over again I'm going to have dozens of the same IP address show up in the file, I only want to see it listed once. After all is said and done this is the command line I finished with to give me the output I was looking for:
cat site1IPsUp.txt | grep -v Nmap | grep -v Starting | awk '{ print $2 }' | sort -u -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
From there I can do with it what I like. ;)
Labels:
awk,
cat,
grep,
IP address,
Linux,
nmap,
site survey,
sort,
Unix
Wednesday, October 3, 2007
Enabling Windows 2000/XP "File and Printer Sharing" at the Command Line
I've searched high and low and there does not seem to be any way to enable Windows File and Printer Sharing without having someone actually perform the function of clicking the stupid check box. Yes, I've gone through the registry and even did the ol' regmon trick to see what windows was modifying, nothing was obvious. Recently this problem has cropped up again causing me to renew my search for an answer, and an answer I found!
The key here is a little program called "snetcfg" which allows you to add or remove services to the windows networking system. I'm assuming snetcfg stands for "service net configurator" or something like that. Now, this program in itself can't actually check that little box that we've been discussing rather we are going to leverage some of windows' default behaviors against it.
When windows installs a service it enables it by default, what we will be accomplishing with snetcfg is that we will be uninstalling the File and Printer Sharing service and then re-installing it. Once Windows has re-installed the service it enables it by default.
Here's how we do it:
The key here is a little program called "snetcfg" which allows you to add or remove services to the windows networking system. I'm assuming snetcfg stands for "service net configurator" or something like that. Now, this program in itself can't actually check that little box that we've been discussing rather we are going to leverage some of windows' default behaviors against it.
When windows installs a service it enables it by default, what we will be accomplishing with snetcfg is that we will be uninstalling the File and Printer Sharing service and then re-installing it. Once Windows has re-installed the service it enables it by default.
Here's how we do it:
- Grab snetcfg.zip
- The command line to uninstall Win2K File and Printer Sharing Service is:
- snetcfg.exe -v -u MS_Server
- The command line to re-install Win2K File and Printer Sharing Service is:
- snetcfg.exe -l %windir%\Inf\NETSERV.INF -c s -i MS_Server
Tuesday, October 2, 2007
Force Linux File System Check on Next Reboot
Sometimes you just want to have the system check itself nextime the system reboots, to do that:
As root type:
As root type:
touch /forcefsckOn the next reboot the filesystem will see the empty file called "forcefsck" in the root partition, this will trigger a full scale disk check.
Force a Kernel Reboot the Not Nice Way
If you use Linux and rely on it every day there will be a day that comes where you will utterly screw yourself. What I mean is you can get a shell but nothing else works...and you're 1000 miles away. So how do you unscrew yourself?
echo 1 > /proc/sys/kernel/sysrqThis sends a kernel message to reboot the machine. Now this is a horrible, horrible way to reboot, it's essentially like hitting the reset switch. It does not allow the system to unmount drives or run cleanup scripts, so once things are back up you may have some housekeeping to do.
echo b > /proc/sysrq-trigger
Subscribe to:
Posts (Atom)