2022 Developer Survey is open! Take survey.

Questions tagged [ip-address]

Questions related to IP addresses, IPv4 and IPv6.

Filter by
Sorted by
Tagged with
4 votes
1 answer
89 views

Parsing an IP routing report with half a million lines into a PANDAS dataframe

I have a file that has around 440K lines of data. I need to read these data and find the actual "table" in the text file. Part of the text file looks like this. ...
user avatar
2 votes
1 answer
84 views

Generating a random ipaddress in C

I was looking to receive some feedback on the function I wrote to generate a random ip address. The code is pretty messy and just wanted some feedback regarding optimizations, memory leaks and best ...
user avatar
2 votes
2 answers
251 views

Check if IP address list has subnet or is supernet

I need to iterate over a list of IP addresses, to check if the elements inside are subnets/supernets between them, for this I use the IP-address library. Currently I have the following problem: my ...
user avatar
  • 153
1 vote
1 answer
58 views

Retrieving first non-private ip for local system in elixir

I've recently started learning elixir, and the following is my attempt at fetching the local IP address of the system. It can definitely be improved further, but as this would be my first ever project ...
user avatar
  • 8,673
5 votes
1 answer
313 views

Dynamic DNS IP Checker/Changer for Google Domains in Python

I needed a way to automatically update my IP forwarding rules on Google Domains for my home web server running behind my router. (I'm not paying for a static IP!). After writing a simple functional ...
user avatar
  • 153
1 vote
1 answer
61 views

Network flow analysis

I've created a short Python script in order to do some analysis on network flows. I have an inventory of networks (/8 to /30 masks) of medium size (around 10k references) that provide several ...
user avatar
  • 171
4 votes
0 answers
98 views

Running DNS lookup over million IP addresses

I need to run over all the IP addresses on the CIDR 10.96.0.0/12 network. There are 1,048,574 IP addresses. I created a multi ...
user avatar
  • 237
11 votes
3 answers
1k views

IP address detection code

I am using PHP for detecting a user's IP address and displaying their details, and I use OOP (i.e. object-oriented programming). Are there any problems in it or is it well-written? index.php: ...
user avatar
  • 29
3 votes
1 answer
49 views

Abbreviating and expanding IP v6 addresses with APL

Recently I solved a challenge (problem 1 of the 3rd easy problem set of phase 2 of the '19 APL Competition) on abbreviating and expanding IP v6 addresses. For that matter, I had to write two functions,...
user avatar
  • 1,058
2 votes
0 answers
24 views

I am gathering all the Azure subnets for Central US and trying to filter out the smaller subnets that are part of the larger... Very slow

The goal of this code is to remove subnets from the list that are redundant (included in the larger ones) It is VERY slow. Wondering how it can be sped up. At present, I’m not looking to optimize ...
user avatar
7 votes
2 answers
296 views

Simple IP address parser in C

I have written a C function to parse an IP address that should match the regular expression ^\d+.\d+.\d+.\d+ and nothing else. Additionally all bytes are limited to ...
user avatar
7 votes
3 answers
359 views

IP4 strings validator

Trying to write fast non dependency IP4 string validator for embedded system, It should counts leading zeros, values over 255 and other corrupted strings. Not sure if I missed something. Сan you guys ...
user avatar
4 votes
2 answers
358 views

Displaying IP addresses in Go using Stringer interface

I am trying out some Go code examples (while coding a private project) to get more "in-depth" knowledge about the language. I have come across an exercise from the Go Tour website about displaying ...
user avatar
2 votes
2 answers
2k views

Simple subnet calculator and parser

I have started to learn Java for the past 20 days with no prior coding/comp science experience. My brother gave me an idea to make a subnet calc/ping tool to enhance my knowledge and mentored through ...
user avatar
  • 33
2 votes
1 answer
145 views

Script to get available IP automatically

Recently I made a script to get available IP automatically. I was woundering if anyone can give me tips on how to make this code look better, preferably in a class and OOP. I'm gonna show the code to ...
user avatar
3 votes
0 answers
989 views

Extract the IP address from the output of ipconfig when connected to multiple wireless networks

I am trying to extract the ip address of my machine when connected to multiple wireless networks. The motivation here is then I can make a socket connection on that ip when I have two networks that ...
user avatar
4 votes
2 answers
339 views

/proc/net/tcp results filter and converter

Being unable to easily read the output of /proc/net/tcp I made a small C# console app that modifies the output to be in decimal notation instead of the standard hexadecimal, show the corresponding ...
user avatar
  • 289
15 votes
3 answers
4k views

Modeling an IPv4 Address

I've recently picked up a book that gives various "modern" C++ challenges/solutions. One of the first ones I did was on modeling an IPv4 address in C++. Below is the full implementation; it's also on ...
user avatar
7 votes
2 answers
2k views

Validate IP4 address

Validate IP Address I got this problem during an interview. And would like to get some code review. I also wrote several tests with the expected output, and they all passed as expected. Validate an ...
user avatar
  • 2,469
4 votes
2 answers
314 views

Determine the third octet of an IP address based on user entered site number

I am trying to create a function for a larger script to determine the third octet of a site IP address based off a user entered site number. I have actually come up with the function, but was hoping ...
user avatar
  • 63
1 vote
2 answers
536 views

Creating a dict with external and internal IP addresses provided a list of candidates

I created a function that finds internal and external IP addresses, returns them in dict with the keys external_ips and local_ips...
user avatar
  • 804
4 votes
3 answers
5k views

Verify a subnet mask for validity in Python

I've written a small Python function to check whether a string is a valid IPv4 subnet mask. It works but maybe it's too convoluted and terse? Or maybe it could be improved / optimised / rewritten in ...
user avatar
  • 247
2 votes
2 answers
69 views

Parse IP address from a GPRS module reply

I'm writing a parser to get the IP address from a string I get from a GPRS module. Examples of the string I get from the GPRS module: +QIACT: 1,1,1,\"10.162.143.228\"\r\n\r\nOK\r\n +QIACT: 1,1,...
user avatar
3 votes
2 answers
99 views

Code to get the IP address and format it to run in nmap

For scanning my subnet using my IP address, I need to run the following command nmap -sn 192.168.100.* I want to extend this functionality such that I don't have ...
user avatar
1 vote
1 answer
2k views

IP Scanning program Python 3

This is the code I made to scan IP addresses. I am new to python and just want to learn how I can optimize it. I know the subprocess is slower than others to IP scanning but if there is a way to make ...
user avatar
  • 13
3 votes
1 answer
136 views

Regular Expression for text that validates IPV4 or Hostname followed by a port number eg: 127.0.0.1:8080 or localhost:8080

An attempt with regular expression to do a foolproof validation of an IV4 or Hostname:port Number. Example texts that can be validated for any of the following: ...
user avatar
38 votes
6 answers
21k views

Random IP Address Generator

randip.py I know there are probably better, easier ways to do this. It was just a bit of a learning exercise for the sake of familiarising myself with Python. It takes a single argument (positional ...
user avatar
  • 729
10 votes
0 answers
571 views

IPv6 parsing in rust

Here is code to parse an IPv6 address. An IPv6 address is 128 bits long. When represented in its printable form, its hextets (1 hextet == 16 bits) are represented as hexadecimal numbers, and are ...
user avatar
6 votes
1 answer
250 views

Perl script to set IP settings

This is my first go at a Perl script to (semi-) automate setting the correct IP settings. I use it to configure a virtual machine after creation. It's also my first Perl script as a whole, so I'm ...
user avatar
  • 483
16 votes
6 answers
12k views

Verifying IPv6 addresses

While trying to learn Python I stumbled upon a question which asks you to write a code that is able to take an input and verify it to see whether it meets the IPv6 Criteria. I wrote the following ...
user avatar
3 votes
1 answer
163 views

Finding sessions associated with an IP address using PDO

Originally Posted on Stack Overflow First of all I want to say that I'm new to PDO. I did tried it once but since I found the oop solution complicated and even impossible (...
user avatar
1 vote
0 answers
48 views

Logging netflow connections based on IP address ranges and blacklists

Background and assumptions: A flow corresponds to a netflow record that is written into mongodb. Each flow record has a ...
user avatar
  • 171
2 votes
0 answers
73 views

Node.js script and systemd service to update CloudFlare on IP address change

I've created a simple Node script to read the IPv6 addresses of an interface and update a CloudFlare hostname with those addresses. I've designed it so that it can be activated via an instantiated ...
user avatar
8 votes
3 answers
492 views

Update MediaWiki settings with dynamic IP address

I'm running a MediaWiki instance from a home server where the public IP address is not guaranteed to remain static. The following script is meant to run at boot time to check if the IP address has ...
user avatar
7 votes
3 answers
2k views

Getting the current IP from the command line

I made a tiny little bash script, that prints the current IP Address to the command line. I checked the script with ShellCheck (0.4.6-1) on a local debian install and I get the following message: ...
user avatar
  • 321
3 votes
1 answer
221 views

Get external IP and update ddns service

I've created a cli application that consists of a package with 2 functions. One to get the external ip address, and another function to update a dynamic dns record at dns.he.net. Both are then used in ...
user avatar
  • 246
26 votes
3 answers
7k views

Filtering a large (50gb+) JSON lines file matching CIDR's

I'm trying to speed up a Python script that reads a large log file (JSON lines, 50gb+) and filter out results that match 1 of 2000 CIDR ranges. Logfile 20 million lines ...
user avatar
  • 363
2 votes
1 answer
43 views

Code allowed to test mail invitations by users (from another post) on an instance of Visual studio debugging

I am currently working on an application in ASP.Net MVC, with a SQL Server 2016 database and Entity Framework 6. The application can process specific data and generate forms (in DOC format), and in ...
user avatar
2 votes
2 answers
185 views

Extracting an IP address from a hosts file by hostname

I am currently working with Vagrant for the first time, and therefore also working with Ruby for the first time. I have a specific hostname and IP address I would like set for my VM, both of which are ...
user avatar
  • 165
5 votes
1 answer
972 views

Removing duplicates from a file containing IP addresses

I have a big txt file containing some specific IP addresses, and all of them appear more than once (the file has around 13 million lines). The file looks like this (the first octet is set to zero for ...
user avatar
4 votes
1 answer
5k views

Regex to check IP address in Java

I'm toying with Regexes to parse IP Addresses. I've got it to test for anything over 255: ...
user avatar
  • 143
3 votes
0 answers
92 views

Flexible port scanner library

I have tried to generalize the concept of turning an IP address into a boolean. The save format is an overly complicated way of storing consecutive IP addresses as strings of bits Example usage: <...
user avatar
  • 361
5 votes
1 answer
194 views

Get IP info from a FreeBSD machine

I'm try to get the public IP address from my FreeBSD machine and use it for the rest of my code. Is this implementation good? Can it be optimized more? Can you see some gaps here? Something that ...
user avatar
  • 83
3 votes
1 answer
89 views

Aggregate cidrs up to a limit

I have this algorithm which aggregates a list of cidrs up to a provided limit based on the distance between them. It finds the closest ones and calculates the subnet to join them. The loop repeats ...
user avatar
  • 481
6 votes
3 answers
2k views

Calculate IP Address

I created this based on this website which calculates IP address information such as hosts, netmasks etc. I'm quite new to C and I'm still grasping the idea of the whole array and pointers and bit ...
user avatar
  • 163
6 votes
3 answers
4k views

Validating an IP address and returning the reason it's invalid

I have a method that validates a user-written IP address in an Android application. If it's invalid, I need to know why and notify the user using a Toast. I ...
user avatar
  • 197
7 votes
2 answers
11k views

Get host ip address behind load balancer or without lb

Description Aplication type: WEB API .NET Framework: 4.5 MVC: 5 I need caller host ip in my custom action filter and then in action. On some enviroments we have configured load balancer which ...
user avatar
  • 251
4 votes
1 answer
176 views

Script to periodically Identify and act on public IP address

This script checks what the current public IP address is. The plan is for this to run every 5 minutes or so, and then change some host file configuration depending on whether we the IP is identified ...
user avatar
  • 569
2 votes
2 answers
233 views

Update user country based on IPv4 decimal address

I have UserSignatures, a table with clientIPs, some of which have CountryIds that are null ...
user avatar
  • 286
5 votes
1 answer
119 views

Adding ports to a random list of IP addresses

I have created an application that I will be using for pentesting. It creates a list of random IP addresses, pings them, and adds ports to them (but it's not complete). It works exactly how it should,...
user avatar
  • 804