Sunday, December 30, 2007

Hide Secret Message text and file insert a Image





Hide Secret Message text and file insert Image

If you are think sending a secret message to friends by way email or placing a file in a common drive or through website. The best way to do is through Image or sound file format.

If you want to hide a secret message or file insert image.

Download ‘Steghide’ from http://steghide.sourceforge.net/ site. It is freeware!!

To embed a text file in image file is

steghide embed –cf anto.jpg –ef sec.txt




you set the password to access the file and text.


To extract the text file from the image

Steghide extract –sf anto.jpg


Friday, December 28, 2007

Print Nth line of file : Unix

If you what to print nth line of a file

head -n filename tail -1

Result:
head -n filename will give the n lines to the buffer
This will be redirected to tail -1. So the last line from buffer will get

Example:

Filename : users.txt

1 Muthu
2 Anto
3 Murali
4 Sri
5 Hema
6 Subbu
7 Babu

head -5 users.txt tail -1

head -5 users.txt --

1 Muthu
2 Anto
3 Murali
4 Sri
5 Hema

From this buffer -- tail -1 will give the last line output

5 Hema

Submitted by Muthu

Other methods

Lazy method

head -n4 file > tmpfile1
head -n5 file > tmpfile2
diff tmpfile1 tmpfile2 > difference

awk

awk '{ if (NR==5) print $0 }' filename

sed

sed -n '5p' filename

Thursday, December 27, 2007

How to create VBE(encrypted vbs) from VBS

You have to download the script encoder from the following site

http://www.microsoft.com/downloads/details.aspx?FamilyId=E7877F67-C447-4873-B1B0-21F0626A6329&displaylang=en

The Script Encoder is invoked on the MS-DOS command line or in the Run dialog box as follows:
SRCENC [switches] inputfile outputfile

example:
screnc test.html encode.html

Just add

<script language="VBScript.Encode"> or
<script language="JScript.Encode">

You are ready to encode the VBScript of Javascript

For more reference and details check the below sites

Using Script Encoder
http://msdn2.microsoft.com/en-us/library/cbfz3598(VS.85).aspx

Script Encoder Syntax
http://msdn2.microsoft.com/en-us/library/xw61tsx7(VS.85).aspx

Script Encoding Sample
http://msdn2.microsoft.com/en-us/library/fb2xe77x(VS.85).aspx

Extra: You can also encode ASP in this method

Tuesday, December 25, 2007

How to install Apache2 with mod_perl in Windows?

Installation of Apache2, mod_perl and PHP on a windows machine


Retrieve latest installation files at...

http://perl.apache.org/dist/win32-bin/

you want the latest version. Currently:

Perl-5.8-win32-bin-0.4.exe


Make a few directories by hand.

Decide which Volume will contain your Apache, Perl and PHP.
I have them all on their own volume as they mimic my UNIX setup
(sort of).

G:\etc\httpd <- Apaches home G:\etc\php <- PHP's home G:\usr\local <- Perl's home G:\tmp <- tmp for these apps Open the installer and change installation point to... G:\tmp [or whatever your drive letter is] And hit NEXT, this will take some time! It is expanding a *lot* of files. NEXT again, *uncheck* the 'Configure Perl/Apache2' checkbox and then FINISH (but your not) Now we have to do is move and rename them! Open your G:\tmp directory and you will see an "Apache2" and a "Perl" directory. These are what we need to move and rename. First, Apache. Move Apache2 from '/tmp' to '/etc' and then rename it 'httpd' (or not). Now move Perl from 'tmp' into '/usr' and the rename it 'local'. Once the Apache2 and Perl directories have been moved and renamed, you need to run the 'tk-config.bat' file, located in '/usr/local/bin' directory. A DOS box will appear, and then a smaller grey box will ask for various directories. The directories shown do not reflect what we have done. You will have to change the destinations by hitting the BROWSE button for both paths. Perl Directory: /usr/local <- this should be correct Apache Directory: /etc/httpd <- this you will have to change NOTE: This is a *very* important step. These paths are used to auto-define and configure the conf and ini files. now just hit the CONFIGURE button. Next a warning dialog will appear asking if it is OK to retrieve some files and build some more. OK through that. The DOS box will display some text, hesitate for a bit and tell you what it did and then ask you to... Press any key to continue . . . This DOS box will go away and a small alert will tell you that... Installation of "nmake" succeeded. OK through that. Now an alert will tell you about Apache 2 docs... OK through that. Another alert will ask you if you want to build the HTML documentation for Perl. Your choice. I said OK to that, and it took a bit of time to build the docs. I would suggest you have it build the docs for you, since it has to insert proper path information in quite a few of the files. Once that is done (and your second cup of coffee), you will be asked to configure CPAN.pm. You really should that this. It will help in the long run. Just follow the on screen instructions to complete this section of the install. But a note: the third or so question will ask you for a path to the CPAN cache directory. It is 'c:\.cpan' by default. I set it to be 'G:\usr\local\cpan.cache' I just RETURNed through the rest of the questions. Once you've selected your continent and country, it will process for a bit and the n drop to a 'cpan>' prompt.

enter 'exit' and RETURN.

This DOS box will go away.

The last thing you will see is a configuration confirmation dialog.

OK through it.

All the command boxes will go away and your Apache and mod_perl with
PHP is now installed.

But we're not done yet.

Now open /usr/local/bin/cpan.bat in your favorite editor.

Line 13 says...

#!/usr/bin/perl

change it to read...

#!/usr/local/bin/perl

SAVE and CLOSE.

There is a 'install.txt' file in the '/usr/local' directory, read
carefully, there is some good info in there.

Paragraphs 3, 4, 5 and 8 can be ignored.

Paragraphs 6 and 7 are very important. Please read carefully.

Paragraph 8 has already been completed.

One last step.

in /etc/httpd/bin' there is a file labeled 'ApacheMonitor.exe'

Copy a shortcut of this file in your STARTUP folder. This will allow
you to control your server easier.

Now your done!

How to read an entire file as a string ? - PERL

Clear $/ to allow the entire file to be read straight into your
variable:

$file = "include.dat";
my $string;
{
undef $/; # read file all at once
open (FILE, $file) die "cannot open $file: $!";
$string = ;
close FILE;
}


#set as local undef in the undef or use $/="\n"; to reset the undef

Thursday, December 20, 2007

Convert VBE to VBS - Decode VBE to VBS

This is taken from some site. I thought it could be easy for beginner or re-enginner from vbscript encode to vbs - Cut the details and rename as vbs. You should have windows script host to execute the script.
-------------------------------------------------------------------------------------

option explicit
Dim oArgs, NomFichier
'Optional argument : the encoded filename
NomFichier=""
Set oArgs = WScript.Arguments
Select Case oArgs.Count
Case 0 'No Arg, popup a dialog box to choose the file
NomFichier=BrowseForFolder("Choose an encoded file", &H4031, &H0011)
Case 1
If Instr(oArgs(0),"?")=0 Then '-? ou /? => aide
NomFichier=oArgs(0)
End If
Case Else
WScript.Echo "Too many parameters"
End Select
Set oArgs = Nothing

If NomFichier<>"" Then
Dim fso
Set fso=WScript.CreateObject("Scripting.FileSystemObject")
If fso.FileExists(NomFichier) Then
Dim fic,contenu
Set fic = fso.OpenTextFile(NomFichier, 1)
Contenu=fic.readAll
fic.close
Set fic=Nothing

Const TagInit="#@~^" '#@~^awQAAA==
Const TagFin="==^#~@" '& chr(0)
Dim DebutCode, FinCode
Do
FinCode=0
DebutCode=Instr(Contenu,TagInit)
If DebutCode>0 Then
If (Instr(DebutCode,Contenu,"==")-DebutCode)=10 Then 'If "==" follows the tag
FinCode=Instr(DebutCode,Contenu,TagFin)
If FinCode>0 Then
Contenu=Left(Contenu,DebutCode-1) & _
Decode(Mid(Contenu,DebutCode+12,FinCode-DebutCode-12-6)) & _
Mid(Contenu,FinCode+6)
End If
End If
End If
Loop Until FinCode=0
WScript.Echo Contenu
Else
WScript.Echo Nomfichier & " not found"
End If
Set fso=Nothing
Else
WScript.Echo "Please give a filename"
WScript.Echo "Usage : " & wscript.fullname & " " & WScript.ScriptFullName & " "
End If

Function Decode(Chaine)
Dim se,i,c,j,index,ChaineTemp
Dim tDecode(127)
Const Combinaison="1231232332321323132311233213233211323231311231321323112331123132"

Set se=WSCript.CreateObject("Scripting.Encoder")
For i=9 to 127
tDecode(i)="JLA"
Next
For i=9 to 127
ChaineTemp=Mid(se.EncodeScriptFile(".vbs",string(3,i),0,""),13,3)
For j=1 to 3
c=Asc(Mid(ChaineTemp,j,1))
tDecode(c)=Left(tDecode(c),j-1) & chr(i) & Mid(tDecode(c),j+1)
Next
Next
'Next line we correct a bug, otherwise a ")" could be decoded to a ">"
tDecode(42)=Left(tDecode(42),1) & ")" & Right(tDecode(42),1)
Set se=Nothing

Chaine=Replace(Replace(Chaine,"@&",chr(10)),"@#",chr(13))
Chaine=Replace(Replace(Chaine,"@*",">"),"@!","<") Chaine=Replace(Chaine,"@$","@") index=-1 For i=1 to Len(Chaine) c=asc(Mid(Chaine,i,1)) If c<128 index="index+1" c="9)">31) and (c<128))>60) and (c<>62) and (c<>64) Then
Chaine=Left(Chaine,i-1) & Mid(tDecode(c),Mid(Combinaison,(index mod 64)+1,1),1) & Mid(Chaine,i+1)
End If
End If
Next
Decode=Chaine
End Function

Function BrowseForFolder(ByVal pstrPrompt, ByVal pintBrowseType, ByVal pintLocation)
Dim ShellObject, pstrTempFolder, x
Set ShellObject=WScript.CreateObject("Shell.Application")
On Error Resume Next
Set pstrTempFolder=ShellObject.BrowseForFolder(&H0,pstrPrompt,pintBrowseType,pintLocation)
BrowseForFolder=pstrTempFolder.ParentFolder.ParseName(pstrTempFolder.Title).Path
If Err.Number<>0 Then BrowseForFolder=""
Set pstrTempFolder=Nothing
Set ShellObject=Nothing
End Function


----------------------------------------------------------------
You can write to file also

Dim objFileSystem, objOutputFile
Dim strOutputFile

' generate a filename base on the script name
strOutputFile = "temp.out"

Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)

objOutputFile.WriteLine(Contenu)
objOutputFile.Close

-------------------------------------------------------------------------------


Please let me know if you need any help

Anto