MOA

Security & Administration

Thursday, June 24, 2010

Customize your Google Search

Tuesday, June 22, 2010

Screenscraping with Python 3

import urllib.request

# reads CNN and decodes
page = urllib.request.urlopen('http://www.cnn.com/')
text = page.read().decode("utf8")

# where to find the text, change this to wherever ( would recommend using Firebug )
where = text.find('div id="cnn_mtt1lftarea"')
stopwhere = text.find('years')

# Add + how far after to print from the where and where to stop line
start= where + 28
ending = stopwhere + 7

price = text[start:ending]

print(price)

A simple Python 3 Email with google's smtp.



The code:

import smtplib
def promt(promt):
    return input(promt).strip()

# inputs the addresses
fromaddr=promt("From: ")
toaddrs=promt("To: ").strip()

print ("Enter message end with ^D (Unix) or ^Z (Winfail): ")

msg=("From: %s\r\nTo: %s\r\n\r\n"
     % (fromaddr, ", ".join(toaddrs)))

while True:       # loop
    try:
        line=input()
        except EOFError:
            break
        if not line:
            break
        msg=msg+line
print ("Message Lenght is ", len(msg))    # prints the lenght of the message
server=smtplib.SMTP("smt.gmail.com",587)   # server used to send smtp mail

server.starttls()  # tls
server.set_debuglevel(1) # remove this if you dont want to use debuglevel
server.login('emailaddr@gmail.com','Password')  # enter your smtp address and password

server.sendmail(fromaddr, toaddrs, msg)  # sends the email
server.quit()

Saturday, May 15, 2010

Sidejacking with Hamster & Ferret



Hamster is a tool for HTTP session hijacking with passive sniffing. It eavesdrops on a network, captures the session cookies, then imports them into the browser to allow you to hijack their session.

In this tutorial im using Ettercap for arpcache poisoning and H&F for stealing a session on Facebook.

Thursday, May 13, 2010

Ubuntu 10.04 - Lamp server - Drupal




Drupal, is one of the leading open-resource Content Management Systems and it is the technology that has turned into a favored range of numerous organizations worldwide.

Drupal provides numerous fantastic functions, and it is the principle logic behind why a lot of leading website pages tends to be operating on the Drupal power these days. There are several providers employed in the area associated with Drupal Development Services as well as rendering expert services centered all over Drupal. Included in this are services which include Drupal installation, Drupal improvement, Drupal template, Drupal module development, Drupal consultancy, and many others.

A couple of famous drupal sites :

CNN

The New York State Senate


MENSA

The White House

Tuesday, May 11, 2010

Install Ubuntu server-MYSQL-PHP-APACHE

Requirements :

Ubuntu 10.04 LTS Server
Internet connection

First thing you need to do is to download the ISO file from Ubuntu's homepage, click on the link above and chose your edition. Burn the ISO on a cd and reboot, Or you could try it out with Virtualbox first.

This is what you'll see after you've booted it up.

Press Install Ubuntu Server and follow the guide which is very easy.

You will be asked to install automatic security updates which i would recommend.
Press space on [ ] LAMP server.

After your done your gonna get this screen. Enter the login name and password you chose during the installation.

To try if PHP works :

cd /var/www/
sudo nano phptest.php

insert this line into the file and save it.




after that type ifconfig to see your ip adress.


connect to the page from another computer connected to the inet. at http://ipadress/phptest.php and you should see something like image above. And you can test if your apache works by http://ipadress/

optional..

[-.,.-*''*-.,,.-*''*-.,,.->


install a ssh server :

sudo apt-get install openssh-server
sudo /etc/init.d/ssh restart

ftp server:

sudo apt-get install vsftpd
sudo service vsftpd restart

the configuration file is in /etc/vsftpd.conf

webmin:

wget http://www.webmin.com/download/deb/webmin-current.deb

wget http://mirrors.kernel.org/ubuntu/pool/universe/libm/libmd5-perl/libmd5-perl_2.03-1_all.deb

sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl

sudo dpkg -i libmd5-perl_2.03-1_all.deb

sudo dpkg -i webmin_1.510_all.deb

connect to it by going to https://ipadress:10000/
change the PHP configuration to the path /etc/php5/apache2/

For security reasons i would recommend that you stop the ftp/ssh/webmin services after your done using them.

sudo /etc/init.d/ssh stop
sudo service vsftpd stop
sudo /etc/init.d/webmin stop


then use start instead of stop to start them again when you need to

[-.,.-*''*-.,,.-*''*-.,,.->

 

Useful paths & command lines :

sudo - ("su" "do") execute command and superuser.
/var/www/ - your web folder.
top - checks your cpu mem and so on..
cd - change directory.
rm - remove files.
ls - list files.
clear - clear screen.
chmod - changes access modes.
apt-get - Deb/Ubuntu software packages.
/etc/init.d/apache2 restart - restart the apache server.
service mysql restart - restart mysql server.

Monday, May 10, 2010

- [ Erasing files / hd's beyond recovery ] -

Whether your selling your computer, have a hacker girlfriend, superparanoid or just want to delete your knowledge and information about UFOs beyond recovery just deleting it wont do it.

To delete a single file use the tool Shred which usually comes preinstalled on most distributions.

Shred 'options' [filename]

options are:
-n ( number of times you want to overwrite )
-u ( remove the file after its done )
-z ( overwrite the file with only zeros to hide that it was shredded )

Example:

shred -u -z -n 10 area51.txt

if your even more paranoid and want to remove stuff from RAM and or Swap try using The Secure Delete Tools. On a Debian based system use:

sudo apt-get install secure-delete

[-.,.-*''*-.,,.-*''*-.,,.->

And so if you want to delete your entire drive download DBAN, burn and boot it up.

You will get a couple of options, i would recommend going with ENTER.


press space to chose the HD(s) you want to erase.


After that press M chose the method you want to use to erase.

For most people a quick erase is enough and will not be able to be recovered, remember that even the quick erase take loads of time. So unless you found out who shot JFK and stored the information on your computer go with something fast.