Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Regex to find passwords in web.config

$
0
0

Hi,

I'm working on a powershell script to create copies of web.config files and to hide all the passwords in the copies so they can be given to others. The problem I'm having is I can't figure out how to replace just the password and leave everything alse as is.

Here's the line from the web.config:

<add name="Global.All" type="Messaging.Sms.Provider" Url="https://www.wev.com/http/sendmsg?user=USERNAME&amp;password=n0t@g00Dp@$$woRd&amp;api_id=65666&amp;to=%2b@@dest@@&amp;msg=@@text@@&amp;from=%2b5555551212" />

This will go to the password, but I can't figure out how to make it stop at the &amp, specifically I want to change this linen0t@g00Dp@$$woRd to xxxxxxxx

$passwords -replace "(?<=password=).+","xxxxxxx"

Any assistance would be appreciated!


Viewing all articles
Browse latest Browse all 2562

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>