Thursday, June 30, 2005

Send an email to any phone

Here is a list of email addresses for all cellphones alphabetized by carrier.

Monday, June 27, 2005

Nokia secret codes

* # 06 # = show the serial number IMEI -
*#92702689# (= *#war0anty#) = show warranty information

Nokia Ringtone Capabilities

1100 mono -sms delivery
v120t manual
5165 mono - sms delivery
5125 mono - sms delivery
2600 - cingular email

Sunday, June 26, 2005

SI WAP PUSH Calculator

echo -n 0051000B919145557705F400F5AA560605040B8423F0DC0601AE
206120424f595c215c215c21000101 |
awk -v FIELDWIDTHS="10 12 6 2 38 90 6 32 6" '{printf "%s,%s,%s,%s,%s,%s,",$1,$2,$3,$4,$5,$6; system("echo "$6" |xxd -r -p"); printf ",%s,%s,",$7,$8; system("echo "$8" |xxd -r -p"); printf ",%s,",$9}' |tr ',' '\n'

0051000B91 #top header
9145557705F4 #11 digit number
56 #bytes in payload
0605040B8423F0DC0601AE02056A0045C60C03 #payload header
3230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536 000103
49742773206120424F595C215C215C21 #message in HEX
It's a BOY\!\!\!
000101 #footer

Saturday, June 25, 2005

Comparing numerical data with sed and diff

A common situation that occures when working with Hex data is you will have a piece of data that works and one that doesn't. The idea is to compare the 2 HEX strings without pulling your hair out.

Here is a quick way to compare 2 HEX data strings.



Rather than checking the data with a pencil one byte at a time, we can use sed to break up the data into chunks of 10 and then the diff command to show where the first difference is.

echo 0051000B919145557705F400F5AA44605040B8423F0DC0601AE02056A
24f59202120212021000101 |sed 's/........../&\n/g'>works_bad

echo 0051000B919145557705F400F5AA440605040B8423F0DC0601AE02056A
95c215c215c21000101|sed 's/........../&\n/g'>works_good

[root@a1a ~]# diff --side-by-side a b |grep --color -C500 '|'

0051000B91 0051000B91
9145557705 9145557705
F400F5AA44 F400F5AA44
605040B842 | 0605040B84
3F0DC0601A | 23F0DC0601
E02056A004 | AE02056A00
5C60C03363 | 45C60C0336
62e3137362 | 362e313736
e3231322e3 | 2e3231322e
137342f626 | 3137342f62
22f7377696 | 622f737769
e672e67696 | 6e672e6769
6000103497 | 6600010349
4277320612 | 7427732061
0424f59202 | 20626f795c
1202120210 | 215c215c21
00101 | 000101

We can easily see that 'works_bad' is missing a 0 in position 40.

Friday, June 24, 2005

Linux Hexadecimal HOWTO

There are 4 things you need to do with HEX values in LINUX

For the impatient:

1) Convert Hex to Decimal
  • echo 68 65 6c 6c 6f 20 77 6f 72 6c 64 |tr '[a-z]' '[A-z]' |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr '\n' ' '
104 101 108 108 111 32 119 111 114 108 100

4) Convert Hex to ASCII

  • echo 68656c6c6f20776f726c64 |sed 's/../& /g' |tr '[a-z]' '[A-z]' |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr ' ' '\n' |awk '{printf("%c",$0)}'
  • Even Better -
  • echo 68656c6c6f20776f726c64 | xxd -r -p
hello world

2)Convert Decimal to Hex
  • echo 87 87|tr ' ' '\n'|awk '{printf "%x ",$1}'
57 57
3) Convert ASCII to HEX
  • echo -n hello world |od -tx1 |cut -c8-|tr -d ' \n'

More Examples:

If it wasn't so simple, you could put it in a script and call it

This command is usefull to encode ascii text into 8 bit Hex (UCS2)
for sending the payload of a PDU sms message.

If it wasn't so simple, you could put it in a script and call it

echo -n "" |od -tx1
0000000 32 30 32 2e 39 2e 39 38 2e 35 34 3a 38 30 38 30
0000020 2f 43 47 53 65 72 76 65 72 2f 73 65 72 76 65 2e
0000040 6a 73 70 3f 69 64 3d 31 32 33 34 35 36

Just ignore the first column or cut it out and remove the non-text characters with "| cut -c 8- |tr -d ' \n' "

Here is a standard 8 bit ascii chart to verify the results.

x="C0 AA BB CC"

echo "16i C0 p AA p BB p CC p" | dc


echo -e "16i\t$x"|sed 's/ / p /g' |sed 's/$/ p/'|dc


Single number conversion

Hex to Integer
echo 16i 57 p |dc

Integer to Hex
echo 87 16 o p |dc


SI WAP PUSH for Linux Hackers

#send a wap push - si
echo -ne "at+cmgs=101\r" >/dev/modem;sleep 1;echo -ne "0051000B919145557705F400F5AA570605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E636F6D2043472030303031000101^Z" >/dev/modem

00 default SMSC
00 message ID 00 means let phone set
0B length of destination mobile number = 11
91 the international + sign
0621723364F4 the phone number 60 12 27 33 46 4
00 protocol identifier
AA validity period 4 days

57 length of content
0B84 dest port no
23F0 origin port no
DC Transaction ID (Push ID)
06 PDU type (Push PDU)
01 Header Length (just leave it at 01)
AE Content Type=application/vnd.wap.sic (0x80 | 0x2E)
0C http://
03 (next is an ASCII string for the URL, terminate with 00)

which means =

00 terminate string with 00
03 (next is an ASCII string for title, terminate with 00)

which means = CG 0001

00 terminate string with 00

Calculate the size of the payload message in Hex : (goes after AA)

This works:

echo -n "06 05 04 0B 84 23 F0 DC 06 01 AE 02 05 6A 00 45 C6 0C 03 32 30 32 2E 39 2E 39 38 2E 35 34 3A 38 30 38 30 2F 43 47 53 65 72 76 65 72 2F 73 65 72 76 65 2E 6A 73 70 3F 69 64 3D 31 32 33 34 35 36 00 01 03 61 6D 75 7A 6F 2E 63 00 01 01" |tr '[a-z]' '[A-z]' |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr ' ' '\n' |awk '{printf("%c",$0)}'|wc -c |tr ' ' '\n'|awk '{printf "%x ",$1}'

And this is an easier way:

echo -n 0605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E63000101 |wc -c |awk '{print $1" * .5"}'|bc |awk -F. '{printf "%x\n",$1}'

Here is how to calculate the overall message length: (headers + payload)
echo -ne "51000B919145557705F400F5AA570605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E636F6D2043472030303031000101" |wc -c |awk '{print $1" * .5 "}'|bc |awk -F. '{print $1}'

Important AT error messages

You can find a list of CMS error codes here:

CMS Errors:

300: ME Failure;
302: Operation not allowed;
303: Operation not supported;
304: Invalid PDU mode parameter;
305: Invalid text mode parameter;
320: memory failure;
321: invalid memory index;
322: memory full;
330: SCA unknown;
500: Unknown error;

message center number - cingular - +1404727259060

Thursday, June 23, 2005

AT Commands - Part 2

ln -s /dev/rfcomm1 /dev/modem

rfcomm1: 00:60:57:4D:D3:32 channel 1 closed

stty -a < /dev/modem speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ;
eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

ln -s /dev/ttyACM0 /dev/modem #motorola v188 usb

cat /dev/modem &
echo > /dev/modem #for some reason the first echo gets ignored so we send a dummy
echo -ne "at+cmgf=1\r" >/dev/modem
echo -ne 'at+cmgl="ALL"\r' >/dev/modem #get messages in ASCII

+CMGL: 4,"STO UNSENT","+9545577504",,

How are you?


If you are operating in Text mode AT+CMGF=1 then the command is

This will list all the SMS in the SIM

If you are in PDU mode then you should use


>>3) Delete messages from sim

AT+CMGD= is the command to delete the message at position

echo -ne "at+cmgf=0\r" >/dev/modem #read messages in binary
echo -ne 'at+cmgl=4\r' >/dev/modem #ALL does not work in binary mode

+CMGL: 4,2,,24


#hello word in 7 bin binary
echo -ne "at+cmgs=23\r" >/dev/modem;sleep 1
echo -ne "07913121139418F011000A9159346367820000AA0BE8329BFD06DDDF723619^Z" >/dev/modem

+CMGS: 59


#10 digit number beginning with area code "hello world"
echo -ne "at+cmgs=23\r" >/dev/modem;sleep 1;echo -ne "0011000A9159346367820000AA0BE8329BFD06DDDF723619^Z" >/dev/modem

#11 digit number including country code
echo -ne "at+cmgs=24\r" >/dev/modem;sleep 1;echo -ne "0011000B919145337626F80000AA0BE8329BFD06DDDF723619^Z" >/dev/modem

[root@a1a ~]# echo -ne "at+cmgf=0\r" >/dev/ttyACM0
[root@a1a ~]# at+cmgf=0

[root@a1a ~]# echo -ne "at+cmgs=24\r" >/dev/ttyACM0
[root@a1a ~]# at+cmgs=24
[root@a1a ~]# echo -ne "0011000B919145337626F80000AA0BE8329BFD06DDDF723619^Z" >/dev/ttyACM0[root@a1a ~]# 0011000B919145337626F80000AA0BE8329BFD06DDDF723619
+CMGS: 3

send a binary message to 9546638946 "hello world" (please change number before trying this)
echo -ne "at+cmgf=0\r" >/dev/ttyS0
echo -ne "at+cmgs=24\r" >/dev/ttyS0; sleep 1;
echo -ne "0011000B919145668349F60000AA0BE8329BFD06DDDF723619^Z" >/dev/ttyS0

echo -ne "at+cmgs=15\r" >/dev/modem;sleep 1;echo -ne "0011000B919145337626F80004AA0122^Z" >/dev/modem #send ok but phone gets a "message could not be displayed"

Wednesday, June 15, 2005

Phone Museum

Here are the phones I own:

3390b- GSM 14.99 (t-mobile) + 10 s/h =$24.99 - OR-andale = $20 , 572 offered, 291 sold - found a lot of 45 used for $900= $20 each
3650- GSM -
6010- GSM (supposedly datacable DKU-5)
3120b - GSM -(data cable, DKU-5 $20)
3595- GSM (data cable 3950 - $6.99)
6340i - GSM 850 1900 ALL TDMA frequencies and Analog, WAP 1.2.1, wireless modem 9.6 kbps,infrared, Nokia 6340 PC : 10 new for $400 on ebay=$40
5165p - tdma
5165p - tdma

v120T- tdma
v171 - gsm TF - EMS version 5.0

samsung SPHA740 - sprint - bob

T68 gsm-features

CF62 - t-mobile prepaid

Phones I would like to buy:
3395- wap 1.1 19.99 + 12.50 s/h = $32.49
motorola c155 -TF- EMS version 5.0

A Simple ASCII to Hex Convertor

This command is usefull to encode ascii text into 8 bit Hex (UCS2)
for sending the payload of a PDU sms message.

If it wasn't so simple, you could put it in a script and call it

echo -n "" |od -tx1
0000000 32 30 32 2e 39 2e 39 38 2e 35 34 3a 38 30 38 30
0000020 2f 43 47 53 65 72 76 65 72 2f 73 65 72 76 65 2e
0000040 6a 73 70 3f 69 64 3d 31 32 33 34 35 36

Just ignore the first column or cut it out and remove the non-text characters with "| cut -c 8- |tr -d ' \n' "


echo 31 32 33 34 35 36 |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr ' ' '\n' |awk '{printf("%c\n",$0)}'

Here is a standard 8 bit ascii chart to verify the results.

Tuesday, June 14, 2005

HOWTO - Setup a Serial Connection to a Bluetooth Phone

I am running Fedora Core 3 - FC3 with a kensington usb bluetooth adapter. FC3 comes with the bluez software so I didn't need to install anything for bluetooth to work.

0) # service bluetooth status; service bluetooth stop; service bluetooth start; service bluetooth status
1) unplug the usb bluetooth adapter then plug it back in
2) # hcifconfig hci0 down
3) # hcifconfig hci0 up
4) # hcifconfig -a

hci0: Type: USB
BD Address: 00:0C:55:F8:5E:73 ACL MTU: 377:10 SCO MTU: 16:0
RX bytes:378 acl:0 sco:0 events:16 errors:0
TX bytes:325 acl:0 sco:0 commands:17 errors:0
Features: 0xff 0xfe 0x0d 0x38 0x08 0x08 0x00 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Name: 'a1a-0'
Class: 0x120104
Service Classes: Networking, Object Transfer
Device Class: Computer, Desktop workstation
HCI Ver: 1.2 (0x2) HCI Rev: 0x0 LMP Ver: 1.2 (0x2) LMP Subver: 0x6965
Manufacturer: Broadcom Corporation (15)

5) #hcitool scan
Scanning ...
99:66:55:44:D1:35 Nokia3650

6) rfcomm bind /dev/rfcomm1 99:66:55:44:D1:35 1
7) You should now be able to use the serial connection to communicate with your bluetooth phone.

If you get the following error:

# cat /dev/rfcomm1
cat: /dev/rfcomm1: Connection refused

1) Then turn the phone off and back on.
2) hcitool scan
Scanning ...
99:66:55:44:D1:35 Nokia3650
3)cat /dev/rfcomm1
Waiting with no error

This usually fixes the problem.

Friday, June 10, 2005

Using the Nokia 3650 for internet access -Linux FC3

Carrier: Cingular
Plan: $19.99 monthly internet
Phone: Nokia 3650
OS: Fedora Core 3 - FC3
Bluetooth device: Kensington USB adapter

The output from a successfull GPRS ppp connection:

[root@a1a peers]# pppd call gprs
--> WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATH
--> Sending: ATE1
--> Sending: AT+CGDCONT=1,"IP","isp.cingular","",0
--> Modem initialized.
--> Sending: ATD*99#
--> Waiting for carrier.
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> PPP negotiation detected.
Serial connection established.
using channel 6
Using interface ppp0
Connect: ppp0 <--> /dev/modem
sent [LCP ConfReq id=0x1 ]
rcvd [LCP ConfRej id=0x1 ]
sent [LCP ConfReq id=0x2 ]
rcvd [LCP ConfAck id=0x2 ]
rcvd [LCP ConfReq id=0x0 ]
sent [LCP ConfAck id=0x0 ]
sent [PAP AuthReq id=0x1 user="ISPDA@CINGULARGPRS.COM" password="CINGULAR1"]
rcvd [PAP AuthAck id=0x1 ""]
PAP authentication succeeded
sent [CCP ConfReq id=0x1 ]
sent [IPCP ConfReq id=0x1 ]
rcvd [IPCP ConfReq id=0x0 ]
sent [IPCP ConfNak id=0x0 ]
rcvd [LCP ProtRej id=0x0 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
rcvd [IPCP ConfNak id=0x1 ]
sent [IPCP ConfReq id=0x2 ]
rcvd [IPCP ConfReq id=0x1 ]
sent [IPCP ConfAck id=0x1 ]
rcvd [IPCP ConfAck id=0x2 ]
not replacing existing default route to eth0 []
local IP address
remote IP address
primary DNS address
secondary DNS address
Script /etc/ppp/ip-up started (pid 5672)
Script /etc/ppp/ip-up finished (pid 5672), status = 0x0
Terminating on signal 2.
Script /etc/ppp/ip-down started (pid 5797)
sent [LCP TermReq id=0x3 "User request"]
rcvd [LCP TermAck id=0x3]
Connection terminated.
Connect time 31.6 minutes.
Sent 62981 bytes, received 152749 bytes.

Now from another xterminal you can rin ifconfig and look for the new interface - ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr: P-t-P: Mask:
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:64 (64.0 b) TX bytes:116 (116.0 b)

After this connection was made there are 2 options:
1) replace my default gateway with
route del default gw; route add default gw
2) add a route to get to the cingular gateway for my phone (ip -taken from my phone settings)
route add -net netmask dev ppp0

Destination Gateway Genmask Flags Metric Ref Use Iface * UH 0 0 0 ppp0 * U 0 0 0 ppp0 * U 0 0 0 eth0
default UG 0 0 0 eth0

tested by:
browsing to (this is

Works OK except for DNS.

My Favorite Nokia AT commands

#make the rfcomm device files
while [ $c -lt 256 ]; do
echo c=$c
if [ ! -c /dev/rfcomm$c ]; then
mknod -m 666 /dev/rfcomm$c c 216 $c
c=`expr $c + 1 `

service bluetooth status
service bluetooth start
service bluetooth status
hciconfig hci0 down && hciconfig hci0 up
rfcomm bind 1 00:60:57:4D:D3:32 1
rfcomm show
rfcomm1: 00:60:57:4D:D3:32 channel 1 closed
rfcomm release 1
rfcomm bind 1 00:60:57:4D:D3:32 1
rfcomm show
rfcomm1: 00:60:57:4D:D3:32 channel 1 clean

[root@a1a peers]# hcitool scan
Scanning ...
00:60:57:4D:D3:32 Nokia3650

hcitool rssi 00:60:57:4D:D3:32; echo -e "at+csq\r" >/dev/modem
RSSI return value: 0
echo -e 'AT+CSCA?\r' >/dev/modem #to get the message center number from the phone
echo -e 'at+cmgs="9543367628"\r' >/dev/modem; echo -e 'Hi Bonita^Z' >/dev/modem
echo -e 'at+cmgl="ALL"\r' >/dev/modem
echo -e 'at+cbc\r' >/dev/modem #check battery

+CBC: 0,45


Thursday, June 09, 2005

Nokia AT GPRS command set

Bluetooth GPS ????

In this Thesis, Bluetooth is promoted as a technogy to enable location
aware services. The authors discuss the problems of trying to use RSSI
radio signal strength to triangulate position. They built a test system with
30 DLINK DBT-120 USB Bluetooth adapters costing $30 each and
using USB hubs with an external power supply. The USB hubs allow the
Bluetooth adapters to be initialized on a laptop and then disconnected from
the computer once initialized. As long as the power supply is not interrupted,
the beacons will continue to broadcast. pubs/ashuang-sm-thesis-2005.pdf

Wednesday, June 08, 2005

Using the Nokia 3650 for internet access -Windows XP

I bought the Nokia 3650 to use as a backup internet connection for emergencies or when I'm on the road. After a day of hassling with it I finally got it setup and working in Windows XP with my Kensington bluetooth usb adaptor.

There is a lot of information on the web about connecting this phone to the internet with a cingular sim card.

I saw that there are basically 4 steps:
1) Download and install the Nokia 3650 PC Suite and the nokia drivers "Nokia 3650 Modem Setup ",3048,3650,00.html

2) Turn on bluetooth in the phone and pair the connection to the computer.
3) Create a new dialup connection
4) Enter the username, password and number to dial
5) Connect

On step 5 I could not get past this error message when trying to connect:

"Error with PPP connection: 734"
"Error 734: The PPP link control protocol was terminated."

As a test, I downloaded and ran the Cingular connection manager,
CingularSetup_4_2_7_1.exe ->

But I was getting the same error using both applications. I decided to call Cingular. It turns out that I was not provisioned to use GPRS modem because I was on the 2.99 internet express plan. They said I needed the 19.99 internet connection plan so I signed up for that and they gave me a user/pass to connect.

Dialup Connection Information:
Password: CINGULAR1
Dial: *99#

I have seen a lot of comments on the internet saying you can leave the username and password blank, or put in random text but this did not work for me. Without the correct username and password I get the error message:

"Error 734: The PPP link control protocol was terminated."

They changed the number to dial to *99***1# but I also tested *99# for the number and it worked just as well.

Sunday, June 05, 2005

XFS undelete HOWTO:

How to undelete a file in a linux XFS filesystem:

"I moved to the next possibility and clicked ‘undeploy’.
Suddenly- all my application and
data files were deleted by tomcat."

Background (How I accidently deleted all my data):

At the end of a 4 week project to make a shipping portal website, I decided to try out the Jakarta-Tomcat web admin interface to start and stop the application instead of sticking to the command line startup and shutdown scripts that I am familiar with.

I logged into the admin console (jakarta-tomcat-5.5.9) and proceeded to restart the application by clicking ‘start’ and then ‘stop’. This did not show the changes I was expecting so I needed to try something else. With each button click, a generic window pops up to say “Are you sure?” Am I sure about what? I wondered. I moved to the next possibility and clicked ‘undeploy’. Suddenly- all my application and data files were deleted by tomcat.

Reminder- to tomcat, undeploy means you want all your code and project files deleted.

I ran df –k praying that this filesystem was your friendly ext3 but instead it read xfs. Dread.


Q: Does the filesystem have a undelete function?

There is no undelete in XFS, in fact once you delete something, the
chances are the space it used to occupy is the first thing reused.
Undelete is really something you have to design in from the start.
Getting anything back after a accidental rm -rf is near to impossible.

This called for extreme measures. I had to bring the files back.

The Undelete:

They say it is near to imposible to recover files in XFS but I did it, and here’s how:

df –k /usr/local/jakarta-tomcat/webapps

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda7 26245376 13740048 12505328 53% /usr/local

I knew that it was important not to disturb the file system where the files had been deleted, but I had production data on part of that disk so I could not unmount it. Also, I did not have 26 Gig’s of free space on the machine to make a safe copy. This meant that I had to work fast and avoid all file creation on the hda7 filesystem.

I used the time command on every search I ran because when grepping 26 Gig files it is very important to manage the amout of time spent searching for data.

First I ran some tests on 1 Gig of raw XFS data to find the fastest way to search for strings. I searched for '$WGET' because it was a variable i remembered that was in the lost file.

dd if=/dev/hda7 bs=1024 count=1000000 | strings | cut -c0-50 | grep

$WGET --post-data="prefix1=$PREFIX&number1=$NUMBER
$WGET --post-data="prefix1=$PREFIX&number1=$NUMBER
1000000+0 records in
1000000+0 records out
real 4m35.243s
user 1m24.390s
sys 0m20.810s

Now the better way.

dd if=/dev/hda7 bs=1024 count=1000000 | grep -a '$WGET' | strings

1000000+0 records in
1000000+0 records out
$WGET --post-data="prefix1=$PREFIX&number1=$NUMBER&DoIt=Do+it"
$WGET --post-data="prefix1=$PREFIX&number1=$NUMBER&DoIt=Do+it"
real 0m55.836s
user 0m4.350s
sys 0m18.310s

Both command statements searched 1 million records of data (1,000,000 x 1024=1Gig) but moving the strings command to after the grep and taking out the cut is 500% faster. This is important because I need to search 26 times this amount of data.

Now I began the search using a unique keyword that I knew was present in the deleted file.

time grep -a –B100 –A100 "$WGET" /dev/hda7 | strings

fo< x=")&" i="n?&s%p1%d%;m">[99H

#045 24630815
usage () {
echo "Usage:"
echo '-p 3 digit prefix'

WGET='wget -q --user-agent="Internet Explorer 5.5" --wait=1 --timeout=10 --tries=2 -O -'
#begin the web get

$WGET --post-data="prefix1=$PREFIX&number1=$NUMBER&DoIt=Do+it" grep -A60 "Details" grep -E "::' sed 's:::' sed 's:::g'tr '<' ',' sed 's/>/,_/g' awk -F, '{print $3}' grep -v _Time tr -d '_' paste -d= 5.template -

#script done

fo< ~b~Ht s3Q+ k&s@ vAJ,%

real 19m57.031s user 0m35.090s sys 4m19.860s

As you can see, in 20 minutes I found my deleted file stashed in 26 Gigs of binary junk!

It was not practical to attempt recovery of all my files this way so I just recovered the most valuable programs. Other jsp’s I rewrote based on html I was able to recover from the browser cache of another computer and the most recent backups I had.