I have the following
xx:xx:xx:xx/120
via jinja2 filter i would like to take only the IPv6 excluding the subnet. My output after rendering should be
xx:xx:xx:xx
I read all the filters from
https://jinja.palletsprojects.com/en/3.1.x/templates/
but with no success.
Any hint?
Thank you.
Related
Hello i am wondering if every port have a unique specification like for example does port 80 transfer HTML texts fast?
Thanks for any answer
I'm refactoring some of my network code due to Apple's guidelines to support full IPv6 networks, and they state one reason for this is that carriers are starting to make the conversion.
When I test with Apple's NAT64 network, I see IPv4 addresses coming in mapped to IPv6 in the form:
64:ff9b::xxxx:yyyy
Based on the NAT64 spec, it seems there are other possibilities, but I am not sure if these are ever used.
I'm hoping that I can just assume the above format, but I would like to know what NAT64 mapping styles other phone carriers are using.
EDIT: I omitted an important detail from my original question - that I need to do some filtering based on IPv4 ranges in certain scenarios. So I need to be able to convert IPv6 to IPv4 for the addresses where that is possible.
There are many ways. Don't assume anything. Query the DNS64 and use what you get. Everything else will break.
I am wanting to block every country EXCEPT USA,Mexico, and Canada from my ecommerce site. From the research I have done, using an HTTPModule would appear to be the best method. However, this would require me going through a list of hundreds of ip ranges and woudl require quite a bit of code
Anyone have nay ideas on a quick way to do this?
Even if you did block IP address range this would change as the get reallocated or taken up. Also its possible to use a number of services to spoof IP addresses or even to go out through routers / gateways in other countries even if you're not in the places you want.
You could try looking at the locale and / or time-zones set on the client machines. whilst this is not infallible and can be worked around (if the client knows what you're doing to block them),
They are en-us, en-ca, fr-ca, es-MX, it's the letters after the dash that you want, which are the ISO 3166 Codes for Countries. This may give you a start, it's not a infallible, but you're not going to get that anyway, but its a very light weight way of removing a fair amount of visitors.
IMHO, the best approach: application and/or network firewall (appliance) rules (having said that, if you have one, this may even negate the need to do IP address filtering entirely)
IIS
I am writing a UI class for handling IP address and I was wondering if a specific name exists for each of the four sections of IP address V4, to distinguish each part!
It is a mistake to think of an IP address as four octets. Ever since Classless Interdomain Routing came in over 20 years ago they are called 'bits'. There are now only two parts: the 'network address', which is the part that is masked in by the netmask, and the 'host identifier', which is the part that is masked out. The two parts are of variable length depending on the netmask.
No, there is not.
You could just name them first, second, etc...
My production server recently got a slew of access probes (to try and find a point to break in, to URI's like to /admin.php, /administrator, /wp-login.php, etc.), and I noticed that some of the REMOTE_ADDR's reported by Apache (IP4's) had two dots where there should be one.
What's up with this? Is this some way for servers to hide?
For one, it means that I need to log these to a wider field than expected. Expected would be xxx.xxx.xxx.xxx or 15 characters, but this might make it 16 or even 19.
[Edit: or better yet 50, see this]
The problem is happening in some code somewhere in your application (etc) that is doing formatting.
IP addresses are actually an array of 4 unsigned bytes. They are conventionally represented character-wise (for human consumption) in "ddd.ddd.ddd.ddd" form, but that is not the fundamental representation. The fundamental representation does not have dots in it at all.
It therefore follows that the extra dots you are seeing are some problem with either the way the IP addresses are converted to strings, or the resulting strings are incorporated into messages, or those messages are handled and ultimately displayed. The extra dots do not "mean" anything ... except ... possibly ... to say that some characters have been left out.
Without more information, we can't tell you where those dots come from, or how to stop them.
What's up with this? Is this some way for servers to hide?
Nope.
At the point that your systems first see those IP addresses, they are in 4-byte form, just like other IP addresses. The dots are not a new way to hide. Rather they are just a result of a local problem in the way things are being logged.
UPDATE
Looking at the evidence in your "half answer", one possibility is that you have some progress monitoring or debugging code somewhere that occasionally outputs a "dot" into the output stream. It looks like it would be on a different thread ...
So far my hosting company says only that I can clean up these values.
They are right. But you probably want to find where your application is injecting the garbage and fix that ... rather than massaging the log files.
What are you doing with that variable in your code? I expect it's being translated or parsed in some way that's adding the extra period.
It's extremely unlikely that Apache would report it that way, as that would be invalid as an IPv4 address.
Compare your output with the web server's access logs, which will have recorded the remote IP as Apache saw it.
Half of the answer is that php's $_SERVER['REMOTE_ADDR'] is untrusted because it comes directly from the http request as provided by the server to php it can apparently and from other reports be spoofed.
EDIT2: I have more recently found two more bad variables from $_SERVER with double dots, as follows:
SERVER_ADDR REMOTE_ADDR REQUEST_TIME_FLOAT
184..154.227.128 183.60.244.30 1391788916.198
184.154..227.128 183.60.244.37 1391788913.537
184.154..227.128 183.60.244.37 1391788914.368
184.154..227.128 184.154.227.128 1391086482.1889
184.154.227.128 183..60.244.30 1391788914.1494
184.154.227.128 183..60.244.37 1391788913.0523
184.154.227.128 183.60..244.37 1391788911.5938
184.154.227.128 183.60..244.37 1391788914.3977
184.154.227.128 183.60.244.37 1391788911..9855
So far my hosting company says only that I can clean up these values. That is easy, but cleaning up garbage is still garbage. If dots can and are being added, then the numbers can and possibly are be changed too I think. Humm?
See: this comment from the php manual.
Now that leaves the question where to find a trusted IP from the accessing client? Apache has it I'm guessing from the incoming http packet exchange with the client. (I'll ask this Q: in StackOverflow).