środa, 26 października 2011

Install Postgres-8.4 Debian 6

apt-get update
apt-get install debian-backports-keyring
apt-get install -t lenny-backports postgresql-8.4 phppgadmin

You'll notice that I've added phppgadmin (a Php written frontend for the DB, somewhat similar to the mysql one), remove it in case you didn't need it or hadn't Apache installed).
Let's go on with the shell! (commented lines will briefly explain what happens)

#let's stop the main daemon to avoid mess
/etc/init.d/postgresql-8.4 stop

# now let's login as the postgres user (in order to start interacting with the db)
# By default uses the same pwd as root, maybe better changing it (for clarity I'll add postgres$ before the commands)

su postgres

# this command will allow us to initiate a new database in a custom location (/my/db/path/ has to be replaced with your personal one)

postgres$ /usr/lib/postgresql/8.4/bin/initdb -D /my/db/path/

# once created our shiny new base, let's create a user to start using it (give it admin rights when prompted)

postgres$ createuser pguser

# let's change the new user's password. psql command connects to the new db and allows to manage it

postgres$ psql postgres

# once logged into the db use this command to change new user's passphrase

template1=# \password pguser;
template1=# \q

#let's get back to our root

postgres$ exit

#this passage is fundamental to get things working, it links our custom db's conf to the one the daemon will read

ln -s /my/db/path/postgresql.conf /etc/postgresql/8.4/main/postgresql.conf

Don't forget to replace ConfigDir with your personal one, on /my/db/path/postgresql.conf

Now, in order to use Phppgadmin safely, we've to change the default security behavior (if not Phppgadmin will accept random passwords to login)
On our /my/db/path/pg_hba.conf we'll have to look for the last lines where the hosts are listed and change METHOD to md5 (default should be trust)
Let's finally start the DB

/etc/init.d/postgresql-8.4 start

poniedziałek, 24 października 2011

Convert *.vhd to *.vmdk

Winimage przynajmniej 8.5

Xenserver - export obraz maszyny

winimage 8.5 przekonwertowanie do vmdk

ESX tworzymy new VM tylko nie tworzymy nowego dysku tylko podpinamy istniejacy wysłany na macierz

czwartek, 20 października 2011

Vmtools i Xentools Debian 6

Vmware

echo deb http://debian.uchicago.edu/debian/ squeeze main contrib >> /etc/apt/sources.list
echo deb-src http://debian.uchicago.edu/debian/ squeeze main contrib >> /etc/apt/sources.list

apt-get update
apt-get install open-vm-tools open-vm-source

module-assistant auto-install open-vm -i

XenServer

apt-get install xen-tools


I used this to install VMware tools to CentOS 6.2 on ESXi 4.1
Add VMware GPG keys:
rpm --import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub
rpm --import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub
Edit /etc/yum.repos.d/vmware-tools.repo:
[vmware-tools]
name=VMware Tools
baseurl=http://packages.vmware.com/tools/esx/4.1latest/rhel6/$basearch
enabled=1
gpgcheck=1
Install VMware Tools:
yum install vmware-open-vm-tools-nox

środa, 19 października 2011

VBS podstawy

http://msdn.microsoft.com/en-us/library/7w5tbs5z(v=VS.85).aspx


skrypt

set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "\\fs\NETLOGON\dot4.exe"
WScript.Sleep 15000
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys " " <-- SPACE :)
WScript.Sleep 500
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"

Debian gnome root

/etc/gdm3/daemon.conf:


[security]
AllowRoot=true


disable 5 line in /etc/pam.d/gdm3:


#%PAM-1.0
auth requisite pam_nologin.so
auth required pam_env.so readenv=1
auth required pam_env.so readenv=1 envfile=/etc/default/locale
#auth required pam_succeed_if.so user != root quiet_success
@include common-auth
auth optional pam_gnome_keyring.so
@include common-account
session required pam_limits.so
@include common-session
session optional pam_gnome_keyring.so auto_start
@include common-password

czwartek, 13 października 2011

Network miner Ubuntu

shell>sudo apt-get install wine wine-dev cabextract

Configure Wine -

shell>winecfg

In Application tab, change windows version to Windows 2000

shell>wget http://kegel.com/wine/winetricks

Install cofefronts and .net framework 2.0 -

shell>sh winetricks corefonts dotnet20

Download NetworkMiner -

shell>wget \
http://sourceforge.net/project/showfiles.php?group_id=189429

Unzip it and run -

shell>wine NetworkMiner.exe

MBR dd i W7

full hard disk copy

dd if=/dev/hdx of=/dev/hdy
dd if=/dev/hdx of=/path/to/image
dd if=/dev/hdx | gzip > /path/to/image.gz

Hdx could be hda, hdb etc. In the second example gzip is used to compress the image if it is really just a backup.

Restore Backup of hard disk copy

dd if=/path/to/image of=/dev/hdx

gzip -dc /path/to/image.gz | dd of=/dev/hdx

MBR backup

In order to backup only the first few bytes containing the MBR and the partition table you can use dd as well.

dd if=/dev/hdx of=/path/to/image count=1 bs=512

MBR restore

dd if=/path/to/image of=/dev/hdx

Add "count=1 bs=446" to exclude the partition table from being written to disk. You can manually restore the table.

WINDOWS 7

bootrec /fixmbr

bootrec /fixboot

bootrec /rebuildbcd