Saturday, January 20, 2007

UNIX status commands on Solaris

Proc tools:
  • pflags Print the /proc tracing flags, the pending and held signals, and other /proc status information for each lwp in each process.
  • pcred Print or set the credentials (effective, real, saved UIDs and GIDs) of each process.
  • pldd List the dynamic libraries linked into each process, including shared objects explicitly attached using dlopen(3C). See also ldd(1).
  • psig List the signal actions and handlers of each process. See signal.h(3HEAD).
  • pstack Print a hex+symbolic stack trace for each lwp in each process.
  • pfiles Report fstat(2) and fcntl(2) information for all open files in each process. In addition, a path to the file is reported if the information is available from /proc/pid/path. This is not necessarily the same name used to open the file. See proc(4) for more information.
  • pwdx Print the current working directory of each process.
  • pstop Stop each process (PR_REQUESTED stop).
  • prun Set each process running (inverse of pstop).
  • pwait Wait for all of the specified processes to terminate.
  • ptime Time the command, like time(1), but using microstate accounting for reproducible precision. Unlike time(1), children of the command are not timed.
Other commands:
  • arch display system architecture (i86pc)
  • uname print name of current system (SunOS)
  • pagesize display the size of pages of memory
  • iostat report I/O stats for terminal, disk, tape, etc
  • vmstat report virtual memory statistics
  • mpstat report CPU statistics
  • busstat report bus-related support statistics
  • lsof list open files (sockets (lsof -i), etc.) Introductory lsof examples
  • nohup run a command immune to hangups
  • kstat display kernel statistics
While navigating manpages, note that Solaris uses more to view them, which is supremely annoying. Use less with export PAGER="less" (tip found here).

Thursday, January 04, 2007

HOWTO Starcraft/Brood War on Ubuntu Linux Edgy Eft with Wine

One of the (very very very) few things for which I use my Windows partition anymore is playing Starcraft /Brood War. Of course, as anyone that dual-boots knows, restarting your machine just for one Windows application and then back to Linux is highly annoying and time-consuming. One solution to running Windows apps on Linux is Wine, which I will describe how to configure to play SC/BW in this post. I'm using Ubuntu 6.10 (Edgy Eft). Thanks to JTerry for his help with this.

First, you're going to need a few things. Open a terminal and run sudo apt-get install wine to get wine. After that finishes, insert the Starcraft CD. cd to whatever cdrom drive you put the cd in (under the /media/ directory). Use Wine to setup SC with wine setup.exe. You'll get the install screen for SC -- enter your CD key and install the software. The SC executable will be installed under the path of ~/.wine/drive_c/Program\ Files/Starcraft/starcraft.exe. If you try and play SC now, you might notice that the sound does not work. Run winecfg and go to the Audio tab. Set Hardware Acceleration to Emulation. The sound should now work fine. If you want to play Brood War, read on; if not, skip to the next paragraph. Eject the SC CD and insert the BW CD. Again, cd to the appropriate /media/ directory and run wine setup.exe. To play SC/BW, run wine ~/.wine/drive_c/Program\ Files/Starcraft/starcraft.exe.

Playing online over Battle.net requires a little bit more work. First, you'll need the proper fonts that Battle.net uses... sudo apt-get install msttcorefonts for this. You'll also need the newest patch for Battle.net which updates BW to version 1.14. Get this patch here (other patches, for instance for regular SC, can be found here). Use wine to run the downloaded file, BW-114.exe. An updater should run, after which you'll be able to play online using Battle.net. It works, but all is not perfect -- the display of the Battle.net interface is kind of screwed up (it never refreshes when you change views). However, if you're familiar with the Battle.net interface you should be able to get into a game after which SC/BW runs without a hitch.

Some tips: tweak your mouse sensitivity and acceleration to play SC/BW. It runs at a low resolution and your cursor will be uncontrollably flying all over the place if you don't. Change this in System->Preferences->Mouse->Motion. Also, sometimes (rarely) the screen resolution doesn't change back to what you had it at before playing SC/BW. Change this in the System->Preferences->Screen Resolution menu. If you hear a lot of static from your speakers, try switching from OSS to ALSA in winecfg->Audio.

More information on this topic can be found at the Wine Application Database page for SC/BW.

Update: here's another good page on Ubuntu forums

Another update: yet another good page from the Ubuntu community detailing how to enable the 'no CD' patch

Monday, January 01, 2007

Why default settings on your wireless router is a BAD thing

Lots of people recognize that 802.11 wireless networks are really cool and want to have them. They go to Best Buy, grab a Linksys router, run home and, without going through the standard setup, plug the router into their network connection and turn it on. Hopefully you are not one of these people because these people leave their router completely vulnerable to whoever wants to take control of it.

Here, I will show how to discover one of these networks, how to get in to it, and what you can do once you're in command. I will be using the Linksys WRT54GL as an example, but the lessons here are very applicable to other makes and models as well.

First, the discovery. You're going to need a tool like kismet for this. If you're on Ubuntu Edgy Eft (like me), a simple sudo apt-get install kismet will install it on your machine. If you don't have apt-get or a comprable tool (such as yum on Red Hat flavors), you'll have to download and compile it from source yourself. Once you have kismet, edit the /etc/kismet/kismet.conf file. Edit the line that begins with "source=" to whatever is appropriate. The first value should be what comes up after the Nickname section of this command: iwconfig | grep Nickname. The second value should be the desired wireless interface (something like eth1... also on that same line of the previous command) and the third value is whatever you want to name this interface. Mine is source= ipw2100,eth1,wireless. More info is in the README under "Capture Sources." Fire up kismet with sudo kismet. Any detected networks that have the "F" under Flags (and, with color enabled, the line should come up as red) are networks with factory-default settings. These routers are often named "linksys" or "NETGEAR" or the like. If you want to change around the interface in kismet, edit the /etc/kismet/kismet_ui.conf file.

Now that you have your target, log onto the network and (hoping that this isn't a honeypot) point your browser to 192.168.1.1 (this IP address may vary depending on the make and model of the network that you're hacking... NETGEAR routers, for example, are 192.168.0.1). When prompted for a username and password, enter admin/admin. These are factory-set values that can be found for other models by searching on the Internet. For example, here and here (and here for D-link and here for Belkin). Congratulations, you're in.

What to do now? Well, as far as the router is concerned, a lot of things. Change the broadcasted ESSID of the network to "lol u R h4cked!" under Wireless->Basic Wireless Settings. Enable a password in Wireless->Wireless Security so that the legitimate users of the network will not be able to log on. In Access Restrictions, set the router so that it ceases to operate for five hours on Tuesdays. Etc. Of course, there are more things that you could do by exploiting the actual network itself, but that's beyond the scope of this entry.