bash scripting user input help (sslstrip MITM)

Data that travels over the air and how to protect (or decipher) it

bash scripting user input help (sslstrip MITM)

Post by Fatal Intuiti0n on Sun Jan 23, 2011 12:04 am
([msg=52669]see bash scripting user input help (sslstrip MITM)[/msg])

hey, this is my first post on this particular forum, and please note, i have been running linux for all of 4 or 5 days, so if the answer my question is obvious i apologize, i will be the first to admit i am a noob.

also note that i do do research while typing, and may have stumbled upon a solution while trying to work it out myself, but i tend to post things anyway as there is always a chance someone will have a better way of doing the same thing as me, and if not it may help someone else with similar questions.

i guess i will start with what i am trying to do, i am running bt4r2 and using moxiemarlin spike's sslstrip http://www.thoughtcrime.org/software/sslstrip/ to script the process of logging all traffic over a router, secure and insecure an storing it in a log on my system.. originally saw the use of sslstrip on a single target at hak5.org search sslstrip there if you want to learn more.

i have already become familiar with the process to the exent of using a yesman program to accept the wireless probes of users looking for their home network, and sending users false disconnect packets to force them onto my router. what i am trying to do now is learn some basic scripting while automating this process, then moving on to a new one.


setting up the running of ip forwarding itself is childsplay

Code: Select all
#!bin/bash

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

exit



the problem is ip tables, and arpspoofing where a specific value is required, and to a lesser extent running sslstrip as you have to redefine your listening port there, here is my train of though on how to include user input inside of a command, as all the beginner scripting i could find doesnt involve user input into commands, rather echoing basic math functions :roll:

well heres what i have got

Code: Select all
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port (need port number here right now my idea is to use a read-echo for the $REPLY but after some reading i suppose i can use a user input then utilize a

${userinput} inside of the script, something like

echo "Enter port:"
read port
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port ${port}

and do the same for the router ip address during the arp spoofing phase
now in theory that should work fine, at least in my theory :lol: and i will test it on my home network in a bit here.

but i want to know, is there another way this should/could be done?

as i stated before i have probably answered my own question but i have spent about half an hour+ typing this and surfing thru bash scripting resources and i am m sure someone else will eventually happen by with a similar issue and this thread can help them a bit as well.

thanks for your time if you read and answer this,
Fatal
Fatal Intuiti0n
New User
New User
 
Posts: 8
Joined: Sat Jan 22, 2011 10:50 pm
Blog: View Blog (0)


Re: bash scripting user input help (sslstrip MITM)

Post by insomaniacal on Sun Jan 23, 2011 7:37 am
([msg=52678]see Re: bash scripting user input help (sslstrip MITM)[/msg])

I haven't used these programs much, but you're redirecting the traffic to yourself in order to perform an attack on it and then send it on it's way aren't you? Couldn't you just hard-code the port into your script, since it will always be on your machine, and if you need to change it you simply edit the script?

If you're looking for ways to do user-input, you've got the easiest way already. You could look into using arguments in your script if you want to, but that's probably going to require a bit more code. You can read about it here if you want:

Special Variable Types - Bash
It's not who votes that counts, it's who counts the votes
insomaniacal.blog.com
User avatar
insomaniacal
Addict
Addict
 
Posts: 1210
Joined: Sun May 24, 2009 10:21 am
Blog: View Blog (0)


Re: bash scripting user input help (sslstrip MITM)

Post by Fatal Intuiti0n on Sun Jan 23, 2011 11:25 am
([msg=52682]see Re: bash scripting user input help (sslstrip MITM)[/msg])

yeah i suppose i could hard code an unused port but what im doing for this script will not always be using my own router even though its possible, so i wanted to script in an option where i enter the ip of the router i am connecting to to preform the attack.

in any case thanks for the reply and i will read thru your link too see if any of that will streamline the process when running the script, if not i will use the above.
Fatal Intuiti0n
New User
New User
 
Posts: 8
Joined: Sat Jan 22, 2011 10:50 pm
Blog: View Blog (0)


Re: bash scripting user input help (sslstrip MITM)

Post by insomaniacal on Sun Jan 23, 2011 12:03 pm
([msg=52685]see Re: bash scripting user input help (sslstrip MITM)[/msg])

If you can't totally automate it, then your first method would probably the easiest solution.
It's not who votes that counts, it's who counts the votes
insomaniacal.blog.com
User avatar
insomaniacal
Addict
Addict
 
Posts: 1210
Joined: Sun May 24, 2009 10:21 am
Blog: View Blog (0)


Re: bash scripting user input help (sslstrip MITM)

Post by Fatal Intuiti0n on Sun Jan 23, 2011 12:32 pm
([msg=52687]see Re: bash scripting user input help (sslstrip MITM)[/msg])

for now i will probably be using user input, but i just had a thought, can you input wlan0 instead of say 192.168.2.1 during arp spoofing

and unfortunately you can not so it looks like user input will be the way to go.
Fatal Intuiti0n
New User
New User
 
Posts: 8
Joined: Sat Jan 22, 2011 10:50 pm
Blog: View Blog (0)


Re: bash scripting user input help (sslstrip MITM)

Post by Goatboy on Sun Jan 23, 2011 6:59 pm
([msg=52715]see Re: bash scripting user input help (sslstrip MITM)[/msg])

I would define variables at the top of the script and use them throughout. This way if you need to change an IP or an interface, you can change it once at the top and not risk mistyping once or missing it somewhere.
Assume that everything I say is or could be a lie.
1UHQ15HqBRZFykqx7mKHpYroxanLjJcUk
User avatar
Goatboy
Expert
Expert
 
Posts: 2752
Joined: Mon Jul 07, 2008 9:35 pm
Blog: View Blog (0)



Return to Networking

Who is online

Users browsing this forum: No registered users and 0 guests