August 2007 - Posts

Round 'n Round We Go!
08-13-2007 11:40 AM

After a year I posted my rounding question in the forums, I finally got it working. Here's the original post I made; http://devpinoy.org/forums/t/915.aspx.

Just this morning, I had nothing to do, so I excavated some of my unsolved sources from my archive. Then I remembered this problem about rounding stuff in assembly. I thought, maybe it's time to solve this, so I did.

The original problem I had was I did not know how to round to a specified number of digits. For example, I have the value 3.1456825863, which I wanted to round to 3 decimal places like this 3.146. For my original code, it always outputs 3. Then it hit me! I already had this problem in flash before, the function Math.round does the same thing, but I already solved it there. So again, excavated the FLA project... and the rest was rounding history. So here's the code using the FPU.

01     .586
02
03     ...
04
05     .data
06     buffer   db    1024 dup(0)
07     fbuffer  dq    0
08     pi        dq    3.14
09     rdigit    dq   10000.0
10
11     ...
12
13     .code
14
15     ...
16
17     invoke GetDlgItemText, hWin, IDC_EDIT_INPUT, addr buffer, SIZEOF buffer
18     invoke StrToFloat, addr buffer, addr fbuffer   
19            fld         fbuffer
20            fmul      pi
21            fmul      rdigit
22            frndint   
23            fdiv        rdigit
24            fstp       fbuffer
25     invoke FloatToStr2, fbuffer, addr buffer
26     invoke SetDlgItemText, hWin, IDC_EDIT_OUTPUT, addr buffer
27
28     ...
29
30     end start

The most important parts for this are lines 09, 21, 22, and 23. Line 09 (rdigit) is the one responsible for controlling the number of significant digits to be displayed, depending on the number of zeroes in it. Example, the input is 3.1456825863 and rdigit is 100.0, the output will be 3.15, since there are 2 zeroes in 100 (My code above will output 3.1457). Lines 21 to 23 simply means that Math.round(ST(0)*rdigit)/rdigit), which is responsible for doing the trick.

So there it is, I hope this helps anyone who will encounter this problem. Please feel free to comment if there are errors in this. I tested it with my scenarios and it worked like a charm, but who knows...

Yes Creds goes out to cvega for the help I got with this piece. Thanks!

Spam Scam #2: Different Subject, Different Content
08-08-2007 2:30 PM

Another one of those. It's really fun analyzing these spams, so let's rave.

First of all, check out the subject, alright! Rod Stewart marries a model? Very catchy, who's the model?

But wait, what's that, it's addressed to a certain Zhirnov Stansislay. The surname is really cool, Is-tan-is-lay, hehehe. So it's not for me eh... but the address is my address? Oh well.

Then let's open up the mail (But I suggest that you don't for safety measures, I'm just doing this for fun). What the... :-o

Just having fun here! ;)

Original Message:

Subject: Reports: Rod Stewart marries model
From: Sales <sales@turningpointprop.com>
To: Zhirnov Stansislay <modchip@xxxxxxx>

Everyone need it Original.

Genuine Viagra and Cialis directly from Phitzer

Here: http://www.turningpointprop.com/
Prices are VAT/TAX removed 

 

by modchip | with no comments
Filed under:
Spam Scam #1: The Lottery Scam
08-08-2007 1:02 PM

Wow! I won the Frontline Lottery! Spammers/Scammers (Ed: Is there such a word?) never learn. Just look at the subject, why won't they learn to write proper english first before sending out these scams? I don't claim to be an expert in the English language, but I can tell that their English sucks.

Don't they have their own email address domain name, why are they using a canadian Yahoo! account? And look at the email address, it's so pathetic, theofficeofduncanjames01.

Lastly look at the bottom part, it says "Your's in service", which in longhand I think means "Your is in service", haha, funny.

Original Message:

Subject: CONGRATULATION {YOUR EMAIL SELECTED} !!!!!!!!!!!
From: theofficeofduncanjames01@yahoo.ca

Programs and Events Department
The Camelot Lottery - Frontline Group
The National Lottery,
P.O. Box 251,
Watford
WD1 8GD
WINNING NOTIFICATION: !!
 
We are officially informing you of the result of the Frontline Lottery Winners International programs held on the 5th of May 2007 as part of our promotional programs for the year 2007. Your e-mail address attached to ticket number 77007742781005-18721 with reference number EGS/2251256003/02 drew winning
numbers 7-00-71-00-66-49 and credited to batch number 121FTG, which consequently won in the 3rd category via our electronic ticket as stated above. You have therefore been approved for a pay out of 600,000
GBP (SIX HUNDRED THOUSAND POUNDS ONLY).
 
CONGRATULATIONS!!!
We also advice that you keep your winning information very confidential as our security policy demands to avoid double claims/impersonation and unwarranted abuse of this program by some individuals.
 
The selection process was carried out through random selection in our computerized email selection system (ESS) from a database of over 500,000 email addresses drawn from all the continents of the world. This promotional program being the first of its kind will now take place annually and we hope with part of our
winning you will take part in our next year Eight Hundred And Fifty Thousand Pound Sterlings international Lottery. To file for your claim, you will be contacting our Customer Service Unit, authorized to conduct the neccessary verification to enable you receive total payment (You will receive more information upon your acknowledgment of this email).
 
Customer Service Unit
CONTRACTED AGENCY: DUNCAN JAMES & ASSOCIATES
Mr.Duncan James
Tel: + 44 701 114 7831
Email: theofficeofduncanjames01@yahoo.ca
20 Lausanne Road London, SW2 3JB ENGLAND.U.K
 
You are to provide the claims agent with the under listed information as soon as possible:
 
1. NAME IN FULL:................................
2. ADDRESS:.....................................
3. NATIONALITY:.................................
4. AGE:.........................................
5. SEX:.........................................
6. OCCUPATION (POSITION HELD):...................................
7. PHONE:........................................
8. FAX............................................
 
This promotional lottery is promoted and sponsored by software corporations and other private organizations and we intend to use this medium to help individuals generate fortunes which would encourage them to expand their business frontiers thereby creating more opportunities and assisting with humanitarian concerns within their immediate environment. All winning must be claimed not later
than One Week of Acknowledgment. After this date all unclaimed funds will be returned to European Union Treasury as Unclaimed.

After this date all winning funds will be included in our subsequent program. In order to avoid complications always quote your reference number in all correspondence.
 
NEWS UPDATE:
Lottery Diary http://lottery.merseyworld.com/Info/Diary.html,
Suscription leaflet: http://lottery.merseyworld.com/Info/Sub_Leaflet.html
links: http://lottery.merseyworld.com/Links/All.html

Furthermore, should there be any change of address do inform us as soon as possible. Congratulations again from all our staff.
 
N.B: Anybody under the age of 16 is not eligible to participate in this program.
 
Your's in service,
Mr. Greg Twentyman
(Programs & Events)
by modchip | with no comments
Filed under:
What's the Password?
08-07-2007 12:19 PM

Whew! It's been a while, but rejoice, I'm back with another dark tip!

Have you ever wondered, "hey, I have some files that I want to keep in my hardrive, but I don't want anybody opening/reading/executing it...". Yeah, there are lots of ways to do it. But what I'm going to demonstrate is *cooler* than those. We will actually learn how to hide your files inside an image! :D

Requirements:
1. Any archiving utility.
2. An image file of your choice. (Can be JPG, BMP, etc...)
3. Your file. (I'll use an asm source code for demo.)

First, gather all the "secret" files that you want to hide. Once you're done, zip/rar/etc. them all up. For the demo, I'll name it myfiles.zip. Find your image file, I'll use a gif file named modchip.gif, then place your secret archive with it.

Run your prompt, type the simple command;

copy /b modchip.gif + myfiles.zip modchip_s.gif [ENTER!]

copy is the copy command we all got to know in the good 'ol world of DOS.    
The /b option is used to copy binary files.
modchip_s.gif is the output file where modchip.gif and myfiles.zip will be copied to.

Now, once all have been done correctly, the message "1 file(s) copied." should be displayed on the prompt.

Navigate to the directory where you placed all your files, find the output, in my case modchip_s.gif. Double click it, hmmmm... seems like a normal image file ain't it? But how do we see the hidden file? I leave that all to you. ;) (@EDIT: Tip: Just look at all the requirements above, see what you could use to extract the files. :D.)

Below is the output of my demo. Can you guess what my *password* is?  Haha, it is literally IN the image!

 

Hope you learned much from this. So the next time you open an image file, take a second and think, there might be some surprises in it! (Just hope it ain't a trojan... :))

'Til next time!