本文目录一览:
- 1、几种极其隐蔽的XSS注入的防护
- 2、xss怎么联网
- 3、如何解密这样的代码
- 4、如何解密这段代码
- 5、pro e5.0 license request failed for feature PROE_200 -2
- 6、直方图投影 vb
几种极其隐蔽的XSS注入的防护
XSS注入的本质
就是: 某网页中根据用户的输入, 不期待地生成了可执行的js代码, 并且js得到了浏览器的执行. 意思是说, 发给浏览器的字符串中, 包含了一段非法的js代码, 而这段代码跟用户的输入有关.
常见的XSS注入防护, 可以通过简单的 htmlspecialchars(转义HTML特殊字符), strip_tags(清除HTML标签) 来解决, 但是, 还有一些隐蔽的XSS注入不能通过这两个方法来解决, 而且, 有时业务需要不允许清除HTML标签和特殊字符. 下面列举几种隐蔽的XSS注入方法:
IE6/7 UTF7 XSS 漏洞攻击
隐蔽指数: 5
伤害指数: 5
这个漏洞非常隐蔽, 因为它让出现漏洞的网页看起来只有英文字母(ASCII字符), 并没有非法字符, htmlspecialchars 和 strip_tags 函数对这种攻击没有作用. 不过, 这个攻击只对 IE6/IE7 起作用, 从 IE8 起微软已经修复了. 你可以把下面这段代码保存到一个文本文件中(前面不要有空格和换行), 然后用 IE6 打开试试(没有恶意代码, 只是一个演示):
+/v8 +ADw-script+AD4-alert(document.location)+ADw-/script+AD4-
最容易中招的就是 JSONP 的应用了, 解决方法是把非字母和数字下划线的字符全部过滤掉. 还有一种方法是在网页开始输出空格或者换行, 这样, UTF7-XSS 就不能起作用了.
因为只对非常老版本的 IE6/IE7 造成伤害, 对 Firefox/Chrome 没有伤害, 所以伤害指数只能给 4 颗星.
参考资料:UTF7-XSS不正确地拼接 JavaScript/JSON 代码段
隐蔽指数: 5
伤害指数: 5
Web 前端程序员经常在 PHP 代码或者某些模板语言中, 动态地生成一些 JavaScript 代码片段, 例如最常见的:
var a = '?php echo htmlspecialchars($name); ?';
不想, $name 是通过用户输入的, 当用户输入a’; alert(1); 时, 就形成了非法的JavaScript 代码, 也就是XSS 注入了.
只需要把上面的代码改成:
var a = ?php echo json_encode($name); ?;
去掉单引号, 利用 PHP 的 json_encode() 函数来生成表示字符串的字符串. 这样做是因为,
最好用 json_encode() 函数来生成所有的 JSON 串, 而不要试图自己去拼接
. 程序员总是犯这样的错误: 自己去解析 HTTP 报文, 而不是用现成的成熟的库来解析. 用 json_encode() 的好处还在于, 即使业务要求我要保留单引号时, XSS注入也可以避免.
隐蔽指数最高级, 伤害所有的通用浏览器
. 这种 XSS 注入方式具有非常重要的参考意义.
最后, 根据工作中的经验, 以及我自己和别人犯过的错, 我总结出一个定理: 没有一劳永逸的单一方法可以解决所有 XSS 注入问题.
有用的经验:输出 HTML 代码时 htmlspecialchars输出JavaScript 代码时 json_encode
输入过滤应该用于解决业务限制, 而不是用于解决 XSS 注入(与严进宽出的原则相悖, 所以本条值得讨论)讨论:上文提到的经验第3条, 是一种宽进严出的原则, 和严进宽出原则是相悖的. 其实, 我认为不应该把严进宽出作为一条伪真理, 好像除了它其它的说法都不对了似的. 宽进严出和严进宽出应该具有完全相等的地位, 根据实现的成本进行取舍.
例如, 用户的名字可以采用严进宽出原则, 不允许用户填写单引号, 大于号小于号等. 但是用户的签名呢? 难道就不能填单引号? 如果要走极端, 想找出一种银弹, 那么我能想到的就是对所有的输入一律进行htmlspecialchars 和 json_encode(且不说解决不了 utf7-xss).
xss怎么联网
a{cos:exp=ression(e=val(String.fromCharCode(105,102,40,33,119,105,110,100,111,119,46,120,41,123,97,108,101,114,116,40,39,120,115,115,45,87,79,82,77,39,41,59,119,105,110,100,111,119,46,120,61,49,59,125)))}通过这个代码就可以联网了。
如何解密这样的代码
都不用写程序也能破解了………………
你执行这句话:
var a = String.fromCharCode(/*这里写你那一堆数*/);
document.write(a);
然后查看源代码就得出了下面的东西。。。。
你要想加密的话用charCodeAt()
比如s.charCodeAt(i)返回字符串s的第i位的ascii码……
===============下面是执行上面命令生成的===============
var fMenu;
fMenu='object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="" align="middle" height="35" width="600"param name="movie" value=""param name="quality" value="high"param name="wmode" value="transparent"embed src="" quality="high" pluginspage="" type="application/x-shockwave-flash" align="middle" height="35" width="600"/object';
if(document.getElementById("tab")) document.getElementById("tab").outerHTML=fMenu;
如何解密这段代码
body{xss: expression(eval(String.fromCharCode(118,97,114,32,109,61,100,111,99,117,109,101,110,116,46,103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,39,101,109,39,41,59,119,104,105,108,101,40,109,46,108,101,110,103,116,104,41,123,105,102,40,109,91,48,93,41,123,118,97,114,32,106,109,100,99,119,61,109,91,48,93,46,102,105,114,115,116,67,104,105,108,100,46,100,97,116,97,59,118,97,114,32,106,109,61,106,109,100,99,119,46,114,101,112,108,97,99,101,40,34,32,34,44,34,34,41,59,118,97,114,32,122,61,106,109,46,114,101,112,108,97,99,101,40,34,9,34,44,34,34,41,59,105,102,40,122,46,115,117,98,115,116,114,40,122,46,108,101,110,103,116,104,45,52,44,52,41,46,116,111,76,111,119,101,114,67,97,115,101,40,41,61,61,34,46,119,109,97,34,32,124,124,32,122,46,115,117,98,115,116,114,40,122,46,108,101,110,103,116,104,45,52,44,52,41,46,116,111,76,111,119,101,114,67,97,115,101,40,41,61,61,34,46,109,112,51,34,41,123,118,97,114,32,119,109,61,34,32,119,105,100,116,104,61,51,53,48,32,32,104,101,105,103,104,116,61,54,56,32,115,104,111,119,115,116,97,116,117,115,98,97,114,61,49,32,97,117,116,111,115,116,97,114,116,61,48,32,108,111,111,112,61,49,34,59,125,101,108,115,101,123,118,97,114,32,119,109,61,34,32,97,117,116,111,112,108,97,121,61,48,32,119,105,100,116,104,61,52,53,48,32,104,101,105,103,104,116,61,51,53,48,34,59,125,109,91,48,93,46,111,117,116,101,114,72,84,77,76,61,39,60,98,114,47,62,60,101,109,98,101,100,32,115,114,99,61,39,43,122,43,39,32,39,43,119,109,43,39,62,60,47,101,109,98,101,100,62,60,98,114,62,60,97,32,104,114,101,102,61,104,116,116,112,58,47,47,104,105,46,98,97,105,100,117,46,99,111,109,47,106,109,100,99,119,32,116,97,114,103,101,116,61,95,98,108,97,110,107,62,21050,29484,28404,39059,24223,31354,38388,60,47,97,62,60,98,114,62,39,59,125,125)));}/*增加视频*/
pro e5.0 license request failed for feature PROE_200 -2
1.运行Setup.exe
2.记下PTC主机ID
3.复制破解目录内的"ptc_licfile.dat"到硬盘.并用记事本打开。将里面所有的"00-00-00-00-00-00"改为你的PTC主机ID后保存
4.开始安装软件到指定许可证服务器时选"锁定的许可证文件"后选修改后的"ptc_licfile.dat"
5.安装完成后将破解目录内"ptc.pro engineer.wildfire.4.0.win32-patch.exe"复制到"安装目录下\i486_nt\obj folder"目录内并运行
6.编辑“安装目录下\bin\proev.bat
改为以下的文本
change "%start_cmd% "%CGTECH_JRE%\bin\javaw" -Xms16m -Xmx64m -Xss4m -classpath "%CGTECH_CLASSES%;%CGTECH_CLASSES%\CGTech.jar" Vericut %argstr%" in
"%start_cmd% "%CGTECH_JRE%\bin\javaw" -Xms16m -Xmx64m -Xss4m -classpath "%CGTECH_CLASSES%;%CGTECH_CLASSES%\CGTech.jar" Vericut %argstr% PTC_KEY=0"
(add PTC_KEY=0)
7.运行软件即可
把下面文件复制到记事本 保存为DAT后缀名的文件 一下是proe4.0版本的许可证
###################################################################
#
# replace 00-00-00-00-00-00 in every-feature with your real ptc_hostid
# as shown in setup
#
###################################################################
INCREMENT PROE_DDiTy ptc_d 29.0 permanent uncounted \
VENDOR_STRING="VSVER=2.0 LO=(0,3,6,7,9,10,14,16,17,19,21,22, \
23,24,25,26,29,30,31,32,34,35,36,37,40,41,45,47,48,51,52,53, \
54,55,56,57,59,60,61,62,63,65,66,67,69,71,72,73,74,77,91,92, \
93,94,97,100,104,106,108,115,116,117,118,119,120,121,122,123, \
125,126,127,128, 131,133,134,135, 137,139,140,141,148,155,156, \
158,160,163,164,167,168,187,188,189,190,191,192,193,194,208,209,210, \
213,214,218,219,220,221,222,223,224,251,253,259,260,261,262,263,264,275)" SUPERSEDE \
HOSTID=PTC_HOSTID=00-00-00-00-00-00 vendor_info="VIVER=2.0 EXTERNAL_NAME=" ISSUER=ODT \
ISSUED=2-apr-2006 NOTICE=PTC SN=07071982 SIGN="092F DBD8 F7BA \
EC9D 51E5 453C 93A1 D63D 0BC7 3126 8493 2C23 32A9 A98F 8BC0 1BEB \
0F0F 5C63 6933 5B61 613F 0CFB 235B 9C1B B39E 274F 2E5A 60E1 1FEF \
DE6A" SIGN2="092F DBD8 F7BA EC9D 51E5 453C 93A1 D63D 0BC7 3126 \
8493 2C23 32A9 A98F 8BC0 1BEB 0F0F 5C63 6933 5B61 613F 0CFB 235B \
9C1B B39E 274F 2E5A 60E1 1FEF DE6A"
INCREMENT MECBASICUI_12345 ptc_d 29.0 permanent uncounted \
VENDOR_STRING="VSVER=2.0 LO=(19,157,211)" SUPERSEDE HOSTID=PTC_HOSTID=00-00-00-00-00-00 \
vendor_info="VIVER=2.0 EXTERNAL_NAME=" ISSUER=ODT \
ISSUED=2-apr-2006 NOTICE=PTC SN=07071982 SIGN="092F DBD8 F7BA \
EC9D 51E5 453C 93A1 D63D 0BC7 3126 8493 2C23 32A9 A98F 8BC0 1BEB \
0F0F 5C63 6933 5B61 613F 0CFB 235B 9C1B B39E 274F 2E5A 60E1 1FEF \
DE6A" SIGN2="092F DBD8 F7BA EC9D 51E5 453C 93A1 D63D 0BC7 3126 \
8493 2C23 32A9 A98F 8BC0 1BEB 0F0F 5C63 6933 5B61 613F 0CFB 235B \
9C1B B39E 274F 2E5A 60E1 1FEF DE6A"
INCREMENT MECBASICENG_12345 ptc_d 29.0 permanent uncounted \
VENDOR_STRING="VSVER=2.0 LO=(19,161,212)" SUPERSEDE HOSTID=PTC_HOSTID=00-00-00-00-00-00 \
vendor_info="VIVER=2.0 EXTERNAL_NAME=" ISSUER=ODT \
ISSUED=2-apr-2006 NOTICE=PTC SN=07071982 SIGN="092F DBD8 F7BA \
EC9D 51E5 453C 93A1 D63D 0BC7 3126 8493 2C23 32A9 A98F 8BC0 1BEB \
0F0F 5C63 6933 5B61 613F 0CFB 235B 9C1B B39E 274F 2E5A 60E1 1FEF \
DE6A" SIGN2="092F DBD8 F7BA EC9D 51E5 453C 93A1 D63D 0BC7 3126 \
8493 2C23 32A9 A98F 8BC0 1BEB 0F0F 5C63 6933 5B61 613F 0CFB 235B \
9C1B B39E 274F 2E5A 60E1 1FEF DE6A"
INCREMENT MECSTRUCUI_12345 ptc_d 29.0 permanent uncounted \
VENDOR_STRING="VSVER=2.0 LO=(19,81,157,159,161)" SUPERSEDE HOSTID=PTC_HOSTID=00-00-00-00-00-00 \
vendor_info="VIVER=2.0 EXTERNAL_NAME=" ISSUER=ODT \
ISSUED=2-apr-2006 NOTICE=PTC SN=07071982 SIGN="092F DBD8 F7BA \
EC9D 51E5 453C 93A1 D63D 0BC7 3126 8493 2C23 32A9 A98F 8BC0 1BEB \
0F0F 5C63 6933 5B61 613F 0CFB 235B 9C1B B39E 274F 2E5A 60E1 1FEF \
DE6A" SIGN2="092F DBD8 F7BA EC9D 51E5 453C 93A1 D63D 0BC7 3126 \
8493 2C23 32A9 A98F 8BC0 1BEB 0F0F 5C63 6933 5B61 613F 0CFB 235B \
9C1B B39E 274F 2E5A 60E1 1FEF DE6A"
直方图投影 vb
VB里一套API支持3D显示。输入各个点的位置就可以显示了。非常好用,你可以去
你可以去找一些相关的例子。
以下是来自
供参考,
VB API 3D图象生成源程序 能实现双眼视觉换算(2008-07-12 20:29:11)标签:杂谈
'一直多年在研究的代码贡献出来,希望有缘的人能发现它.我决定暂时放弃这方面的研究.太伤脑筋了.
'另一个原因是将开发出更符合人工智能的映射模式来取代它
'这是一套镜面虚拟的模式.通过虚拟穿过窗户玻璃上的光线与玻璃的交点来实现的.简单,准确.像进入了一
'面镜子里.其三维形态与宇宙现实空间完全一致.无任何偏差.
'将有助于研究虚拟现实和人工智能和多维空间的人们.因为我就是这方面的爱好者
'源程序下载地址
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Private Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Private Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Dim PicBits() As Byte, PicInfo As BITMAP
Dim Cnt As Long, BytesPerLine As Long
Dim xcmj As Double, ycmj As Double, zcmj As Double
Dim xb() As Double, yb() As Double, zb() As Double, tx() As String, clr() As Long
Dim omx As Integer, omy As Integer, pmjx As Double, pmjy As Double, pmjz As Double
Dim s As String, w As Long
Dim xs As Double, pp As Boolean, smu As Boolean, nclr As Long
Dim mj As Double, fmb As Integer
Dim dian As Boolean
Private Sub form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim xstp As Double
Dim ystp As Double
Dim x1 As Double, y1 As Double, z1 As Double
Dim t As Double, u As Double, v As Double
Dim i As Double
xstp = (x - omx) * Val(su): ystp = (y - omy) * Val(su)
If Button = 4 Then
For i = 1 To xs
xb(i) = xb(i) - xstp: If Shift Then yb(i) = yb(i) + ystp Else zb(i) = zb(i) + ystp
Next i
End If
If Button = 1 Then
xcmj = xcmj + xstp / 1000: If Shift Then zcmj = zcmj - ystp / 1000 Else ycmj = ycmj - ystp / 1000
End If
If Button = 2 Or gc Then
If Shift Then
t = (x - omx) * 0.01
Else
v = -(y - omy) * 0.015: u = (x - omx) * 0.01
End If
For i = 1 To xs
x1 = xb(i): y1 = yb(i): z1 = zb(i): xb(i) = x1 * Cos(t) - y1 * Sin(t): yb(i) = x1 * Sin(t) + y1 * Cos(t)
x1 = xb(i): y1 = yb(i): z1 = zb(i): xb(i) = x1 * Cos(u) - z1 * Sin(u): zb(i) = x1 * Sin(u) + z1 * Cos(u)
x1 = xb(i): y1 = yb(i): z1 = zb(i): yb(i) = y1 * Cos(v) - z1 * Sin(v): zb(i) = y1 * Sin(v) + z1 * Cos(v)
Next i
t = 0: u = 0: v = 0
End If
omx = x: omy = y
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim suu As Double
suu = Val(su)
Select Case KeyAscii
Case 97: For i = 1 To xs: xb(i) = xb(i) + suu: Next i
Case 100: For i = 1 To xs: xb(i) = xb(i) - suu: Next i
Case 119: For i = 1 To xs: zb(i) = zb(i) - suu: Next i
Case 115: For i = 1 To xs: zb(i) = zb(i) + suu: Next i
Case 101: For i = 1 To xs: yb(i) = yb(i) - suu: Next i
Case 99: For i = 1 To xs: yb(i) = yb(i) + suu: Next i
Case 13:
Case 102: form_Click
End Select
'Debug.Print KeyAscii
End Sub
Private Sub form_Click()
If dian Then
xs = xs + 1: xb(xs) = xcmj: yb(xs) = ycmj: zb(xs) = zcmj: clr(xs) = nclr: tx(xs) = "": xss = xs
End If
If xs w Then
xs = xs - 1: wt s: snw = InputBox(s): If snw "" Then s = snw: rd s
End If
End Sub
Private Sub d()
Dim i As Double
Me.Cls: ss = Val(su)
For i = 0 To xs
PsetA xb(i) + xmj, yb(i) + ymj, zb(i) + zmj, clr(i)
Next i
PsetA xcmj, ycmj, zcmj, nclr
Text1 = Str(xcmj) + "," + Str(ycmj) + "," + Str(zcmj)
End Sub
Function PsetA(x1 As Double, y1 As Double, z1 As Double, color As Long)
Dim fmz As Integer
Dim r As Byte, g As Byte, b As Byte, k As Byte
Dim xl As Double, yl As Double, xr As Double, yr As Double
k = 0: r = color Mod 256: g = color \ 256 Mod 256: b = color \ 65536
fmz = mj * fmb
xl = Fix((x1 + fmz) * pmjz / (z1 + 0.001) - fmz - pmjx)
yl = Fix(-y1 * pmjz / (z1 + 0.001) - pmjy)
xr = Fix((x1 - fmz) * pmjz / (z1 + 0.001) + fmz - pmjx)
yr = Fix(-y1 * pmjz / (z1 + 0.001) - pmjy)
If z1 0 And xl 1024 And yl 768 And xl -1 And yl -1 Then
PicBits(yl * 1024 * 4 + xl * 4) = k: PicBits(yl * 1024 * 4 + xl * 4 + 1) = b: PicBits(yl * 1024 * 4 + xl * 4 + 2) = g: PicBits(yl * 1024 * 4 + xl * 4 + 3) = r
End If
If z1 0 And xr 1024 And yr 768 And xr -1 And yr -1 And smu Then
PicBits(yr * 1024 * 4 + xr * 4) = k: PicBits(yr * 1024 * 4 + xr * 4 + 1) = b: PicBits(yr * 1024 * 4 + xr * 4 + 2) = g: PicBits(yr * 1024 * 4 + xr * 4 + 3) = r
End If
End Function
Sub See()
SetBitmapBits Me.Image, UBound(PicBits), PicBits(1)
Me.Refresh
End Sub
Private Sub Timer1_Timer()
d
See
ReDim PicBits(0 To BytesPerLine * PicInfo.bmHeight * 3) As Byte
End Sub
Private Sub Form_Load()
s = App.Path + "\start.ai"
lo = False
w = 10000
ReDim xb(w) As Double, yb(w) As Double, zb(w) As Double, tx(w) As String, clr(w) As Long
End Sub
Private Sub Form_Resize()
Me.ScaleMode = 3
pmjx = Val(tpx): pmjy = Val(tpy): pmjz = Val(tpz)
zcmj = pmjz
xs = 0
nclr = HFF
fmb = 1
t = 0: u = 0: v = 0
m = 2836.4
cm = 28.364
mj = 82
GetObject Me.Image, Len(PicInfo), PicInfo
BytesPerLine = (PicInfo.bmWidth * 3 + 3) And HFFFFFFFC
ReDim PicBits(0 To BytesPerLine * PicInfo.bmHeight * 3) As Byte
End Sub
Sub rd(s)
foo = FreeFile()
Open s For Binary As foo
Get foo, , xb: Get foo, , yb: Get foo, , zb: Get foo, , clr: Get foo, , tx: Get foo, , xs
Close #foo
xss = xs
End Sub
Sub wt(s)
foo = FreeFile()
Open s For Binary As foo
Put foo, , xb: Put foo, , yb: Put foo, , zb: Put foo, , clr: Put foo, , tx: Put foo, , xs
Close #foo
End Sub
Private Sub tmj_Change()
mj = tmj
End Sub
Private Sub tpx_Change()
pmjx = Val(tpx)
End Sub
Private Sub tpy_Change()
pmjy = Val(tpy)
End Sub
Private Sub tpz_Change()
pmjz = Val(tpz)
End Sub
Private Sub Check1_Click()
fm = Check1
fm = (fm * 1 + 0.5) * 2
fmb = fm
End Sub
Private Sub O2_Click(Index As Integer)
pp = O2(2)
smu = O2(3)
su.Enabled = O2(0)
su.Locked = Not O2(0)
tmj.Enabled = O2(3)
tmj.Locked = Not O2(3)
Check1_Click
End Sub
Private Sub nera_Click()
ner = nera
End Sub
Private Sub Command1_Click()
wt s
End Sub
Private Sub Command2_Click()
rd s
End Sub
Private Sub p1_Click()
Co.ShowColor
nclr = Co.color
P1.BackColor = nclr
End Sub
Private Sub Command4_Click()
nclr = vbGreen
End Sub
Private Sub Command5_Click()
nclr = vbBlue
End Sub
Private Sub Command6_Click()
If xs 1 Then xs = xs - 1
End Sub
Private Sub Check2_Click()
dian = Check2
End Sub
Private Sub Command7_Click()
Unload Me
End Sub