EvilZone
Programming and Scripting => Scripting Languages => : zoup September 16, 2014, 07:33:12 PM
-
I had this idea using nmap for random scanning for a specific port.
Maybe a bit stupid but useful. This is what i did:
#!/bin/bash
port="$1"
if [ "$port" = "" ]
then
echo "port misssing"
exit
fi
f='filtered'
while [ "$f" != 'open' ]
do
a=$(nmap -sS -Pn -p $port -iR 1 -o tmp | grep $port/ ) # )
f=$(echo $a | cut -f2 -d ' ')
echo $f
done
:o
-
I had this idea using nmap for random scanning for a specific port.
Maybe a bit stupid but useful. This is what i did:
#!/bin/bash
port="$1"
if [ "$port" = "" ]
then
echo "port misssing"
exit
fi
f='filtered'
while [ "$f" != 'open' ]
do
a=$(nmap -sS -Pn -p $port -iR 1 -o tmp | grep $port/ ) # )
f=$(echo $a | cut -f2 -d ' ')
echo $f
done
:o
Nice try but I would suggest you just use NMAP's built in functions which can do what you are doing and much more and be a bit more efficient.
-
Some hint where could i start how nmap this manages ? Thank you.
-
Can you start with learning at least legible English? Thanks.
-
Some hint where could i start how nmap this manages ? Thank you.
man nmap
Also, I just relooked at your code and realized you are already using nmap for this. Why even bother making a script like this when you can just run:
nmap -sS -Pn -p 445 -T5 192.168.1.1
Or whatever. All you need is the -p 445, and it will tell you(with greater accuracy then your script) if the port is open, closed, or filtered(firewalled). Trust me, if you think of something pertaining to port or host scanning, nmap has probably thought of it already.
-
@Architect
Sorry for my bad english. I am not a native english.
Ok. I try it the nmap way. The idea behind this was that i wanted to scan RANDOM targets until
this specific port is found.
-
@Architect
Sorry for my bad english. I am not a native english.
Ok. I try it the nmap way. The idea behind this was that i wanted to scan RANDOM targets until
this specific port is found.
From the top of my head that is the -iR flag, rtfm
-
@Architect
Sorry for my bad english. I am not a native english.
Ok. I try it the nmap way. The idea behind this was that i wanted to scan RANDOM targets until
this specific port is found.
In that case try this:
nmap -iR 1000 -p 445 -n -Pn --open
-
Thank you and sorry for asking stupid questions.
-
You can just add -P 20-80 at the end of the command for whatever ports you want scanned
~APH ADMIN~
-
You can just add -P 20-80 at the end of the command for whatever ports you want scanned
~APH ADMIN~
That's not even correct information. It would be -p, not -P. Don't give out advice if you aren't 100% sure that you know what you are talking about. Spreading misinformation is the devil's work :P