Sunday, July 11, 2010

Memory Scanner and Editor for Linux

If you're familiar with ArtMoney, MemEdit or Cheat Engine on Windows, then you know what it's used for :-).


Basically, it lets you search for variables in the memory of a running process, then refine the search further (eg: give higher, lower or fixed values). You can use this basically to cheat at games. Look for the health, money or mana values, refine the search, then freeze or set the value to whatever you want.

ScanMem is a simple commandline tool on Linux that lets you do the same. There are other uses, but this one is the most common...

Monday, June 07, 2010

Nautilus Location Bar - Fix Text Mode

Gnome keeps getting dumber and dumber all the time. First the "Open in Terminal" right click option was gone, now the address bar.


Before at least you had a crayon button to toggle it. Now you need to type / and start typing or Ctrl-L to show it. Makes it a bit harder to copy/paste stuff to it.

Here's how you fix it:
gconftool-2 --type=Boolean --set /apps/nautilus/preferences/always_use_location_entry true


Friday, May 21, 2010

VIM: The Matrix Has You


(click for gif animation)


This is pretty much the coolest thing I've seen all day.

A "Matrix" screensaver for VIM. It's amazingly realistic too.

Tuesday, April 06, 2010

Share GNU screen sessions with a different user

Here's something cool you can do with screen. Share a screen session with multiple terminals. "screen -x". Of course, this only works if you're using the same user.


Let's say you want to do some cooperative debugging with another username. Simple:

1. Set screen setuid flag:
chmod +s screen

2. Start a new screen sessions:
screen -S mihai

3. Set multiuser
Ctrl-A
:multiuser on

4. Add the user to join your session to the ACL list:
Ctrl-A
:acladd jimbo

5. Now connect as jimbo and join cmihai's session (called mihai):
screen -x cmihai/mihai


Now you can share you screen session with that user :-).

Sunday, January 03, 2010

Unpack functions and BSDProgress - progress bar for your archives.

A colored unpack script using bar:

A little KSH93 function for your .profile. Now you can augomatically unpack most archives while watching the pretty progress bar.
You need bsdprogress (Solaris and Linux port of NetBSD's progress). With a bit work it also works on AIX.
I just re-wrote this for progress, so I didn't check the cpio and such yet.
# Mihai Criveti - Unpack function:
# Progress Unpack - unpack using GNU tar and bsdprogress.
function up {
for archive in $*; do
print $archive;
case $archive in
(*.tar) progress -f $archive gtar xpif - ;;
(*.tar.gz) progress -f $archive gtar -zpixf - ;;
(*.tgz) progress -zf $archive gtar -ipxf - ;;
(*.tar.bz2) progress -f $archive gtar -jipxf - ;;
(*.tbz) progress -f $archive gtar -jipxf - ;;
(*.gz) progress -f $archive gunzip -;;
(*.bz2) progress -f $archive bunzip -;;
(*.tar.Z) uncompress -c $archive | tar gxvf - ;;
(*.cpio) cpio -icd < $archive ;;
(*.Z) uncompress $archive ;;
(*.rar) unrar x $archive ;;
(*.zip) unzip $archive ;;
esac
done
}

Let's say we want to unpack files that end in *bz2 (it will automagically detect .tar.bz2 or tbz2), *gz and a specific tar archive:


cmihai@phobos:/home/cmihai/build$ up g*bz2 c*gz Python\-3.0.1.tar
gnupg-1.4.10.tar.bz2
100% |**********************************************************************| 3330 KB 296.95 KB/s 00:00 ETA
gnupg-2.0.14.tar.bz2
100% |**********************************************************************| 3888 KB 340.20 KB/s 00:00 ETA
ccache-2.4.tar.gz
100% |**********************************************************************| 86363 201.51 KB/s 00:00 ETA
Python-3.0.1.tar
91% |******************************************************** | 43320 KB 787.63 KB/s 05:00 ETA

See: 
http://netbsd.gw.com/cgi-bin/man-cgi?progress++NetBSD-current
http://mac.freshmeat.net/projects/bsdprogress/
It builds fine on AIX (Makefile tweaks), Solaris and Linux. Native on NetBSD.
Other versions:
http://clpbar.sourceforge.net/
http://freshmeat.net/projects/progress



Saturday, December 26, 2009

Screenrc hardstatus line

Here's a pretty neat hardstatus line for your .screenrc:




hardstatus alwayslastline "%{-b ck}%?%-Lw%?%{bg}%n*%f %t%?(%u)%?%{wk}%?%+Lw%? %= %{r} %H %{g} %D %d/%m/%Y %0c "

Wednesday, December 23, 2009

Codepad and Ideone - a new kind of pastebin

Codepad and Ideone are pastebins that let you execute code. Ideone also accepts input:
http://ideone.com/P7WKrT2I
http://ideone.com/o1GGFBV4

This would make an awesome learning tool for schools and such. Make it into some kind of appliance, add a bunch of examples, problems, tests and such and it can teach kids collaborative debugging and the basics of programming.

If I had to guess it's running User Mode Linux (or some similar jail) and ptrace (or some similar systrace or syscall tracer).

I poked a bit with perl "Config" (eg: perl -V) and it looks like they're running Gentoo.. all accounts seem to be on the same instance (nobody). So it's most likely a jail.

osname=linux, osvers=2.6.28-gentoo-r5, archname=i686-linux
uname='linux devel 2.6.28-gentoo-r5 #1 smp sun apr 26 22:00:57 cest 2009 i686 intel(r) core(tm)2 quad cpu q9550 @ 2.83ghz genuineintel gnulinux '

It looks like they did a very good job though, especially with the number of people poking around or running forkbombs :-).

Monday, November 02, 2009

BSOD analysis simplified with BlueScreenView

Sure, you can do a lot more than a simple !analyze -v with WinDbg, but if you're doing tech support and keep getting spammed by minidumps or just want to solve something quick and easy, you can use BlueScreenView.


Basically, you can see the drivers found on the stack at the time of the crash, a list of all drivers loaded in the kernel or XP style BSOD as it would appear in the crash. You can also create HTML reports to send to your clients.


The process is simple. You point BSV at a bunch of minidumps, you look at what driver is on the stack - then you upgrade it (oh, look, it's NVIDIA, time to upgrade). Or uninstall it (oh, look, I'm running some daemon tools thing pseudo-driver, to time remove it). Then you see if Windows stops crashing. If not, go to plan B - WinDbg, Driver Verifier, etc.

Sunday, August 16, 2009

IntegraTUM WebDisk on RHEL 5.3 x64 using Tomcat 5.5.28

WebDisk lets you push CIFS to HTTP via an application server.


Here's an example install on RHEL 5.3 x64 / Tomcat using Sun Java JDK.

Instalation is very much identical on Windows (Replace with C:/tmp/webdisk for example).


In this example we assume an application server gets installed on 192.168.1.4 and 192.168.1.2 is the CIFS server.


Create the tomcat users:

useradd tomcat

passwd tomcat

su - tomcat


Download and unpack tomcat:

wget http://apache.mirrors.evolva.ro/tomcat/tomcat-5/v5.5.28/bin/apache-tomcat-5.5.28.tar.gz

gtar zxvf apache-tomcat-5.5.28.tar.gz


Add the tomcat manager role (replace with your password).

ed apache-tomcat-5.5.28/conf/tomcat-users.xml

27i

Add the following roles (inside tags of course):

role rolename="manager"

user username="tomcat" password="tomcat" roles="manager"


Setup Java

Download and innstall Java (if not installed) - Java SE Development Kit 6u16 from http://java.sun.com/javase/downloads/index.jsp

chmod +x jdk-6u16-linux-x64-rpm.bin

su -c ./jdk-6u16-linux-x64-rpm.bin

rpm -ql jdk-1.6.0_16-fcs | grep bin

echo "export JAVA_HOME=/usr/java/jdk1.6.0_16" >> ~/.bashrc

. ~/.bashrc

echo $JAVA_HOME

/usr/java/jdk1.6.0_16


Start TomCat:

./startup.sh

http://192.168.1.4:8080/

Login: tomcat:tomcat


Install IntegraTUM WebDisk

cd ~

wget http://downloads.sourceforge.net/project/webdisk/webdisk/0.44/IntegraTUM_WebDisk_0.44.tar.gz

gtar zxvf IntegraTUM_WebDisk_0.44.tar.gz

mv IntegraTUM_WebDisk_0.44 ~/ba


Create ba.xml:

ed ~/apache-tomcat-5.5.28/conf/Catalina/localhost/ba.xml


Create web.xml:

cd /home/tomcat/ba/webapp/WEB-INF/

cp web_default.xml web.xml

ed web.xml

1,$s/YOUR_SERVER_IP/192.168.1.2/g


Create /tmp/webdisk:

mkdir /tmp/webdisk

chmod 777 /tmp/webdisk/


Restart Tomcat:

cd ~/apache-tomcat-5.5.28/bin/

./shutdown.sh

./startup.sh


You should now see ba Display Name: IntegraTUM WebDisk in http://192.168.1.4:8080/manager. Make sure it's started.

Access your application: http://192.168.1.4:8080/ba/base/



You login with the username / passsword on the CIFS server OS. Make sure a "username" folder is shared.


You may also want to check out Davenport WebDAV SMB Gateway:

http://davenport.sourceforge.net/

Thursday, August 13, 2009

Microsoft banned from selling Office in the US by Texas Judge

Here's something you don't see everyday.. Texas judge bans Microsoft from selling XML based products like Office 2007 in the US:

http://news.prnewswire.com/DisplayReleaseContent.aspx?ACCT=104&STORY=/www/story/08-12-2009/0005076218&EDATE=

http://files.newswire.ca/816/CourtDocuments.pdf

This creates a pretty nasty precedent... remember, OpenOffice does the same thing too...

The patent:

http://www.patentstorm.us/patents/5787449/fulltext.html