In a project i was made to list a number of live ips among many ips, how do I do it?
Nmap scan report for 196.43.196.9
Host is up (0.00016s latency).
Nmap scan report for 196.43.196.10
Host is up (1.1s latency).
Nmap scan report for ns1.aiti-kace.com.gh (196.43.196.11)
Host is up (0.044s latency).
Nmap scan report for ns2.aiti-kace.com.gh (196.43.196.12)
Host is up (0.00012s latency).
Nmap scan report for 196.43.196.13
Host is up (0.00029s latency).
Nmap scan report for 196.43.196.14
Host is up (0.0017s latency).
Nmap scan report for mail.aiti-kace.com.gh (196.43.196.15)
Host is up (0.033s latency).
Nmap scan report for 196.43.196.16
Host is up (0.00097s latency).
nmap 196.43.196.24
Related
I have tried to connect to a digilent ZedBoard using my host PC, which I can do using UART, but I am not able to ssh into the board or further use my host PC internet connection to access the internet through the ZedBoard.
Zedboard is running: Xillinux distribution for Zynq-7000 EPP
Host PC is running: Ubuntu 16.04
How should I set this up?
We will go through the steps of communicating to a digilent Zedboard using the UART and the Ethernet port.
Using UART port
Connect the host (USB) to the zedboard's UART port (micro USB) and execute on the host:
# Install minicom
apt update && apt install minicom
minicom –D /dev/ttyACM0 –b 115200 -8 -o
Congratulations, you are connected to the zedboard
* For minicom help: CTRL+a z
* To exit minicom CTRL+a x
Connect using the board's ethernet port
Connect the zedboard to the host using the ethernet port on the host system, or an ethernet to usb adapter.
By default the zedboard's os has eth0 cunfigured to have the static ip of: 192.168.1.10
Configure on the host:
Network Connections > (Select the connection interface to the zedboard) > Edit > IPv4 Settings:
Change Method to Manual
Edit Address to: 192.168.1.1
Edit Netmask to: 255.255.255.0
Use the menu on the host to disconnect and connect to the interface that you have just configured.
Connect to the board by: ssh root#192.168.1.10
Share your PC's internet with the zedboard
Network Connections > (Select the connection interface) > Edit > IPv4 Settings:
* Change Method to Share to other computers
Use the menu on the host to disconnect and connect to the interface that you have just configured
execute ip addr and confirm the ip of the connection interface that is being shared
10.42.0.1 in my machine (this may be different in your machine)
Use minicom to connect to the board (see above).
In the ZedBoard:
Edit the file /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.42.0.10
netmask 255.255.255.0
gateway 10.42.0.1
And fix your DNS resolver by editing the file /etc/resolv.conf to
nameserver 10.42.0.1
Execute the command to change the configurations of your zedboard
ifdown eth0; ifup eth0
And voiala! At this point should would be able to ping your host at:
root#localhost:~# ping 10.42.0.1
PING 10.42.0.1 (10.42.0.1) 56(84) bytes of data.
64 bytes from 10.42.0.1: icmp_req=1 ttl=64 time=0.424 ms
64 bytes from 10.42.0.1: icmp_req=2 ttl=64 time=0.498 ms
Ping a internet hosted website 8.8.8.8 through your host connection:
root#localhost:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=53 time=6.93 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=53 time=6.89 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=53 time=7.22 ms
And if you have setup /etc/resolv.conf correctly you can also access the internet using full domain names:
root#localhost:~# ping www.google.com
PING www.google.com (172.217.10.132) 56(84) bytes of data.
64 bytes from lga34s16-in-f4.1e100.net (172.217.10.132): icmp_req=1 ttl=53 time=7.02 ms
64 bytes from lga34s16-in-f4.1e100.net (172.217.10.132): icmp_req=2 ttl=53 time=7.20 ms
Additional notes
Files to keep in mind
/etc/network/interfaces describes the network interfaces
/etc/hostname configures the nameserver credentials
/etc/hosts resolves IP addresses to hostnames
/etc/resolv.conf configure your DNS resolver
I am trying to setup the docker which can successfully scan the subnet device's mac address by using nmap. And I've spent 3 days to figure out how to do it but still failed.
For example:
The host IP: 10.19.201.123
The device IP: 10.19.201.101
I've setup docker container which can ping 10.19.201.123 and 10.19.201.101 both successfully. But when I use nmap to scan mac address from docker container, I got below:
~$sudo nmap -sP 10.19.201.101
Starting Nmap 7.01 ( https://nmap.org ) at 2018-05-29 08:57 UTC
Nmap scan report for 10.19.201.101
Host is up (0.00088s latency).
Nmap done: 1 IP address (1 host up) scanned in 0.39 seconds
However, if I use nmap to scan mac address from VM (10.19.201.100), I got:
~$sudo nmap -sP 10.19.201.101
Starting Nmap 7.01 ( https://nmap.org ) at 2018-05-29 17:16 CST
Nmap scan report for 10.19.201.101
Host is up (0.00020s latency).
MAC Address: 0F:01:H5:W3:0G:J5(ICP Electronics)
Nmap done: 1 IP address (1 host up) scanned in 0.32 seconds
PLEASE, who can help or give prompts of how to do it?
For who is still struggling with this issue, I've figured out how to do it on Windows 10.
The solution is to make the container running on the same LAN as your local host, so nmap can scan the LAN device successfully. Below is the way to make your docker container run on the host LAN.
Windows 10 HOME
Change the virtual box setting
Stop VM first by administrator docker-machine stop default
Open Virtual Box
Select default VM and click Settings
Go to Network page, and enable new Network Adapter on Adapter 3
(DO NOT CHANGE Adapter 1 & 2)
Attached Adapter 3 to bridged Adapter with your physical network and click OK
Start VM by administrator docker-machine start default
Open Docker Quickstart Terminal to run container, the new container should be run on the LAN now.
Windows 10 PROFESSIONAL/ENTERPRISE
Create vSwitch with physical network adapter
Open Hyper-V Manager
Action list- > Open Virtual Switch Manager
Create new virtual switch -> select Type: External
Assign your physical network adapter to the vSwitch
Check "Allow management operating system to share this network adapter" and apply change
Go to Control Panel\All Control Panel Items\Network Connections.
Check the vEthernet you just created, and make sure the IPV4 setting is correct. (sometimes the dhcp setting will be empty and you need to reset again here)
Go back to Hyper-V Manager, and go into Setting page of MobyLinuxVM (ensure it's shut down, if it's not, Quit Docker)
Add Hardware > Network Adapter, select the vSwitch you just created and apply change
Modify Docker source code
Find the MobyLinux creation file: MobyLinux.ps1
(normally it's located at: X:\Program Files\Docker\Docker\resources)
Edit the file, and find the function: function New-MobyLinuxVM
Find below line in the function:
$vmNetAdapter = $vm | Hyper-V\Get-VMNetworkAdapter
Update it to:
$vmNetAdapter = $vm | Hyper-V\Get-VMNetworkAdapter | Select-Object -First 1
Save file by administrator
Restart Docker, and the container should run on the LAN now.
docker ps says there are three ports forwarded:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
06584d4ad44e quay.io/coreos/etcd:v3.1.8 "etcd -name etcd01..." 2 days ago Up 3 minutes 0.0.0.0:2379-2380->2379-2380/tcp, 0.0.0.0:4001->4001/tcp etcd01
But nmap -sT 127.0.0.1 can only find the 4001:
Starting Nmap 7.40 ( https://nmap.org ) at 2017-06-13 00:06 CEST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0011s latency).
Not shown: 969 closed ports, 30 filtered ports
PORT STATE SERVICE
4001/tcp open newoak
How comes? Can I verify if the ports are there in another way?
nmap doesn't scan all ports by default.
As you can see, it only scanned 1000 ports: 969 (closed) + 30 (filtered) + 1 (open).
To really scan all ports, you should specify use the -p option like this: -p1-65535. It may take a while, though... Customize the options to make it faster. You need to run as root for TCP SYN scan. The default TCP Connect is slower.
Do not use nmap for knowing which ports are opened when you're in the host. Use either netstat (deprecated) as in netstat -tunlp or ss (which accepts most of the same options as netstat): ss -tunlp. The options are nmemonic:
-t for TCP
-u for UDP
-n for numeric
-l for listening ports
-p for PID's
I run a docker container with the following command:
docker run -d --name frontend_service -net host --publish=3001:3000 frontend_service
As I understand it maps the local port 3001 to the container port 3000.
I already ssh to the container and checked curl localhost:3000. Works. But outside, on the host, I can't curl localhost:3001.
I checked nmap. The port is open:
nmap -v -sT localhost
Starting Nmap 6.47 ( http://nmap.org ) at 2016-10-19 01:24 UTC
Initiating Connect Scan at 01:24
Scanning localhost (127.0.0.1) [1000 ports]
Discovered open port 25/tcp on 127.0.0.1
Discovered open port 22/tcp on 127.0.0.1
Discovered open port 5051/tcp on 127.0.0.1
Discovered open port 3001/tcp on 127.0.0.1
Completed Connect Scan at 01:24, 0.06s elapsed (1000 total ports)
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0011s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
3001/tcp open nessus
5051/tcp open ida-agent
How can i connect the container port with my host port?
When you specify --net=host, you are completely turning off Docker's network setup steps. The container won't get its own network namespace, won't get its own interfaces, and the port publishing system will have nothing to route to.
If you want your -p 3001:3000 to work, don't use --net=host.
I'm needing to ping about 2500 servers at one time, in intervals of about 15-30 minutes. This is to show semi-real time server status information. This could potentially scale to tens of thousands of sites eventually, so I need to keep that in mind while thinking about this.
I'm using an Ubuntu 10.10 VPS (Bash) and using Ruby.
Is there any way to go about doing this?
Edit: I should also note that I only care if the server is online. So first packet received should suffice.
I'd consider shelling to nmap or its like. It's well tuned to that purpose, being quite fast, and it contains enough different ways to ping to satisfy any need. Here's using nmap to discover all hosts on a segment of my network:
wayne#treebeard:~$ nmap -sP 10.0.0.0/24
Starting Nmap 5.00 ( http://nmap.org ) at 2010-12-08 09:16 MST
Host gw (10.0.0.1) is up (0.00036s latency).
Host 10.0.0.2 is up (0.0071s latency).
Host isengard.internal.databill.com (10.0.0.3) is up (0.00062s latency).
...
Host arod.internal.databill.com (10.0.0.189) is up (0.0046s latency).
Host 10.0.0.254 is up (0.00042s latency).
Nmap done: 256 IP addresses (43 hosts up) scanned in 3.00 seconds
Here we've scanned for all hosts from 10.0.0.0 through 10.0.0.255.
-sP is a "ping scan", a pretty generic host discovery mechanism that can be run as an ordinary user. There are other types of scan that nmap does, many of them needing root privileges.
In Ruby, you'll use backtick or IO.popen to run nmap and capture its results:
output = `nmap -sP 10.0.0.0/24
output.each_line.find_all do |lines|
line =~ /^Host/
end.each do |line|
# Whatever you want to do for each host
end
If you supply the -oX switch, nmap will output xml, which may be easier to parse (thanks, tadman).