ip-address

How to get IP of all hosts in LAN?

♀尐吖头ヾ 提交于 2019-12-27 19:12:40
问题 I need to list IP addresses of all connected hosts in my LAN. What is the simplest way to do this? 回答1: You'll have to do a ping sweep. There's a Ping class in the System.Net namespace. Example follows. Also this is only possible if your computers don't have firewalls running. If they've got a firewall enabled, there's no way to determine this information short of doing SNMP queries on your switches. System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping(); System.Net

Get IP address of visitors using Flask for Python

随声附和 提交于 2019-12-27 10:19:10
问题 I'm making a website where users can log on and download files, using the Flask micro-framework (based on Werkzeug) which uses Python (2.6 in my case). I need to get the IP address of users when they log on (for logging purposes). Does anyone know how to do this? Surely there is a way to do it with Python? 回答1: See the documentation on how to access the Request object and then get from this same Request object, the attribute remote_addr . Code example from flask import request from flask

Python: Efficient way to compare ip addresses in a csv file

∥☆過路亽.° 提交于 2019-12-25 18:46:13
问题 I have a csv file which has the list of the following ip addresses: SSH IP NFS IP iSCSI IP 10.xxx.xxx.aaa 172.xxx.xxx.aaa 172.yyy.xxx.aaa 10.xxx.xxx.bbb 172.xxx.xxx.bbb 172.yyy.xxx.bbb 10.xxx.xxx.ccc 172.xxx.xxx.ccc 172.yyy.xxx.ccc 10.xxx.xxx.ddd 172.xxx.xxx.ddd 172.yyy.xxx.ddd ... ... ... ... ... ... I want to compare the last octets in SSH IP, NFS IP and iSCSI IP and if they match, i want to execute a few commands, by ssh'ing into the box. I want to know the most efficient way to compare

Get IP Address on Monotouch/Xamarin in iphone via linq

限于喜欢 提交于 2019-12-25 18:40:44
问题 I'm new to linq, and want to use it to get the ip address of an iOS device. I was wondering if anyone sees any problems with this approach (based on this How do I get the network interface and its right IPv4 address? ) or if there is a better/more compact/more clean way to do it. // get my IP string ip = NetworkInterface.GetAllNetworkInterfaces() .Where(x => x.Name.Equals("en0")) .Select(n => n.GetIPProperties().UnicastAddresses) .Where(x => x.First().Address.AddressFamily == System.Net

Editing csv file to edit subnets so there is no overlap in IP ranges (ipaddress module in Python 3.3)

ⅰ亾dé卋堺 提交于 2019-12-25 18:39:02
问题 I have been trying to create a csv file that will change all the subnets and IP address ranges so none overlap. I have this file to start: Zone Name, IPStart, IPStop,Range,Source Group A,10.0.0.0,10.127.255.255,10.0.0.0/9,New List Group A Sales,10.16.0.0,10.31.255.255,10.16.0.0/12,New List Group A Marketing,10.62.0.0,10.62.255.255,10.62.0.0/16,New List Group A Research,10.62.0.0,10.63.255.255,10.62.0.0/15,Old List Group A Sales Primary routers,10.23.1.0,10.23.1.15,10.24.1.0/28,New List Group

Get IP of connection in socket.io 1.4.5

独自空忆成欢 提交于 2019-12-25 09:13:51
问题 I would like to know how to get the IP of a user when they connect to the server n socket.io. I have tried using this code which is supposed to log the connection address and port like this: var io = require('socket.io')(serv, {}); io.sockets.on('connection', function(socket) { var address = socket.handshake.address; console.log('New connection from ' + address.address + ':' + address.port); socket.on('request', function(data) { console.log('Request Sent') length = data.length if (data

Limitation of MAC addresses

百般思念 提交于 2019-12-25 09:05:23
问题 A mac address is of only 48 bits. That means there can be only 2 power 48 mac addresses. If for every computer/laptops if the mac address is unique, then there can be only 2 power 48 computers/laptops which is contradicting!! help me out 来源: https://stackoverflow.com/questions/39038010/limitation-of-mac-addresses

how to set node.js as a service on a private server?[can't access the node application]

谁说我不能喝 提交于 2019-12-25 07:36:02
问题 I have a problem when deploying my node.js on a private server. I just can't access it when i type the ip:5000 in the browser. This is what netstat shows: Destination Gateway Genmask Flags MSS Window irtt Iface 126.0.54.248 0.0.0.0 255.255.255.248 U 0 0 0 eth1 0.0.0.0 126.0.54.249 0.0.0.0 UG 0 0 0 eth1 And this is my node.js code: var express = require('express'); var app = express(); var http = require('http'); var port = 5000; var server = http.createServer(app); server.listen(port,

Python: ipaddress.AddressValueError: At least 3 parts expected

怎甘沉沦 提交于 2019-12-25 04:52:10
问题 An attribute of ipaddress.IPv4Network can be used to check if any IP address is reserved. In IPython: In [52]: IPv4Address(u'169.254.255.1').is_private Out[52]: False Yet if I try the exact same thing in a function: import ipaddress def isPrivateIp(ip): unicoded = unicode(ip) if ipaddress.IPv4Network(unicoded).is_private or ipaddress.IPv6Network(unicoded).is_private: return True else: return False print isPrivateIp(r'169.254.255.1') I get: File "isPrivateIP.py", line 13, in <module> print

how to print the output returned from a function in new lines using python?

一曲冷凌霜 提交于 2019-12-25 04:14:14
问题 I have 243607 ips in the log file. the output of a function is displaying unique ips continuously so that i can't able to check whether the output ips are unique. So i want each ip to be print in seprate line. as i'm new to python i can't able to figure it out. is there any way to do it? I also want the count of the ips printed def unique_ips(): f = open('epiclogs.txt','r') ips = set(line.split()[0] for line in f: if not line.isspace()) ip = line.split()[0] ips.add(ip) return ips if name__=='