Track ftp password from tcpdump Linux

Very nice and simple:

tcpdump port ftp -l -A | egrep -i ‘pass=|pwd=|log=|login=|user=|username=|pw=|passw=|passwd=|password=|pass:|user:|username:|password:|login:|pass |user ‘ –color=auto –line-buffered -B20

nJoy  😉

Adding all new files and subdirs to svn

Sometimes you find yourself catching up with some devs who did not care to add all the stuff they should to SVN or you want to make sure all files are in SVN. Well here’s a hand script :

svn status | awk ‘{if ($1 == “?”) print $2 }’ | xargs svn add

nJoy 😉

Disabling IPv6, breaks SSH X11 Forwarding in Linux CENTOS and UBUNTU all versions

This was a weird one. It took me ages to discover why SSH X11 died at some point after tuning a box.

It so happens that disabling IPv6 ( not used on my networks) is assumed in SSH at some point and if you disable it (which many people say is a way to avoid systems using IPv6 to other boxes and ignore IPv4 provisions like firewall settings, routes etc..)

So re-enable the IPv6 in /etc/sysctl.conf or /etc/sysconfig/network or other networking script locations, if you need this functionality.

If i find any other counter indication I’ll drop a note and link.

nJoy 😉

Using Puttygen to create a ssh key and passwordless login with putty to Centos.

The ssh password-less login works in a  simple way. Though sometime people find it confusing.

The basics:

>  Client side has a private key pointed to by

>  Server side has the public key of the client.

On your client box create a public and private key set using (for putty) puttygen. (In linux all you need to use is ssh-keygen.

Please look at the page here : https://www.puttygen.com

On the server :

If not already there create a folder /<user_home>/.ssh  e.g. /root/.ssh and in that folder create a file named authorized_keys. This file will store all the public keys that a given user with matching private key, can use. Easy way echo “<paste here>” >  ~/.ssh/authorized_keys

mkdir ~/.ssh

echo “ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBz7Pml97wSzFMSr1W84rA0Mm8MY8I1jKdAmMcF4sw5GilormHJQRYI8siT1XPaLJFAO20ziZg9YrJFp+roKC34gpe1myFWUz944iucrLIQznZwPDJbMKxQXwzj1LUPmt7eXPzwM1ztvcG8HOoZlTt2B6hOAVWAHxlZNzPq/9y1Fw== rsa-key-20131124” > ~/.ssh/authorized_keys

chmod 600 ~/.ssh/authorized_keys

chmod 700 /~/.ssh

Once this is done you can add the private key to the client under ssh -> Auth -> private key.

Select back the session and save it as usual in Putty.

If you get the error “Server refused our key” it probably means you still have SElinux enabled.

To fix this:

restorecon -R -v /root/.ssh

 

That should work.

nJoy 😉

Controlling windows system from a Linux box.

Set up winexe.

wget "ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/GRNET:/synnefo/CentOS_CentOS-6/x86_64/winexe-1.00-9.1.x86_64.rpm"
yum install winexe-1.00-9.1.x86_64.rpm

 

Test the connection

<pre>telnet 10.0.0.123 139</pre>

Now we can try the system out

winexe -U "User 1" --password=secretpassword //10.0.0.123 'cmd /C "whoami"'

If you get :

ERROR: Failed to open connection - ERRDOS:ERRnomem

then it’s probably a Windows 7 box

run

 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 1 /f
 reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "Size" /t REG_DWORD /d 3 /f

on the windows box and restart.

Now try again

winexe -U "User 1" --password=secretpassword //10.0.0.123 'cmd /C "whoami"'

you should get something like :

Win7Sstem\User 1

njoy 😉

 

 

ref: http://alan.lamielle.net/2009/09/03/windows-7-nonpaged-pool-srv-error-2017

ref: http://www.decuslib.com/decus/vmslt99a/nt/tips.txt

 

Vim auto align columns

Best trick ever i found on vim :

if you start with rough space, comma delimited files to align them just type in command :

 :%!column -t

AWESOME !!!
I love VIM

nJoy ;-)

Enable SSI on Apache2 under Ubuntu

Tested on:
– Ubuntu Linux 10.10 Maverick Meerkat (2010-11-21)
– Ubuntu Linux 7.10 Gutsy Gibbon
– Ubuntu Linux 6.06 Dapper Drake
– Ubuntu Linux 5.10 Breezy Badger

 

1)  Optional: Install the Apache2 httpd server if not already installed.

sudo apt-get install apache2

2) Create the following symlink.
sudo ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled

3) Open the /sites-available/default file and add the text with the yellow background.
sudo gedit /etc/apache2/sites-available/default

...
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</Directory>
...

4) Restart Apache2 and create a SSI test file (ssi-test.shtml) and save it in the directory /var/www/.

sudo apache2ctl restart

sudo vim /var/www/ssi.shtml

<html>
<head>
<title>SSI Page</title>

</head>
<body>
<!--#echo var="DATE_LOCAL" -->
</body>
</html>

5) Test SSI in your web browser.
http://localhost/ssi.shtml

If your browser displays the local date (eg Monday, 29-Jul-2013 14:32:58 BST), SSI would be working.

Yeah !!

nJoy 😉

 

Install ffmpeg on Centos 6

Step 1 – Install ATRPMS Repository


rpm --import http://packages.atrpms.net/RPM-GPG-KEY.atrpms
rpm -Uvh http://dl.atrpms.net/el6-x86_64/atrpms/stable/atrpms-repo-6-7.el6.x86_64.rpm

Step 2 – Install FFMpeg from ATRPMS Repository


yum -y --enablerepo=atrpms install ffmpeg

Verify that you have FFMpeg installed:

ffmpeg -version


nJoy ;-)

Recording a session for a user when he / she logs in ssh

 

To start recording each session add this to the users .profile file

DATE=$(date +”%Y%m%d%H%M”)
mkdir /log/$DATE
script -t 2>/log/$DATE/bashlogs.timing -aqf /log/$DATE/bashlogs.script

 

to playback go to

/log/<timestamp>

and run

scriptreplay  bashlogs.timing bashlogs.script 3

where the 3 is the speed up factor.

nJoy;