Author Topic: [Tutorial] Portscanning Fun - Listings  (Read 10388 times)

0 Members and 1 Guest are viewing this topic.

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
[Tutorial] Portscanning Fun - Listings
« on: December 20, 2011, 10:42:31 pm »
[Tutorial] Portscanning Fun - IP listings
(A HowDoI*-document)

*I prefer HowDoI instead of Tutorial, because it isn't a tutorial.. just how I do it.. :P

Needed:
 - linux/cygwin
 - geoipgen 0.4 (see [Tutorial] Portscanning Fun for installtion guide)
 - nmap (try to install newest - SVN base just changed this week!,
     
Code: [Select]
svn co https://svn.nmap.org/nmap        windows version can be used, but mind the lack of RAW package use)
 
I explained earlier how to get some country specific ip's from geoipgen.
Code: [Select]
./geoipgen -n 5000 NL > 5000_ip_nl.txt.. will result in a ip list of 5000 dutch ip's.

note: to get random ip's you can use NMap's command -iR <num random ports>,
     
Code: [Select]
sudo nmap -iR 5000 -sC -p 21 --script=ftp-anon,banner -PN -n -oN output.txt     will scan for anon ftp acces without resolve dns (faster), no port open scan (just try)
     on 5000 random ip's.  (choose -iL <iplist> for specific ip's - gathered from geoipgen)
     
My Workingdir is getting messy with al those lists, scans, ect.
let's get it clean and thight..

I want to target dutch ip's in this example.
You can ofcourse change everything for your own needs.

first create a main working dir

Code: [Select]
mkdir ip_fungo to dir

and make a data dir for your ip-lists
Code: [Select]
mkdir ips
ok, because of the size of our possibilities I'm gonna make a list of ip's-list files.
I'm gonna make ip lists of 50000 ip's and 50 of them.
(Or less.. choose what you need.. I want a big list, so I go for 50 files of 50000 ip's (2.500.000 ip's))

make a bash script:
Code: [Select]
#!/bin/bash
COUNTER=0
while [  $COUNTER -lt 50 ]; do
  let COUNTER=COUNTER+1
  ./geoipgen -n 50000 nl > nl_50000_"$COUNTER".txt
done
this will make me a list of 50 files named nl_50000_<num>.txt

move these to your new-made dir
/ip_fun/ips


now you can scan a little more specific and faster.

let's try.....
nmap scan for anonymous ftp acces and juicy files. (one of my favorite :P )
Code: [Select]
sudo nmap -iL /ip_fun/ips/nl_50000_1.txt -v -n -sS --open -p 21 -PN --script=ftp-anon,banner -oN /ip_fun/nmap_p21_scan.txt
or port 80 scan
Code: [Select]
sudo nmap -iL /ip_fun/ips/nl_50000_1.txt -v -n -sS --open -p 80,8080 -PN --script=banner,http-headers,http-favicon,http-malware-host,http-enum,http-robots.txt,http-php-version,http-usedir-enum,http-trace,http-auth,address-info -oN /ip_fun/nl_50000_1.scan_port80.txtnote: if you use nmap for windows, it's an older version and not all the scripts are added.
     http-robots,http-php-version,http-usedir-enum are recently.

To get some automated scans ordely I suggest the following structure
(This is how I do it)


First I scan some of my ip lists.
I make another dir in ip_fun.
Code: [Select]
mkdir scansI'm in to the port 21 for looking around in other peoples stuff.. :D
I made a small automating script for this *mind that I use .txt extension for this use.
Code: [Select]
#!/bin/bash
# $1 : ipfile list WITHOUT extension (cause output file uses same name)
sudo nmap -v -iL ips/"$1".txt -Pn -n -p 21 -oN scans/"$1".scan_port21.txt --script=ftp-anon,banner,ftp-proftpd-backdoor,ftp-vsftpd-backdoor --open -sC
safe this in: /ip_fun/scan_p21.sh
now hit off with
(filename can be different ofcourse)
./scan_p21 nl_50000_01
./scan_p21 nl_50000_02
./scan_p21 nl_50000_03
./scan_p21 nl_50000_04
./scan_p21 nl_50000_05

that will give me 5*50000 scanned ip's for port 21
listed at /ip_fun/scans/*.scan_port21.txt

You can manualy read them or grep for nice things.
(nmap's output is Normal (you can use -oG for easier grepping) but I choose this method for my manualy reading)
camera's
Code: [Select]
cat *.txt | grep -B 5 -i "camera" | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | grep -v "192.168" | sort -g | uniq > searches/cameras.txtyou see I made a different dir for the output (else the further searches will have those outputs also.
this will result in a sorted IP list of the gives search.

or NAS (harddrives)
Code: [Select]
cat *.txt | grep -B 5 -i "nas" | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | grep -v "192.168" | sort -g | uniq > searches/nas.txt     

or just search for a ftp server you know how to exploit
there a lot of exploitable ftp servers.
eg. ProFTPD 1.3.1 (in some cases vurnerable to sql injection by password and name input )
(http://www.hackerscenter.com/index.php?/Feeds/Exploits/ProFTPD-mod_sql-Username-SQL-Injection-Vulnerability.html)
Code: [Select]
cat *.txt | grep -B 5 -i "proftpd 1.3.0" | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | grep -v "192.168" | sort -g | uniq > searches/proftpd_1.3.1.txt     

short code explanation:
first grep is the search keyword (-B 5 is for 5 lines before finding, need to have the ip ;-))
second grep is the IP grep, third grep is to check if ip starts with 192.168. if so, don't output.. don't need them..

ofcourse I script this.. :-D
Code: [Select]
#!/bin/bash
# $1: keyword search
cat *.txt | grep -B 5 -i "$1" | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | grep -v "192.168" | sort -g | uniq > searches/"$1".txt
try dreambox, disk, ect.

I just finished 50 ip-lists of 50000 ip's on port 21.
and I truly did find some juicy files ..
rofl.. I even found a usb-drive backup from a head of the police in amsterdam/rijnland.
EPIC fun.. :D
(no I will not share it :P )

notes:
- a lot of nas/harddrives has password web protected authentication, but FTP anonymous login
  possibilities. (enough exploits on the web to jump out of the anony-box and run free on their servers/drives.
- dreamboxes are fun to watch. television. (you can change their actualy viewing channels remote,  (and send them on-screen messages. fun!)
- a lot of music, movies, iso's are shared.
- people don't like updates. so a lot of old software is in use.
- port 21 info can say a lot about the running server, if it looks interesting scan some more
  (port 80,8080,443,110,etc)

a short overview:
after this I have a path structure of
/ip_fun/
   /ips
   /scans
   /searches
 
with a lof of ip files in ips, scan info in 'scans' and my search results in searches.



 
I'm just a beginner at this.. I just share my experiences..
feel free to critisize or add to my ideas..
« Last Edit: December 20, 2011, 10:48:48 pm by neusbeer »
--Neusbeer

Offline sp0rk

  • Serf
  • *
  • Posts: 38
  • Cookies: -1
    • View Profile
Re: [Tutorial] Portscanning Fun - Listings
« Reply #1 on: December 24, 2011, 06:10:37 am »
I'm really new to shell scripting, when you say "of course I script this" do you save it as an .sh file?

Welcome. Sit on the couch in the corner and I'll bring in the bitches.

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
Re: [Tutorial] Portscanning Fun - Listings
« Reply #2 on: December 24, 2011, 11:43:38 pm »
yes. .sh (or without) but a bash-script indeed..
If you are a windows user I can advice to install cygwin (www.cygwin.com)
easy install.. lot's of linux stuff!
actualy it's a kinda linux..


Google a lot for bash scripts/tutorials..
It's so handy when using large teksts files,

scanning stuff.


And what I ment here was .. like.. every command you use more than ones
you can use it with a script. saves typing work :D
--Neusbeer

Offline -Konvict-

  • /dev/null
  • *
  • Posts: 6
  • Cookies: 0
    • View Profile
Re: [Tutorial] Portscanning Fun - Listings
« Reply #3 on: April 07, 2012, 09:18:33 pm »
This is a very good Nmap tutorial however when i look through the output of the 10,000 ip's I scanned port 21 on their was only 4 ftp's that told me service version? Is that just bad luck?

zohraan

  • Guest
Re: [Tutorial] Portscanning Fun - Listings
« Reply #4 on: April 07, 2012, 09:21:16 pm »
I am looking forward to see more posts about Nmap and Metasploit, its an awesome knowledge, no doubt. Thanks !

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
Re: [Tutorial] Portscanning Fun - Listings
« Reply #5 on: April 08, 2012, 08:32:45 pm »
This is a very good Nmap tutorial however when i look through the output of the 10,000 ip's I scanned port 21 on their was only 4 ftp's that told me service version? Is that just bad luck?
Bad luck or not using the right options.
-sV for service scan.
and --version-all for all the possible probes. also you need the latest nmap version.


add --script=banner,ftp-anon
first for banner grabbing and second to check if anonymous access is allowed.
(last gave me a lot of NAS and other drives)


@zohraan .. I can add more, any specific things?
--Neusbeer

Offline Dreamer

  • Serf
  • *
  • Posts: 22
  • Cookies: 2
    • View Profile
Re: [Tutorial] Portscanning Fun - Listings
« Reply #6 on: April 08, 2012, 10:02:24 pm »
I would like to see different ports their could be vulnerable services on?

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
Re: [Tutorial] Portscanning Fun - Listings
« Reply #7 on: April 08, 2012, 11:28:50 pm »
In my opinion is nmap more for identification of the service running.
for findings flaws (execpt a few) it isn't the best 'scanner'.
Then you should check Nessus, OpenVas, NeXpose, w3af, Metasploit, etc.
--Neusbeer

Offline Dreamer

  • Serf
  • *
  • Posts: 22
  • Cookies: 2
    • View Profile
Re: [Tutorial] Portscanning Fun - Listings
« Reply #8 on: April 09, 2012, 12:50:01 am »
what I'm was trying to say is port 21 is well known for having ftp, and theirs plenty of hacking oppurtunities, from exploits to anonymous logins.
I was wondering is their any other ports like that?

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Tutorial] Portscanning Fun - Listings
« Reply #9 on: April 09, 2012, 10:36:34 am »
what I'm was trying to say is port 21 is well known for having ftp, and theirs plenty of hacking oppurtunities, from exploits to anonymous logins.
I was wondering is their any other ports like that?
All of them that have services running. All of them were/are/will be vulnerable at some point.

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
Re: [Tutorial] Portscanning Fun - Listings
« Reply #10 on: April 13, 2012, 02:18:28 pm »
That's why port scanning is so important with a good pentest :D
--Neusbeer

Offline no47

  • NULL
  • Posts: 2
  • Cookies: -5
    • View Profile
Re: [Tutorial] Portscanning Fun - Listings
« Reply #11 on: April 20, 2013, 08:27:44 pm »
nice one...keep it up :)
 

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [Tutorial] Portscanning Fun - Listings
« Reply #12 on: April 20, 2013, 10:36:35 pm »
April 13, 2012
Thats the date of the last post here.
Dont go skullraping like that.
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline bad iraq

  • NULL
  • Posts: 2
  • Cookies: -5
    • View Profile
Re: [Tutorial] Portscanning Fun - Listings
« Reply #13 on: April 20, 2013, 11:02:40 pm »
what can i get from the port???
how can i exploit?
iraq only for shi3a
peac ah

Offline Snayler

  • Baron
  • ****
  • Posts: 812
  • Cookies: 135
    • View Profile
Re: [Tutorial] Portscanning Fun - Listings
« Reply #14 on: April 20, 2013, 11:19:26 pm »
what can i get from the port???
how can i exploit?
Y U NO STOP GRAVEDIGGING?!?!