I have been asked to clean up a database that was infected through injection SQL with script references throughout the tables. There are (so far) about 10 different script references that have been added to around 50 fields in 20 tables.
I want to write a stored procedure that can be used to clear these script references, and could be used again if re-infection with a new script occurred. So far, the only way that I have been able to do this is to add an update statement for every affected table for every found script.
I was hoping that I could use a wildcard to get them all at once, but this isn't working.
This is an example of an UPDATE that works:
[tt]UPDATE dbo.merchants
SET merchantName = REPLACE(merchantName, '<script src= ''), webSite = REPLACE(webSite, '<script src= ''), contactEmail = REPLACE(contactEmail, '<script src= '')[/tt]
This is what I would like to do, but it isn't working:
[tt]UPDATE dbo.merchants
SET merchantName = REPLACE(merchantName, '<script%></script>', ''), webSite = REPLACE(webSite, '<script%></script>', ''), contactEmail = REPLACE(contactEmail, '<script%></script>', '')[/tt]
Nor does it work when I use a * instead of the %.
I found another thread that seemed similar (thread183-1398648), and the user there was directed to a microsoft article on RegEx ( which I have looked over. I feel rather dense, as it seems beyond me to even determine which part of the article is supposed to apply to this issue, and how I would be able to make use of it.
Can anyone offer any clarity? Or even another source that's easier to understand?
Cheryl dc Kern
I want to write a stored procedure that can be used to clear these script references, and could be used again if re-infection with a new script occurred. So far, the only way that I have been able to do this is to add an update statement for every affected table for every found script.
I was hoping that I could use a wildcard to get them all at once, but this isn't working.
This is an example of an UPDATE that works:
[tt]UPDATE dbo.merchants
SET merchantName = REPLACE(merchantName, '<script src= ''), webSite = REPLACE(webSite, '<script src= ''), contactEmail = REPLACE(contactEmail, '<script src= '')[/tt]
This is what I would like to do, but it isn't working:
[tt]UPDATE dbo.merchants
SET merchantName = REPLACE(merchantName, '<script%></script>', ''), webSite = REPLACE(webSite, '<script%></script>', ''), contactEmail = REPLACE(contactEmail, '<script%></script>', '')[/tt]
Nor does it work when I use a * instead of the %.
I found another thread that seemed similar (thread183-1398648), and the user there was directed to a microsoft article on RegEx ( which I have looked over. I feel rather dense, as it seems beyond me to even determine which part of the article is supposed to apply to this issue, and how I would be able to make use of it.
Can anyone offer any clarity? Or even another source that's easier to understand?
Cheryl dc Kern