Tag: ip

Linux

Change Ubuntu server from DHCP to a static IP address

1. Open interfaces file for editing: sudo nano / etc/network/interfacessudo nano / etc/network/interfaces 2. Change interfaces file contents to: auto eth0 iface eth0 inet static address 192.168.10.15 netmask 255.255.255.0 network 192.168.10.0 gateway 192.168.10.1 dns-nameservers 192.168.10.1 8.8.8.8auto eth0 iface eth0 inet static address 192.168.10.15 netmask 255.255.255.0 network 192.168.10.0 gateway 192.168.10.1 dns-nameservers 192.168.10.1 8.8.8.8 You will have …

C#

Get local IP address with C#

public string GetLocalIPAddress() { foreach (NetworkInterface NetI in NetworkInterface.GetAllNetworkInterfaces()) { if (NetI.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || NetI.NetworkInterfaceType == NetworkInterfaceType.Ethernet && NetI.OperationalStatus == OperationalStatus.Up) { foreach (UnicastIPAddressInformation UniIpAddrInfo in NetI.GetIPProperties().UnicastAddresses) { if (UniIpAddrInfo.Address.AddressFamily != AddressFamily.InterNetwork || UniIpAddrInfo.AddressPreferredLifetime == UInt32.MaxValue) continue;   return UniIpAddrInfo.Address.ToString(); } } }   return "Unknown"; }public string GetLocalIPAddress() { foreach (NetworkInterface NetI in …

C

Get IP address of network adapter in C – Unicode

You will need to include the libraries ws2_32.lib and iphlpapi.lib into your project. GetAdaptersAddresses – retrieves the addresses associated with the adapters on the local computer. WSAAddressToStringW – converts all components of a sockaddr structure into a human-readable string representation of the address. This is intended to be used mainly for display purposes. (Unicode names) …

C, Microsoft Windows

How to get the local IP address(es) using C in Windows

GetIpAddrTable function You have to add the following libraries into your project: ws2_32.lib and iphlpapi.lib. Check this post on how to link your eclipse project with libraries. #include <winsock2.h> #include <iphlpapi.h> #include <windows.h>   #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) #define FREE(x) HeapFree(GetProcessHeap(), 0, (x))   int main(void) { int i; PMIB_IPADDRTABLE pIPAddrTable; DWORD dwSize = …

Add-ons, Anonymity, Browsers, Chrome, Firefox, Protection, VPN

WebRTC Vulnerability leaks Real IP Address

WebRTC Vulnerability leaks Real IP Address of VPN User. This security flaw can reveal your real IP address, even if you’re using a VPN, and it’s easy to exploit. To check if you are safe or not: > Visit https://diafygi.github.io/webrtc-ips/ while you are connected to your vpn. > If your real IP address is in …

PHP

Getting visitors country from their IP

geoplugin geoPlugin is a free and easy webmaster resource to provide geolocation technology to your pages. $xml = simplexml_load_file(’http://www.geoplugin.net/xml.gp?ip=’.$visitor_ip_address);   foreach ($xml as $key => $value) { echo $key , ‘= ‘ , $value , ‘<br>’; }$xml = simplexml_load_file(‘http://www.geoplugin.net/xml.gp?ip=’.$visitor_ip_address); foreach ($xml as $key => $value) { echo $key , ‘= ‘ , $value , ‘<br>’; …

OpenVPN

IP Forwarding and Routing in Centos 6.6 and OpenVPN

If you want to forward all internet traffic through your openvpn connection and centos server apply the following: nano –w /etc/sysctl.conf change net.ipv4.ip_forward = 1 sysctl -p iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle –F iptables -t mangle –X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT …

C#

Get public/external IP address in C#

1) Create a simple form with one button and one textbox. 2) Code private void button1_Click(object sender, EventArgs e) { ThreadStart starter = delegate { Request(); }; Thread thread = new Thread(starter); thread.Start(); }private void button1_Click(object sender, EventArgs e) { ThreadStart starter = delegate { Request(); }; Thread thread = new Thread(starter); thread.Start(); } public …

DNS, Information Gathering

Resolve hostname to ip without using ping

To resolve a hostname to its IP address without using Ping (ICMP echo request), you can use dig or nslookup. You should avoid using ping because ICMP requests may alert administrators when an IDS/IPS system is installed at the target system or even worse ICMP echo requests are blocked from a firewall.   dig hostnamedig …