Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, i'am a new newbie in linux, i need a help in Bash Scripting, in nmap, i cant exectue an IP i want, on this script, it execute 0.0.0.0 and it says :
setup_target: failed to determine route to 0.0.0.....
Thank you, if anyone could help me.
Script is this :
#!/bin/bash
echo "Type 1 to go PortScan"
read aaa
if [ $aaa = "1" ]
then
echo "Type IP"
read nmapp
nmap $?/22 $nmapp
fi
I'm not sure what you think this line is supposed to do:
[CODE]nmap $?/22 $nmapp[\CODE]
If your intent is to check port 22 on the IP provided the line should be:
[CODE]nmap -p 22 $nmapp[\CODE]
$? means the return code from the previous command which would be zero (0) if successful. Your use of $? therefore is saying check IP 0 which expands to 0.0.0.0 which is why you see the errors.
If you run "man nmap" you can see documentation for the way to use this command.
I'm not sure what you think this line is supposed to do:
[CODE]nmap $?/22 $nmapp[\CODE]
If your intent is to check port 22 on the IP provided the line should be:
[CODE]nmap -p 22 $nmapp[\CODE]
$? means the return code from the previous command which would be zero (0) if successful. Your use of $? therefore is saying check IP 0 which expands to 0.0.0.0 which is why you see the errors.
If you run "man nmap" you can see documentation for the way to use this command.
Well u helped me alot with that -p but i want to listen all ports on example 127.0.0.* there, do u understand, if u can help me beacuse that -p helped me alot. Thank you, if u have anyidea please reply
Well u helped me alot with that -p but i want to listen all ports on example 127.0.0.* there, do u understand, if u can help me beacuse that -p helped me alot. Thank you, if u have anyidea please reply
Just leave out the -p. It will then scan all ports. If you want to scan an ip range, you can specify it like so:
Code:
nmap 127.0.0.1-255
(although this ip range does not really make a lot of sense).
Alternatively, you can also use the netmask like so:
Code:
nmap 127.0.0.1/24
On a separate note please spell out your words completely / avoid using text message speak. This is considered impolite in this forum.
Just leave out the -p. It will then scan all ports. If you want to scan an ip range, you can specify it like so:
Code:
nmap 127.0.0.1-255
(although this ip range does not really make a lot of sense).
Alternatively, you can also use the netmask like so:
Code:
nmap 127.0.0.1/24
On a separate note please spell out your words completely / avoid using text message speak. This is considered impolite in this forum.
Yeah i try with script but it dosnt work, to scan all ports on that range, i dont know why
#!/bin/bash
echo "Shtypni 1 per te vazhduar NMAP"
read file
if [ $file = "1" ]
then
echo "[+]Shtyp IP[+]"
read nmapp
nmap /24 $nmapp
echo "[+]Scanimi perfundoi[+]"
fi
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.