Sorry, I apologise.
If a person is on VPN and they get connected to the Leeds Firewall connection starting 192.168.41. They get given an IP 192.168.41.10 for example. All Leeds connections would start 192.168.41 so I would like to substitute example 192.168.41.10 as Leeds Firewall Connection
If someone got directed to our Manchester Firewall, they would get an IP starting 192.168.51 eg 192.168.51.100. So I would like to replace the full IP with Manchester Firewall Connection
Same as if some one connects from our USB Dongle they can get an IP 172.16.2.3, so I would like to substitute that IP with Mobile Connection.
Thanks
Martyn
It is currently April 28th, 2024, 12:23 pm
substituting an IP range starting 192.168.41 or 51
-
- Posts: 13
- Joined: September 9th, 2021, 10:57 am
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: substituting an IP range starting 192.168.41 or 51
Okay, Martin thank you for the explanations. Here, what would come to our rescue is, RegExpSubstitution.nytram wrote: ↑September 10th, 2021, 1:07 pm Sorry, I apologise.
If a person is on VPN and they get connected to the Leeds Firewall connection starting 192.168.41. They get given an IP 192.168.41.10 for example. All Leeds connections would start 192.168.41 so I would like to substitute example 192.168.41.10 as Leeds Firewall Connection
If someone got directed to our Manchester Firewall, they would get an IP starting 192.168.51 eg 192.168.51.100. So I would like to replace the full IP with Manchester Firewall Connection
Same as if some one connects from our USB Dongle they can get an IP 172.16.2.3, so I would like to substitute that IP with Mobile Connection.
Thanks
Martyn
Here, we would substitute after matching the starting indexes. It would require only one measure.
So the measure would be like:
Code: Select all
[IPAdress]
Measure=WebParser
Url=your.url
RegExpSubstitution=1
Substitute="^$":"Not connected", "^192\.168\.41\..*$":"Leeds Firewall", "192\.168\.51\..*":"Manchester Firewall", "172\.16\..*":"Mobile Connection"
So I just match from the beginning using ^ from the start. The rest of the characters can be anything.
If the values match, they are substituted accordingly.
You can learn more about regex from online. A good example would be https://regex101.com.
Reply if it works as expected.
from the Realm of Death
-
- Posts: 13
- Joined: September 9th, 2021, 10:57 am
Re: substituting an IP range starting 192.168.41 or 51
Hi
Thank you. I understand the logic now for expanding it.
I am currently not getting anything for it. I would expect that I get Connected to Manchester as my IP address is 192.168.51.111
Thank you. I understand the logic now for expanding it.
I am currently not getting anything for it. I would expect that I get Connected to Manchester as my IP address is 192.168.51.111
Code: Select all
; Display the VPN Firewall connection location
[VPNConnectedTo]
Meter=STRING
X=120
Y=105
MeasureName=IPAddress
Antialias=1
FontFace=Arial
FontColor=255,255,255,255
FontSize=12
StringAlign=Left
StringStyle=Normal
AntiAlias=1
[IPAddress]
Measure=WebParser
Url=http://infrastructure.***/ip.php
RegExpSubstitution=1
Substitute="^$":"Not connected", "^192\.168\.41\..*$":"Leeds Firewall", "192\.168\.51\..*":"Manchester Firewall", "172\.16\..*":"Mobile Connection"
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: substituting an IP range starting 192.168.41 or 51
Code: Select all
; Display the VPN Firewall connection location
[VPNConnectedTo]
Meter=STRING
X=120
Y=105
MeasureName=IPAddress
Antialias=1
FontFace=Arial
FontColor=255,255,255,255
FontSize=12
StringAlign=Left
StringStyle=Normal
AntiAlias=1
[IPAddress]
Measure=WebParser
Url=http://infrastructure.***/ip.php
RegExpSubstitute=1
Substitute="^$":"Not connected", "^192\.168\.41\..*$":"Leeds Firewall", "192\.168\.51\..*":"Manchester Firewall", "172\.16\..*":"Mobile Connection"
from the Realm of Death
-
- Posts: 13
- Joined: September 9th, 2021, 10:57 am
Re: substituting an IP range starting 192.168.41 or 51
Hey, no problems at all.
That now says Not Connected but it should say Manchester Firewall
Thanks
Martyn
That now says Not Connected but it should say Manchester Firewall
Thanks
Martyn
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: substituting an IP range starting 192.168.41 or 51
Add a line Dubug=2, and check the WebParserDump.txt for what is the output you are getting. Cause it's getting nothing.
from the Realm of Death
-
- Posts: 13
- Joined: September 9th, 2021, 10:57 am
Re: substituting an IP range starting 192.168.41 or 51
Hi
Will do.
Can I confirm this line is fully correct ? There is a $ after ^192\.168\.41..*$ but none of the others have the hat ^ and the $
Ill run the debug now and report back
Martyn
Will do.
Can I confirm this line is fully correct ? There is a $ after ^192\.168\.41..*$ but none of the others have the hat ^ and the $
Code: Select all
Substitute="^$":"Not connected", "^192\.168\.41\..*$":"Leeds Firewall", "192\.168\.51\..*":"Manchester Firewall", "172\.16\..*":"Mobile Connection"
Martyn
-
- Posts: 13
- Joined: September 9th, 2021, 10:57 am
Re: substituting an IP range starting 192.168.41 or 51
I cant find the file. I will let you know when I do. It should be in Skins and the folder but I cant see it
Martyn
Martyn
-
- Posts: 13
- Joined: September 9th, 2021, 10:57 am
Re: substituting an IP range starting 192.168.41 or 51
got the debug working and its the full ip address 192.168.51.111 and nothing else
thanks
Martyn
thanks
Martyn
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: substituting an IP range starting 192.168.41 or 51
Hmm, lemme check then
from the Realm of Death