有时候网站sqlserver数据库被挂马了,网上的很多软件与方法都是针对text小于8000的,这里的方法貌似可行,需要的朋友可以参考下。
首先备份数据库,以防不必要的损失。而后对所有被挂马的小于8000字符的varchar字段执行
代码如下:
update 表名 set 字段名=replace(字段名,'','')
其中为挂马字段。执行后挂马字段被清除。但是有部分字段,比如内容字段等大于8000字符的varchar字段则需要执行
代码如下:
update 表名 set 表项=replace(cast(表项 as varchar(8000)),' ','')
来更新被挂马字段,而房产网由于内容比较多,执行以上语句的时候会发生假死现象,于是加个区间分两次进行,一次处理15000条得以解决。
代码如下:
update 表名 set 表项=replace(cast(表项 as varchar(8000)),' ','') where id>1 and id
以上被挂马问题一般都是sql数据库,这是sql数据库特有的注入漏洞。换数据库不现实,只能针对以上情况进行防范。思路就是在所有数据库链接请求那里做相应的过滤。
代码如下:
Response.Buffer = True '缓存页面
'防范get注入
If Request.QueryString "" Then StopInjection(Request.QueryString)
'防范post注入
If Request.Form "" Then StopInjection(Request.Form)
'防范cookies注入
If Request.Cookies "" Then StopInjection(Request.Cookies)
'正则子函数
Function StopInjection(Values)
Dim regEx
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "'|;|#|([\s\b+()]+([email=select%7Cupdate%7Cinsert%7Cdelete%7Cdeclare%7C@%7Cexec%7Cdbcc%7Calter%7Cdrop%7Ccreate%7Cbackup%7Cif%7Celse%7Cend%7Cand%7Cor%7Cadd%7Cset%7Copen%7Cclose%7Cuse%7Cbegin%7Cretun%7Cas%7Cgo%7Cexists)[/s/b]select|update|insert|delete|declare|@|exec|dbcc|alter|drop|create|backup|if|else|end|and|or|add|set|open|close|use|begin|retun|as|go|exists)[\s\b[/email]+]*)"
Dim sItem, sValue
For Each sItem In Values
sValue = Values(sItem)
If regEx.Test(sValue) Then
Response.Write ""
Response.End
End If
Next
Set regEx = Nothing
End function
%>
做一个通用的sql防注入页面,把它包含在conn.asp数据库连接语句里边,这样就实现了全站的防范 sql 注入的攻击了。但是前台的类似?id=这样的语句还是存在注入漏洞,需要我们严格过滤 request.form 和 request.querystring 获取的内容。坚决不用 request("name") 这样的方式获取值,凡是采用 cookies 保存的内容,尽量不要用在sql语句里进行查询数据库操作。
如果不熟悉sqlserver的朋友可以用软件来实现

mysqloffersvariouscharactersetsforstringdatatypes:1)latin1 forwesterneuropeanlanguages,2)utf8 formultingualsupport,3)utf8mb4f OREXTEDENDENDENENICODECLUDINGEMOJIS,4)UCS2FORIXED-WIDTHENCODING,5)assiiforbasiclatin.ChoosideStherightStetSetensensersdaintegrity

流式传输BLOB确实比直接存储更好,因为它能减少内存使用和提高性能。1)通过逐步读取和处理文件,避免了数据库膨胀和性能下降。2)流式传输需要更复杂的代码逻辑,且可能增加I/O操作次数。

mySqlStringTypesimpactStorageAndPerformanCeaseAsfollows:1)长度,始终使用theSamestoragespace,whatcanbefasterbutlessspace-felfficity.2)varCharisvariable varcharisvariable length,morespace-morespace-morespace-effficitybuteftife buteftife butfority butfority textifforlyslower.3)

mySqlStringTypesIncludeVarChar,文本,char,enum和set.1)varCharisVersAtileForvariable-lengthStringStringSuptOptoPeptoPepecifientlimit.2)textisidealforlargetStortStorStoverStorextorewiteWithoutAdefinedLengthl.3)charlisfixed-Length

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

toadduserInmysqleffectection andsecrely,theTheSepsps:1)USEtheCreateuserStattoDaneWuser,指定thehostandastrongpassword.2)GrantNectalRevileSaryPrivilegesSustate,usiveleanttatement,AdheringTotheTeprinciplelastPrevilegege.3)

toaddanewuserwithcomplexpermissionsinmysql,loldtheSesteps:1)创建eTheEserWithCreateuser'newuser'newuser'@''localhost'Indedify'pa ssword';。2)GrantreadAccesstoalltablesin'mydatabase'withGrantSelectOnMyDatabase.to'newuser'@'localhost';。3)GrantWriteAccessto'


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

记事本++7.3.1
好用且免费的代码编辑器

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境