├── .gitattributes ├── .gitignore ├── Dns ├── dns.py └── dnsserver.conf ├── README.md ├── ReportWeb └── file.php ├── TaskPython └── run2.py ├── ajax.php ├── css ├── bootstrap-combined.min.css ├── img │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png └── layoutit.css ├── html ├── edit.html ├── index.html ├── info.html ├── login.html ├── point.html ├── scan.html └── set.html ├── include ├── IExcel.php ├── XmlExcel.php ├── common.fun.php ├── config.inc.php ├── index.action.php ├── ip.conf ├── mysql.class.php ├── sqlsafe.php ├── vhost-demo.conf ├── xml.action.php └── xml.class.php ├── index.php ├── js ├── action.js ├── bootstrap.min.js ├── html5shiv.js ├── jquery-2.0.0.min.js ├── jquery-ui.js ├── jquery.htmlClean.js ├── jquery.ui.touch-punch.min.js └── scripts.js ├── nginx_conf ├── nginx.conf ├── restart_ngx.bat └── vhost.conf ├── scan.jpg ├── tasklist.php ├── wvs_scan.sql └── wvs_scan.test.data.sql /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /Dns/dns.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibijj/AwvScan/59e725c001ff0f9d76ad89834af9b52bbb71479f/Dns/dns.py -------------------------------------------------------------------------------- /Dns/dnsserver.conf: -------------------------------------------------------------------------------- 1 | [dns] 2 | default = 114.114.114.114 3 | google = google.com/8.8.8.8 4 | 5 | [host] 6 | activate.adobe.com = 0.0.0.0 7 | www.baidu.com = 10.0.13.59 8 | testphp.vulnweb.com = 10.0.13.58 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AwvScan 2 | By: Mr.x 3 | Email:coolxia@foxmail.com 4 | ============== 5 | 6 | AwvScan是基于Awvs+python+nginx+php+mysql框架组成的在线分布式扫描工具(框架图可查看scan.jpg) 7 | 8 | ============== 9 | 10 | 修改dns部分,之前是单线程动态读取host-ip地址记录,导致客户端dns查询超时。 11 | 12 | 现单独起一个线程每3秒查询动态读取host-ip地址记录,避免客户端dns查询超时问题。 13 | 14 | 2015.11.14 15 | 16 | ============== 17 | 18 | 现在是v1.0版本 19 | 20 | 扫描核心为awvs console,用nginx反向代理+DNSsever解决了,登录认证问题(大部分情况) 21 | 22 | 现在工作忙,忙着把安全做成服务产品,服务公司各种研发部门,估计这玩意又得放一段时间了... 23 | 24 | 2015.8.11 25 | -------------------------------------------------------------------------------- /ReportWeb/file.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TaskPython/run2.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | import urllib,time,os,base64,json 3 | import _winreg 4 | 5 | wvs_path = "" 6 | 7 | def get_html(url): 8 | url=url.strip() 9 | html=urllib.urlopen(url).read() 10 | return html 11 | 12 | def writefile(logname,cmd): 13 | try: 14 | fp = open(logname,'a') 15 | fp.write(cmd+"\n") 16 | fp.close() 17 | except: 18 | return False 19 | 20 | def regedit(re_root,re_path,re_key): 21 | try: 22 | key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,re_path) 23 | value,type = _winreg.QueryValueEx(key,re_key) 24 | return value 25 | except: 26 | return False 27 | 28 | def get_console(url): 29 | now = time.strftime('%Y-%m-%d %X', time.localtime(time.time())) 30 | date = time.strftime('%Y-%m-%d', time.localtime(time.time())) 31 | try: 32 | a = get_html(url) 33 | #print a 34 | if len(a) > 50: 35 | base = base64.b64decode(a) 36 | #print base 37 | json_arr = json.loads(base) 38 | target_url = json_arr['target_url'] 39 | user = json_arr['siteuser'] 40 | pwd = json_arr['sitepwd'] 41 | scan_rule = json_arr['scan_rule'] 42 | hash = json_arr['hash'] 43 | print json_arr 44 | console = '"%s\\wvs_console.exe" /Scan %s --HtmlAuthUser=%s --HtmlAuthPass=%s --EnablePortScanning=True /Verbose /ExportXML /SaveLogs /SaveFolder E:\\wwwroot\\report\\%s\\' %(wvs_path,target_url,user,pwd,hash) 45 | #console = console + '\ndel %0' 46 | scantime = time.strftime('%Y-%m-%d %X', time.localtime(time.time())) 47 | print "%s\n%s\n" %(scantime,console) 48 | writefile('bat\\%s.bat'%hash,console) 49 | cmd = 'cmd /c bat\\%s.bat' %hash 50 | print "%s\n%s\n%s\n" %(now,target_url,cmd) 51 | os.system(cmd) 52 | except Exception , e: 53 | info = '%s\nError: %s' %(now,e) 54 | writefile('logs\\%s-Error.log'%date,info) 55 | print info 56 | 57 | 58 | wvs_path = regedit(0,"SOFTWARE\Acunetix\WVS9","Path") 59 | #exit() 60 | url = 'http://10.118.44.8/scan/tasklist.php' 61 | i = 0 62 | while 1: 63 | now = time.strftime('%Y-%m-%d %X', time.localtime(time.time())) 64 | try: 65 | a = get_console(url) 66 | i +=1 67 | time.sleep(5) 68 | except Exception , e: 69 | info = '%s\nError: %s' %(now,e) 70 | writefile('Error.log',info) 71 | print info 72 | time.sleep(1) -------------------------------------------------------------------------------- /ajax.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /css/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibijj/AwvScan/59e725c001ff0f9d76ad89834af9b52bbb71479f/css/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /css/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibijj/AwvScan/59e725c001ff0f9d76ad89834af9b52bbb71479f/css/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /css/layoutit.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top:10px; 3 | padding-bottom: 40px; 4 | margin-left:0px; 5 | -webkit-transition: margin 500ms ease; 6 | -moz-transition: margin 500ms ease; 7 | -ms-transition: margin 500ms ease; 8 | -o-transition: margin 500ms ease; 9 | transition: margin 500ms ease; 10 | } 11 | @media (max-width: 980px) { 12 | /* Enable use of floated navbar text */ 13 | .navbar-text.pull-right { 14 | float: none; 15 | padding-left: 5px; 16 | padding-right: 5px; 17 | } 18 | } 19 | @media (max-width: 979px) { 20 | .navbar-fixed-top { position:fixed; } 21 | } 22 | .navbar-inverse .brand {width:180px; color:#fff; } 23 | .brand img {float:left; margin:2px 10px 0 0; } 24 | .brand .label { 25 | position:relative; 26 | left:10px; 27 | top:-3px; 28 | font-weight:normal; 29 | font-size:9px; 30 | background:#666; 31 | -webkit-box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.7); 32 | -moz-box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.7); 33 | box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.7); 34 | } 35 | 36 | .edit .demo { margin-left:0px; margin-top:10px; padding:30px 15px 15px; border: 1px solid #DDDDDD; border-radius: 4px; position:relative; word-wrap: break-word;} 37 | .edit .demo:after { 38 | background-color: #F5F5F5; 39 | border: 1px solid #DDDDDD; 40 | border-radius: 4px 0 4px 0; 41 | color: #9DA0A4; 42 | content: "Container"; 43 | font-size: 12px; 44 | font-weight: bold; 45 | left: -1px; 46 | padding: 3px 7px; 47 | position: absolute; 48 | top: -1px; 49 | } 50 | .sidebar-nav { 51 | position:fixed; 52 | width:200px; 53 | left:0px; 54 | bottom:0; 55 | top:44px; 56 | background:#ccc; 57 | padding: 9px 0; z-index:10; 58 | -webkit-transition: all 500ms ease; 59 | -moz-transition: all 500ms ease; 60 | -ms-transition: all 500ms ease; 61 | -o-transition: all 500ms ease; 62 | transition: all 500ms ease; 63 | } 64 | .sidebar-nav .nav-header { cursor:pointer; font-size:14px; color:#fff; text-shadow:0 1px 0 rgba(0, 0, 0, 0.3);} 65 | .sidebar-nav .nav-header span.label { font-size:10px; /*padding-bottom:0;*/ position:relative; top:-1px;} 66 | .sidebar-nav .nav-header i.icon-plus {} 67 | .sidebar-nav .nav-header .popover {color:#999; text-shadow:none;} 68 | 69 | .popover-info {position:relative;} 70 | .popover-info .popover {display:none; top: -12.5px; left:15px; } 71 | .popover-info:hover .popover {display:block; opacity:1; width:400px;} 72 | .popover-info:hover .popover .arrow {top:23px;} 73 | 74 | .sidebar-nav .accordion-group { border:none; } 75 | .boxes {} 76 | .sidebar-nav li { line-height:25px; } 77 | .sidebar-nav .box { line-height:25px; width:170px; height:25px; } 78 | .sidebar-nav .preview { display: block; color:#666; font-size:12px; line-height:22px;} 79 | .sidebar-nav .preview input { width:90px; padding:0 10px; background:#bbb; font-size:10px; color:#999; line-height:20px; height:20px; position:relative; top:-1px; } 80 | .sidebar-nav .view { display: none; } 81 | .sidebar-nav .remove, 82 | .sidebar-nav .configuration { display: none; } 83 | 84 | .sidebar-nav .boxes { display:none;} 85 | 86 | .demo .preview { display: none; } 87 | .demo .box .view { display: block; padding-top:30px;} 88 | 89 | 90 | .ui-draggable-dragging .view { display:block;} 91 | /*.demo .ui-sortable-placeholder { outline: 5px dotted #ddd; visibility: visible!Important; border-radius: 4px; }*/ 92 | .ui-sortable-placeholder { outline: 1px dashed #ddd;visibility: visible!Important; border-radius: 4px;} 93 | .edit .drag { position: absolute; top: 0;right: 0; cursor: pointer; } 94 | 95 | .box,.lyrow { position:relative;} 96 | 97 | .edit .demo .lyrow .drag { top:5px; right:80px; z-index:10; } 98 | .edit .demo .column .box .drag { top:5px; } 99 | .edit .demo .column .box .configuration {position: absolute; top: 3px; right: 140px;white-space:nowrap; } 100 | .edit .demo .remove { position: absolute; top: 5px; right: 5px; z-index:10; } 101 | .demo .configuration { 102 | filter: alpha(opacity=0); 103 | opacity: 0; 104 | -webkit-transition: all 500ms ease; 105 | -moz-transition: all 500ms ease; 106 | -ms-transition: all 500ms ease; 107 | -o-transition: all 500ms ease; 108 | transition: all 500ms ease; 109 | } 110 | .demo .drag, .demo .remove { 111 | filter: alpha(opacity=20); opacity: 0.2; 112 | -webkit-transition: all 500ms ease; 113 | -moz-transition: all 500ms ease; 114 | -ms-transition: all 500ms ease; 115 | -o-transition: all 500ms ease; 116 | transition: all 500ms ease; 117 | } 118 | .demo .lyrow:hover > .drag, 119 | .demo .lyrow:hover > .configuration, 120 | .demo .lyrow:hover > .remove, 121 | .demo .box:hover .drag, 122 | .demo .box:hover .configuration, 123 | .demo .box:hover .remove { filter: alpha(opacity=100); opacity: 1; } 124 | .edit .demo .row-fluid:before { 125 | background-color: #F5F5F5; 126 | border: 1px solid #DDDDDD; 127 | border-radius: 4px 0 4px 0; 128 | color: #9DA0A4; 129 | content: "Row"; 130 | font-size: 12px; 131 | font-weight: bold; 132 | left: -1px; 133 | line-height:2; 134 | padding: 3px 7px; 135 | position: absolute; 136 | top: -1px; 137 | } 138 | .demo .row-fluid { 139 | background-color: #F5F5F5; 140 | -webkit-box-sizing: border-box; 141 | -moz-box-sizing: border-box; 142 | box-sizing: border-box; 143 | -webkit-box-shadow: inset 0 1px 13px rgba(0, 0, 0, 0.1); 144 | -moz-box-shadow: inset 0 1px 13px rgba(0, 0, 0, 0.1); 145 | box-shadow: inset 0 1px 13px rgba(0, 0, 0, 0.1); 146 | border: 1px solid #DDDDDD; 147 | border-radius: 4px 4px 4px 4px; 148 | margin: 15px 0; 149 | position: relative; 150 | padding: 25px 14px 0; 151 | } 152 | .edit .column:after { 153 | background-color: #F5F5F5; 154 | border: 1px solid #DDDDDD; 155 | border-radius: 4px 0 4px 0; 156 | color: #9DA0A4; 157 | content: "Column"; 158 | font-size: 12px; 159 | font-weight: bold; 160 | left: -1px; 161 | padding: 3px 7px; 162 | position: absolute; 163 | top: -1px; 164 | } 165 | .column { 166 | background-color: #FFFFFF; 167 | border: 1px solid #DDDDDD; 168 | border-radius: 4px 4px 4px 4px; 169 | margin: 15px 0; 170 | padding: 39px 19px 24px; 171 | position: relative; 172 | } 173 | 174 | /* preview */ 175 | body.devpreview { margin-left:0px;} 176 | .devpreview .sidebar-nav { 177 | left:-200px; 178 | -webkit-transition: all 0ms ease; 179 | -moz-transition: all 0ms ease; 180 | -ms-transition: all 0ms ease; 181 | -o-transition: all 0ms ease; 182 | transition: all 0ms ease; 183 | } 184 | .devpreview .drag, .devpreview .configuration, .devpreview .remove { display:none !Important; } 185 | .sourcepreview .column, .sourcepreview .row-fluid, .sourcepreview .demo .box { 186 | margin:0px 0; 187 | padding:0px; 188 | background:none; 189 | border:none; 190 | -webkit-box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.00); 191 | -moz-box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.00); 192 | box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.00); 193 | } 194 | .devpreview .demo .box, .devpreview .demo .row-fluid { padding-top:0; background:none; } 195 | .devpreview .demo .column { padding-top:19px; padding-bottom:19px; } 196 | #download-layout { display: none } 197 | #editorModal textarea, 198 | #downloadModal textarea { width:100%;height:280px;resize: none;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box; } 199 | #editorModal {width:640px;} 200 | a.language-selected { font-style: italic; font-weight: bold; } 201 | -------------------------------------------------------------------------------- /html/edit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <?php echo soft_name?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 | 95 |
96 | 106 |
107 |
108 | 109 |
110 |
111 | 112 | 113 | 114 | 115 | 116 | 122 | 123 | 124 |
125 |
126 | 127 |
128 |
129 |

130 | 第二部分内容. 131 |

132 |
133 | 134 | 154 | 155 |
156 |
157 |
158 |
159 |
-------------------------------------------------------------------------------- /html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <?php echo soft_name?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 | 95 |
96 | 104 |
105 |
106 | 109 | 110 | 111 | 112 | 115 | 118 | 121 | 124 | 127 | 130 | 133 | 136 | 139 | 142 | 145 | 148 | 149 | 150 | 151 | 152 | 153 |
113 | Id 114 | 116 | URL 117 | 119 | User 120 | 122 | Status 123 | 125 | 节点IP 126 | 128 | High 129 | 131 | Middle 132 | 134 | Low 135 | 137 | Banner 138 | 140 | OS 141 | 143 | Finishtime 144 | 146 | 操作 147 |
154 |
155 |
156 |

157 | 第二部分内容. 158 |

159 |
160 | 161 | 179 | 180 |
181 |
182 |
183 |
184 |
-------------------------------------------------------------------------------- /html/info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <?php echo soft_name?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 | 95 |
96 | 104 |
105 | 142 |
143 | 146 | 147 | 148 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 171 | 172 | 173 | 174 | 175 |
150 | Id 151 | 153 | Type 154 | 156 | Level 157 | 159 | Webpath 160 | 162 | Param 163 | 165 | details 166 | 168 | HTTP Request 169 |
176 |
177 |
178 |

179 | 第二部分内容. 180 |

181 |
182 | 183 | 203 | 204 |
205 |
206 |
207 |
208 |
-------------------------------------------------------------------------------- /html/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <?php echo soft_name?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 44 | 45 |
46 |
47 |
48 |

Please sign in

49 | 50 | 51 | 52 | 53 |
54 | 57 |
58 | 59 |
60 |
61 |
62 | 63 | 64 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /html/point.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <?php echo soft_name?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 | 95 |
96 | 104 |
105 |
106 | 107 | 108 | 109 | 112 | 115 | 118 | 121 | 124 | 127 | 128 | 129 | 130 | 131 | 132 |
110 | 序号 111 | 113 | 节点IP 114 | 116 | 端口 117 | 119 | 任务状态 120 | 122 | 启用状态 123 | 125 | 操作 126 |
133 |
134 |
135 | 136 |
137 |
138 | 139 | 140 | 141 | 145 | 146 | 147 | 148 |
149 |
150 | 151 |
152 | 153 | 154 | 155 | 156 | 176 | 177 | 178 |
179 |
180 |
181 |
182 |
-------------------------------------------------------------------------------- /html/scan.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <?php echo soft_name?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 | 95 |
96 | 106 |
107 |
108 | 109 |
110 |
111 | 112 | 113 | 114 | 115 | 116 | 122 | 123 | 124 |
125 |
126 | 127 |
128 |
129 |

130 | 第二部分内容. 131 |

132 |
133 | 134 | 154 | 155 | 156 |
157 |
158 |
159 |
160 |
-------------------------------------------------------------------------------- /html/set.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <?php echo soft_name?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 | 95 |
96 | 104 |
105 |
106 | 107 | 108 | 109 | 112 | 115 | 118 | 121 | 124 | 127 | 128 | 129 | 130 | 131 | 132 |
110 | 序号 111 | 113 | 用户名 114 | 116 | 邮箱 117 | 119 | 手机 120 | 122 | 状态 123 | 125 | 操作 126 |
133 |
134 |
135 | 136 |
137 |
138 | 139 | 140 | 141 | 142 | 143 | 147 | 148 | 152 | 153 | 154 | 155 |
156 |
157 | 158 |
159 | 160 | 161 | 162 | 163 | 183 | 184 | 185 |
186 |
187 |
188 |
189 |
-------------------------------------------------------------------------------- /include/IExcel.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibijj/AwvScan/59e725c001ff0f9d76ad89834af9b52bbb71479f/include/IExcel.php -------------------------------------------------------------------------------- /include/XmlExcel.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibijj/AwvScan/59e725c001ff0f9d76ad89834af9b52bbb71479f/include/XmlExcel.php -------------------------------------------------------------------------------- /include/common.fun.php: -------------------------------------------------------------------------------- 1 | $_v) ${$_k} = _runmagicquotes($_v); 17 | } 18 | function _runmagicquotes(&$svar){ 19 | if(!get_magic_quotes_gpc()){ 20 | if( is_array($svar) ){ 21 | foreach($svar as $_k => $_v) $svar[$_k] = _runmagicquotes($_v); 22 | }else{ 23 | $svar = addslashes($svar); 24 | } 25 | } 26 | return $svar; 27 | } 28 | function Ajaxmsg($msg) 29 | { 30 | echo $msg; 31 | exit(); 32 | } 33 | function AjaxJsonMsg($arr) 34 | { 35 | foreach ($arr as $k=>$v) 36 | { 37 | $arr[$k] = iconv("GB2312","UTF-8",$v); 38 | } 39 | echo json_encode($arr); 40 | exit(); 41 | } 42 | /***弹出信息*/ 43 | function Message($msg,$gourl=0,$onlymsg=0,$limittime=1000){ 44 | global $sitename,$includeurl; 45 | $htmlhead = "\r\n\r\n{$sitename}提示信息\r\n\r\n"; 46 | $htmlhead .= "\r\n\r\n\r\n
\r\n\r\n
\r\n\r\n\r\n"; 48 | $litime = ($limittime==0 ? 1000 : $limittime); 49 | $func = ''; 50 | if($gourl=='-1'){ 51 | if($limittime==0) $litime = 1000; 52 | $gourl = "javascript:history.go(-1);"; 53 | } 54 | if($gourl=='0'){ 55 | if($limittime==0) $litime = 1000; 56 | $gourl = "javascript:history.back();"; 57 | } 58 | if($gourl=='' || $onlymsg==1){ 59 | $msg = ""; 60 | }else{ 61 | if(preg_match('/close::/i',$gourl)){ 62 | $tgobj = trim(eregi_replace('close::', '', $gourl)); 63 | $gourl = 'javascript:;'; 64 | $func .= "window.parent.document.getElementById('{$tgobj}').style.display='none';\r\n"; 65 | } 66 | 67 | $func .= " var pgo=0; 68 | function JumpUrl(){ 69 | if(pgo==0){ location='$gourl'; pgo=1; } 70 | }\r\n"; 71 | $rmsg = $func; 72 | $rmsg .= "document.write(\"
"; 73 | $rmsg .= "
{$sitename} 提示信息!
\");\r\n"; 74 | $rmsg .= "document.write(\"

\");\r\n"; 75 | $rmsg .= "document.write(\"".str_replace("\"","“",$msg)."\");\r\n"; 76 | $rmsg .= "document.write(\""; 77 | 78 | if($onlymsg==0){ 79 | if( $gourl != 'javascript:;' && $gourl != ''){ 80 | $rmsg .= "
如果你的浏览器没反应,请点击这里..."; 81 | $rmsg .= "
\");\r\n"; 82 | $rmsg .= "setTimeout('JumpUrl()',$litime);"; 83 | }else{ 84 | $rmsg .= "
\");\r\n"; 85 | } 86 | }else{ 87 | $rmsg .= "
\");\r\n"; 88 | } 89 | $msg = $htmlhead.$rmsg.$htmlfoot; 90 | } 91 | echo $msg; 92 | exit(); 93 | } 94 | 95 | /** 96 | * 弹出JS对话框 $msg指弹出内容,$url是跳转页面,如果为0的情况则返回上一级目录 97 | */ 98 | function Alert($msg,$url="0") 99 | { 100 | if ($url =="0") { 101 | $url = "history.go(-1)"; 102 | } 103 | else{ 104 | $url = "window.location.href = '$url'"; 105 | } 106 | echo ""; 107 | exit(); 108 | } 109 | 110 | /**获取IP地址*/ 111 | function ld_ipaddress() 112 | { 113 | if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) 114 | $ip = getenv("HTTP_CLIENT_IP"); 115 | else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) 116 | $ip = getenv("HTTP_X_FORWARDED_FOR"); 117 | else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) 118 | $ip = getenv("REMOTE_ADDR"); 119 | else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) 120 | $ip = $_SERVER['REMOTE_ADDR']; 121 | else 122 | $ip = "unknown"; 123 | return($ip); 124 | } 125 | 126 | /** 127 | * 数字分页 128 | * */ 129 | function Page($num = '',$url = '',$pagesize = 20,$ishtml=0) 130 | { 131 | global $page,$pagesql,$pagenav,$includeurl,$cfg; //定义三个全局变量,$page是页码,$pagesql是SQL语句里面的imit,$pagenav是分页的连接 132 | $lastpage = ceil(($num/$pagesize)); //末页 133 | if($page >= $lastpage) $page = $lastpage;//如果页码大于等于总共页数,那么页码就等于总共页数 134 | if($page =="" or $page<=0) $page =1; //如果page为空又或者page小于等于0时则page等于1 135 | $prepg=$page-1; //上一页 136 | $nextpg=$page+1; //下一页 137 | $pagesql = ($page-1)*$pagesize; //计算SQL语句 138 | $GLOBALS["pagesize"]=$pagesize; //为使函数外部可以访问这里的“$displaypg”,将它也设为全局变量。注意一个变量重新定义为全局变量后,原值被覆盖,所以这里给它重新赋值。 139 | $pagenum = 10; //每个显示多少条 140 | if($ishtml==0) 141 | { 142 | $pagenavurl = "{$url}page=1"; 143 | $pageurl1 = "{$url}page=$prepg"; 144 | $nextpageurl = "{$url}page=$nextpg"; 145 | $lastpageurl = "{$url}page=$lastpage"; 146 | }else 147 | { 148 | $pagenavurl = "{$url}-1.html"; 149 | $pageurl1 = "{$url}-$prepg.html"; 150 | $nextpageurl = "{$url}-$nextpg.html"; 151 | $lastpageurl = "{$url}-$lastpage.html"; 152 | } 153 | $pagenav = "
"; 177 | } 178 | /** 179 | * 获取某个表中的某个最大的值 180 | */ 181 | function ld_gettablemax($table,$field="ord") 182 | { 183 | global $db; 184 | $i = $db->listtablezd($table,"max({$field})"); 185 | return $i+1; 186 | } 187 | 188 | /** 189 | * 选择时间格式 190 | * 191 | * 1返回Y-m-d H:i:s 192 | * 2返回Y-m-d 193 | */ 194 | function ld_select_date($date,$type=1) 195 | { 196 | if(!empty($date)) 197 | { 198 | if($type==1) 199 | return date('Y-m-d H:i:s',$date); 200 | else if($type==2) 201 | return date('Y-m-d',$date); 202 | else if($type==3) 203 | return date('Y-m',$date); 204 | else if($type==4) 205 | return date('Y年m月d日',$date); 206 | else if($type==5) 207 | return date('m-d',$date); 208 | } 209 | else { 210 | return ""; 211 | } 212 | 213 | } 214 | 215 | /** 216 | * 清除所有HTML 217 | */ 218 | function ld_clearhtml($str,$len) { 219 | $str=eregi_replace("<\/*[^<>]*>", '', $str); 220 | $str=str_replace(" ", '', $str); 221 | $str=str_replace("::", ':', $str); 222 | $str=str_replace(" ", '', $str); 223 | $str=str_replace("#p#", '', $str); 224 | $str=str_replace(" ", '', $str); 225 | $str=str_replace(" ", '', $str); 226 | $str=str_replace(" ", '', $str); 227 | $str=str_replace("“", '"', $str); 228 | $str=str_replace("”", '"', $str); 229 | $str=str_replace("—", '-', $str); 230 | $str = ereg_replace("\t","",$str); 231 | $str = ereg_replace("\r\n","",$str); 232 | $str = ereg_replace("\r","",$str); 233 | $str = ereg_replace("\n","",$str); 234 | $str = ereg_replace(" "," ",$str); 235 | $str = ereg_replace("…","",$str); 236 | $str = GBsubstr($str,0,$len); 237 | return $str; 238 | } 239 | 240 | /* 241 | *P中文字串截取无乱码 242 | */ 243 | 244 | function GBsubstr($str, $start, $len) { // $str指字符串,$start指字符串的起始位置,$len指字符串长度 245 | $strlen = $start + $len; // 用$strlen存储字符串的总长度,即从字符串的起始位置到字符串的总长度 246 | for($i = $start; $i < $strlen;) { 247 | if (ord ( substr ( $str, $i, 1 ) ) > 0xa0) { // 如果字符串中首个字节的ASCII序数值大于0xa0,则表示汉字 248 | $tmpstr .= substr ( $str, $i, 3 ); // 每次取出三位字符赋给变量$tmpstr,即等于一个汉字 249 | $i=$i+3; // 变量自加3 250 | } else{ 251 | $tmpstr .= substr ( $str, $i, 1 ); // 如果不是汉字,则每次取出一位字符赋给变量$tmpstr 252 | $i++; 253 | } 254 | } 255 | return $tmpstr; // 返回字符串 256 | } 257 | 258 | 259 | 260 | /** 261 | *获取表单复选框 262 | */ 263 | function ld_Getbox($str,$split=",") 264 | { 265 | for ($i=0;$_POST[$str][$i]!="";$i++)//通过for循环取值 266 | { 267 | $checkbox .= $_POST[$str][$i].$split; 268 | } 269 | return $checkbox; 270 | } 271 | function ld_listip($ip) 272 | { 273 | //IP数据文件路径 274 | $ipaddress = $ip; 275 | $dat_path = dirname(__FILE__).'/QQWry.Dat'; //检查IP地址 276 | if(!preg_match("/^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$/", $ip)){ 277 | return 'IP 地址错误!'; 278 | } 279 | //打开IP数据文件 280 | if(!$fd = @fopen($dat_path, 'rb')){ 281 | return 'IP数据文件无法读取,请确保是正确的纯真IP库!'; 282 | } //分解IP进行运算,得出整形数 283 | $ip = explode('.', $ip); 284 | $ipNum = $ip[0] * 16777216 + $ip[1] * 65536 + $ip[2] * 256 + $ip[3]; //获取IP数据索引开始和结束位置 285 | $DataBegin = fread($fd, 4); 286 | $DataEnd = fread($fd, 4); 287 | $ipbegin = implode('', unpack('L', $DataBegin)); //unpack() 函数从二进制字符串对数据进行解包。unpack(format,data) L - unsigned long (always 32 bit, machine byte order) 288 | #$ipbegin 值如:5386001 289 | if($ipbegin < 0) $ipbegin += pow(2, 32); 290 | $ipend = implode('', unpack('L', $DataEnd)); 291 | if($ipend < 0) $ipend += pow(2, 32); 292 | $ipAllNum = ($ipend - $ipbegin) / 7 + 1; 293 | 294 | $BeginNum = 0; 295 | $EndNum = $ipAllNum; //使用二分查找法从索引记录中搜索匹配的IP记录 296 | $ip1num=''; $ip2num=''; $ipAddr1=''; $ipAddr2=''; 297 | while($ip1num>$ipNum || $ip2num<$ipNum) { 298 | $Middle= intval(($EndNum + $BeginNum) / 2); //偏移指针到索引位置读取4个字节 299 | fseek($fd, $ipbegin + 7 * $Middle); 300 | $ipData1 = fread($fd, 4); 301 | if(strlen($ipData1) < 4) { 302 | fclose($fd); 303 | return 'System Error'; 304 | } 305 | //提取出来的数据转换成长整形,如果数据是负数则加上2的32次幂 306 | $ip1num = implode('', unpack('L', $ipData1)); 307 | if($ip1num < 0) $ip1num += pow(2, 32); 308 | 309 | //提取的长整型数大于我们IP地址则修改结束位置进行下一次循环 310 | if($ip1num > $ipNum) { 311 | $EndNum = $Middle; 312 | continue; 313 | } 314 | 315 | //取完上一个索引后取下一个索引 316 | $DataSeek = fread($fd, 3); 317 | if(strlen($DataSeek) < 3) { 318 | fclose($fd); 319 | return 'System Error'; 320 | } 321 | $DataSeek = implode('', unpack('L', $DataSeek.chr(0))); 322 | fseek($fd, $DataSeek); 323 | $ipData2 = fread($fd, 4); 324 | if(strlen($ipData2) < 4) { 325 | fclose($fd); 326 | return 'System Error'; 327 | } 328 | $ip2num = implode('', unpack('L', $ipData2)); 329 | if($ip2num < 0) $ip2num += pow(2, 32); //没找到提示未知 330 | if($ip2num < $ipNum) { 331 | if($Middle == $BeginNum) { 332 | fclose($fd); 333 | return 'Unknown'; 334 | } 335 | $BeginNum = $Middle; 336 | } 337 | } //下面的代码读晕了,没读明白,有兴趣的慢慢读 338 | $ipFlag = fread($fd, 1); 339 | if($ipFlag == chr(1)) { 340 | $ipSeek = fread($fd, 3); 341 | if(strlen($ipSeek) < 3) { 342 | fclose($fd); 343 | return 'System Error'; 344 | } 345 | $ipSeek = implode('', unpack('L', $ipSeek.chr(0))); 346 | fseek($fd, $ipSeek); 347 | $ipFlag = fread($fd, 1); 348 | } if($ipFlag == chr(2)) { 349 | $AddrSeek = fread($fd, 3); 350 | if(strlen($AddrSeek) < 3) { 351 | fclose($fd); 352 | return 'System Error'; 353 | } 354 | $ipFlag = fread($fd, 1); 355 | if($ipFlag == chr(2)) { 356 | $AddrSeek2 = fread($fd, 3); 357 | if(strlen($AddrSeek2) < 3) { 358 | fclose($fd); 359 | return 'System Error'; 360 | } 361 | $AddrSeek2 = implode('', unpack('L', $AddrSeek2.chr(0))); 362 | fseek($fd, $AddrSeek2); 363 | } else { 364 | fseek($fd, -1, SEEK_CUR); 365 | } while(($char = fread($fd, 1)) != chr(0)) 366 | $ipAddr2 .= $char; $AddrSeek = implode('', unpack('L', $AddrSeek.chr(0))); 367 | fseek($fd, $AddrSeek); while(($char = fread($fd, 1)) != chr(0)) 368 | $ipAddr1 .= $char; 369 | } else { 370 | fseek($fd, -1, SEEK_CUR); 371 | while(($char = fread($fd, 1)) != chr(0)) 372 | $ipAddr1 .= $char; $ipFlag = fread($fd, 1); 373 | if($ipFlag == chr(2)) { 374 | $AddrSeek2 = fread($fd, 3); 375 | if(strlen($AddrSeek2) < 3) { 376 | fclose($fd); 377 | return 'System Error'; 378 | } 379 | $AddrSeek2 = implode('', unpack('L', $AddrSeek2.chr(0))); 380 | fseek($fd, $AddrSeek2); 381 | } else { 382 | fseek($fd, -1, SEEK_CUR); 383 | } 384 | while(($char = fread($fd, 1)) != chr(0)){ 385 | $ipAddr2 .= $char; 386 | } 387 | } 388 | fclose($fd); //最后做相应的替换操作后返回结果 389 | if(preg_match('/http/i', $ipAddr2)) { 390 | $ipAddr2 = ''; 391 | } 392 | $ipaddr = "$ipAddr1 $ipAddr2"; 393 | $ipaddr = preg_replace('/CZ88.Net/is', '', $ipaddr); 394 | $ipaddr = preg_replace('/^s*/is', '', $ipaddr); 395 | $ipaddr = preg_replace('/s*$/is', '', $ipaddr); 396 | //var_dump($ipaddr); 397 | if(preg_match('/http/i', $ipaddr) || $ipaddr == '') { 398 | $ipaddr = 'Unknown'; 399 | } 400 | return $ipaddress." ".iconv("GB2312","UTF-8",$ipaddr); 401 | } 402 | 403 | /** 404 | * 获取Select表单 405 | */ 406 | function ld_GetSelect($sql,$select="",$split) 407 | { 408 | global $db; 409 | $query = $db->query($sql); 410 | while ($rs = $db->fetch_array($query)) 411 | { 412 | $ss = $select==$rs[0] ? "selected" : ""; 413 | $str .= ""; 414 | } 415 | return $str; 416 | } 417 | /** 418 | * 获取Select表单,数组 419 | */ 420 | function ld_GetSelectArr($arr,$select="",$stype=0) 421 | { 422 | global $db; 423 | foreach ($arr as $k=>$v) 424 | { 425 | $temp = $stype==0 ? $v : $k; 426 | $ss = "{$select}"=="{$temp}" ? "selected" : ""; 427 | $str .= ""; 428 | } 429 | return $str; 430 | } 431 | function ld_GetLang() 432 | { 433 | $Lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 4); 434 | if (preg_match('/zh-c/i',$Lang)) 435 | { 436 | $Lang = '简体中文'; 437 | } 438 | elseif (preg_match('/zh/i',$Lang)) 439 | { 440 | $Lang = '繁體中文'; 441 | } 442 | else{ 443 | $Lang = 'English'; 444 | } 445 | return $Lang; 446 | } 447 | function ld_GetBrowser() 448 | { 449 | $Browser = $_SERVER['HTTP_USER_AGENT']; 450 | if (preg_match('/MSIE/i',$Browser)) 451 | { 452 | $Browser = 'MSIE'; 453 | } 454 | elseif (preg_match('/Firefox/i',$Browser)) 455 | { 456 | $Browser = 'Firefox'; 457 | } 458 | elseif (preg_match('/Chrome/i',$Browser)) 459 | { 460 | $Browser = 'Chrome'; 461 | } 462 | elseif (preg_match('/Safari/i',$Browser)) 463 | { 464 | $Browser = 'Safari'; 465 | } 466 | elseif (preg_match('/Opera/i',$Browser)) 467 | { 468 | $Browser = 'Opera'; 469 | } 470 | else 471 | { 472 | $Browser = 'Other'; 473 | } 474 | return $Browser; 475 | } 476 | /** 477 | * 判断ID 478 | */ 479 | function ld_CheckID($id,$tablename,$msg="非法提交") 480 | { 481 | global $db,$path; 482 | if(empty($id)) 483 | { 484 | Alert($msg); 485 | } 486 | if(!is_numeric($id)) 487 | { 488 | Alert($msg); 489 | } 490 | ld_CheckInput($id); 491 | if(!$db->checknumsql("select * from $tablename")) 492 | { 493 | Alert($msg); 494 | } 495 | return $id; 496 | unset($db); 497 | } 498 | function ld_CheckInput($str) 499 | { 500 | // 如果不是数字则加引号 501 | $arr = array("\\",">","<","script","select","join","or","=","union","where","insert","delete","update","like","drop","create","modify","alert","cast","show tables"); 502 | foreach ($arr as $k) 503 | { 504 | if(stristr("$str","$k")) Alert("非法提交"); 505 | } 506 | return $str; 507 | } 508 | 509 | /**正则判断目录**/ 510 | function ld_Checkpath($str) 511 | { 512 | $arr = array("\\","/","..",":"); 513 | foreach ($arr as $k) 514 | { 515 | if(stristr("$str","$k")) Alert("非法提交"); 516 | } 517 | return $str; 518 | } 519 | 520 | /**正则判断手机**/ 521 | function ld_is_mobile($str){ 522 | return preg_match("/(^[1][3][0-9]{9}$)|(^[1][5][0-9]{9}$)|(^[1][8][0-9]{9}$)|(^[0][1-9]{1}[0-9]{9}$)/", $str); 523 | } 524 | /**正则判断邮箱地址**/ 525 | function ld_is_email($str){ 526 | return preg_match("/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/", $str); 527 | } 528 | /**正则判断正整数**/ 529 | function ld_is_zzs($str){ 530 | return preg_match("/^[0-9]*[1-9][0-9]*$/", $str); 531 | } 532 | /**正则判断整数**/ 533 | function ld_is_zs($str){ 534 | return preg_match("/-?\\d+$/", $str); 535 | } 536 | /**正则判断网址**/ 537 | function ld_is_url($str){ 538 | return preg_match("/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"])*$/", $str); 539 | } 540 | 541 | function get_severity($hash,$severity) { 542 | global $db; 543 | 544 | $sql = "SELECT * FROM target_vul where hash='{$hash}' and Severity='{$severity}' order by Severity"; 545 | $results = $db->query($sql); 546 | return mysql_num_rows($results); 547 | } 548 | 549 | function specify_server() { 550 | global $db; 551 | 552 | $sql = "SELECT * FROM point_server order by level"; 553 | $results = $db->fetch_assoc($sql); 554 | $hash = $results['hash']; 555 | $str = $results['pointip'].' '.$results['pointport'].' '.$results['level']; 556 | 557 | $up_arr['level'] = $results['level'] + 1; 558 | 559 | $update = $db->update("point_server",$up_arr,"hash='{$hash}'"); 560 | 561 | return $results['pointip']; 562 | 563 | } 564 | 565 | function point_display() { 566 | global $db; 567 | 568 | $sql = "SELECT * FROM point_server"; 569 | 570 | $results = $db->query($sql); 571 | if (mysql_num_rows($results) > 0){ 572 | while ($fs = $db->fetch_array($results)) 573 | { 574 | $ip = $fs["pointip"]; 575 | $port = $fs["pointport"]; 576 | $level = $fs["level"]; 577 | $status = $fs["status"]; 578 | $hash = $fs["hash"]; 579 | 580 | $html_str .= " 581 |
582 |
583 |
584 | 585 |

586 | 节点信息修改 587 |

588 |
589 |
590 |
591 | 592 | 593 | 594 | 598 |
599 |
600 |
601 | 602 |
603 |
604 |
\r\n"; 605 | } 606 | 607 | return $html_str; 608 | } 609 | } 610 | 611 | function set_display() { 612 | global $db; 613 | 614 | $sql = "SELECT * FROM user"; 615 | 616 | $results = $db->query($sql); 617 | if (mysql_num_rows($results) > 0){ 618 | while ($fs = $db->fetch_array($results)) 619 | { 620 | $username = $fs["username"]; 621 | $email = $fs["email"]; 622 | $phone = $fs["phone"]; 623 | $status = $fs["status"]; 624 | $hash = md5($username); 625 | 626 | $html_str .= " 627 |
628 |
629 |
630 | 631 |

632 | 用户信息修改 633 |

634 |
635 |
636 |
637 | 638 | 639 | 640 | 641 | 642 | 646 |
647 |
648 |
649 | 650 |
651 |
652 |
\r\n"; 653 | } 654 | 655 | return $html_str; 656 | } 657 | } 658 | 659 | function Checklogin($mode) 660 | { 661 | if ($mode != 'login'){ 662 | if(empty($_SESSION['username'])){ 663 | header("Location: ?m=login"); 664 | exit(); 665 | }elseif( $_SESSION['r_ip'] != $_SERVER['REMOTE_ADDR'] ) { 666 | header("Location: ?m=login"); 667 | exit(); 668 | } 669 | } 670 | } 671 | 672 | function cpasswd() 673 | { 674 | global $db; 675 | 676 | $username = $_SESSION['username']; 677 | $oldpasswd = $_POST['oldpasswd']; 678 | 679 | $up_arr['passwd'] = $_POST['newpasswd']; 680 | 681 | $update = $db->update("user",$up_arr,"username='{$username}' and passwd='{$oldpasswd}'"); 682 | 683 | Ajaxmsg("密码修改成功"); 684 | } 685 | 686 | function del() 687 | { 688 | global $db; 689 | 690 | $hash = $_POST['hash']; 691 | 692 | $delete = $db->delete("scan_list where hash='{$hash}'"); 693 | $delete = $db->delete("target_info where hash='{$hash}'"); 694 | $delete = $db->delete("target_vul where hash='{$hash}'"); 695 | 696 | Ajaxmsg("删除成功"); 697 | } 698 | 699 | function export() 700 | { 701 | global $db; 702 | 703 | require LDINC.'/XmlExcel.php'; 704 | 705 | $title1 = array( 706 | 'URL', 707 | 'User', 708 | 'Status', 709 | '节点IP', 710 | 'High', 711 | 'Middle', 712 | 'Low', 713 | 'Banner', 714 | 'OS', 715 | 'Finishtime' 716 | ); 717 | 718 | $title2 = array( 719 | 'Id', 720 | 'Type', 721 | 'Level', 722 | 'Webpath', 723 | 'Param', 724 | 'details', 725 | 'Request' 726 | ); 727 | 728 | if ( !empty($_GET['hash']) ) { 729 | $hash = $_GET['hash']; 730 | 731 | $xls = new XmlExcel; 732 | $xls -> setDefaultWidth(80); 733 | $xls -> setDefaultAlign("center"); 734 | $xls -> setDefaultHeight(30); 735 | 736 | $xls -> addHead($title1,'info'); 737 | $sql = "SELECT a.url,a.user,a.pointserver,b.finishtime,b.banner,b.os,b.responsive FROM scan_list as a,target_info as b where a.hash = b.hash and a.hash = '{$hash}'"; 738 | $results = $db->fetch_assoc($sql); 739 | 740 | $url = $results['url']; 741 | $user = $results['user']; 742 | $pointserver = $results['pointserver']; 743 | $finishtime = $results['finishtime']; 744 | $banner = $results['banner']; 745 | $os = $results['os']; 746 | $status = $results['responsive']; 747 | $high = get_severity($hash,'high'); 748 | $middle = get_severity($hash,'middle'); 749 | $low = get_severity($hash,'low'); 750 | 751 | $data_arr = array( 752 | $url, 753 | $user, 754 | $status, 755 | $pointserver, 756 | $high, 757 | $middle, 758 | $low, 759 | $banner, 760 | $os, 761 | $finishtime 762 | ); 763 | 764 | $xls -> addRow($data_arr,'info'); 765 | 766 | $xls -> addHead($title2,'vulnerability'); 767 | $sql = "SELECT * FROM target_vul where hash='{$hash}' order by Severity"; 768 | $results = $db->query($sql); 769 | if (mysql_num_rows($results) > 0){ 770 | $i = 1; 771 | while ($fs = $db->fetch_array($results)) 772 | { 773 | $id = $i; 774 | $Name = $fs["name"]; 775 | $Affects = $fs["affects"]; 776 | $Parameter = $fs["parameter"]; 777 | $Severity = $fs["severity"]; 778 | $details = $fs["details"]; 779 | $Request = str_replace("\r\n",' ',urldecode($fs["request"])); 780 | //$Response = str_replace("\r\n",' ',urldecode($fs["response"])); 781 | 782 | if (strtolower($Severity) == 'high'){ 783 | $class = 'error'; 784 | }else if(strtolower($Severity) == 'middle'){ 785 | $class = 'warning'; 786 | }else if(strtolower($Severity) == 'low' or strtolower($Severity) == 'info'){ 787 | $class = 'info'; 788 | } 789 | 790 | if ($Parameter == 'Array'){ 791 | $Parameter = ''; 792 | } 793 | 794 | if ($Request == 'Array'){ 795 | $Request = ''; 796 | } 797 | /* 798 | if ($Response == 'Array'){ 799 | $Response = ''; 800 | } 801 | */ 802 | 803 | $vul_arr = array( 804 | $id, 805 | $Name, 806 | $Severity, 807 | $Affects, 808 | $Parameter, 809 | $details, 810 | $Request 811 | ); 812 | $xls -> addRow($vul_arr,'vulnerability'); 813 | } 814 | } 815 | $xls -> export($hash); 816 | } 817 | } 818 | 819 | function nginx_vhost($url,$cookie) 820 | { 821 | //读demo.conf内容,替换。 822 | $demo_conf_path = LDINC.'/vhost-demo.conf'; 823 | //echo $demo_conf_path; 824 | $tmp_arr = explode("/",$url); 825 | $host_str = $tmp_arr[2]; 826 | $host_arr = explode(":",$host_str); 827 | $host = $host_arr[0]; 828 | $ngx_path = nginx_path; 829 | 830 | dns_config($host); 831 | 832 | $tmp_str = file_get_contents($demo_conf_path); 833 | $tmp_str = str_replace("#host#",$host,$tmp_str); 834 | $tmp_str = str_replace("#url#",$url,$tmp_str); 835 | $tmp_str = str_replace("#cookie#",$cookie,$tmp_str); 836 | //echo $tmp_str; 837 | 838 | //写配置 839 | $filename = "$ngx_path/conf/vhost-$host.conf"; 840 | //echo $filename; 841 | $fh = fopen($filename, "w"); 842 | fwrite($fh, $tmp_str); 843 | fclose($fh); 844 | 845 | //执行reload 846 | $cmd = '"'.$ngx_path.'/restart_ngx.bat"'; 847 | //echo $cmd; 848 | $a = exec($cmd); 849 | } 850 | 851 | function dns_config($domain) 852 | { 853 | $ip = nginx_ip; 854 | $str = "$domain = $ip\r\n"; 855 | 856 | #print $str; 857 | 858 | $ip_conf = LDINC.'/ip.conf'; 859 | $all_str = file_get_contents($ip_conf); 860 | $tmp_arr = explode("|",$all_str); 861 | 862 | if (in_array($domain,$tmp_arr) == FALSE){ 863 | 864 | //写配置 865 | $fh = fopen(dns_conf, "a+"); 866 | fwrite($fh, $str); 867 | fclose($fh); 868 | 869 | //写配置 870 | $f = fopen($ip_conf, "a+"); 871 | fwrite($f, "$all_str|$domain"); 872 | fclose($f); 873 | } 874 | } 875 | 876 | ?> -------------------------------------------------------------------------------- /include/config.inc.php: -------------------------------------------------------------------------------- 1 | query($sql); 8 | if (mysql_num_rows($results) > 0){ 9 | $i = 1; 10 | while ($fs = $db->fetch_array($results)) 11 | { 12 | $id = $i; 13 | $url = $fs["1"]; 14 | $user = $fs["3"]; 15 | $pointserver = $fs["4"]; 16 | $hash = $fs["11"]; 17 | $finishtime = $fs["16"]; 18 | $banner = $fs["17"]; 19 | $responsive = $fs["18"]; 20 | $technologies = $fs["20"]; 21 | $os = $fs["19"]; 22 | $high = get_severity($hash,'high'); 23 | $middle = get_severity($hash,'middle'); 24 | $low = get_severity($hash,'low'); 25 | 26 | if (strtolower($responsive) == 'true'){ 27 | $class = 'success'; 28 | $responsive = "正常"; 29 | }else if (strtolower($responsive) == 'false'){ 30 | $class = 'error'; 31 | $responsive = "错误"; 32 | }else{ 33 | $class = ''; 34 | } 35 | 36 | $html_str .= " 37 | 38 | 39 | $id 40 | 41 | 42 | $url 43 | 44 | 45 | $user 46 | 47 | 48 | $responsive 49 | 50 | 51 | $pointserver 52 | 53 | 54 | $high 55 | 56 | 57 | $middle 58 | 59 | 60 | $low 61 | 62 | 63 | $banner 64 | 65 | 66 | $os 67 | 68 | 69 | $finishtime 70 | 71 | 72 | 详情|编辑|删除|报告 73 | 74 | \r\n"; 75 | $i ++; 76 | } 77 | 78 | return $html_str; 79 | }else{ 80 | return ""; 81 | 82 | } 83 | } 84 | 85 | function scan() { 86 | global $db; 87 | 88 | //print_r($_POST); 89 | 90 | if(!empty($_POST['url'])){ 91 | 92 | $pointserver = specify_server(); 93 | if (!empty($pointserver)){ 94 | 95 | $in_arr['url'] = $_POST['url']; 96 | $in_arr['createtime'] = date('Y-m-d'); 97 | $in_arr['user'] = $_SESSION['username'];//当前session用户 98 | $in_arr['pointserver'] = specify_server();//分配节点服务器ip 99 | $in_arr['group'] = "";//项目组名称 100 | $in_arr['siteuser'] = $_POST['user']; 101 | $in_arr['sitepwd'] = $_POST['pwd']; 102 | $in_arr['cookie'] = $_POST['cookie']; 103 | $in_arr['rule'] = $_POST['rule']; 104 | $in_arr['status'] = 'new'; 105 | $in_arr['hash'] = md5($in_arr['url'].time().authkey); 106 | 107 | if ( $_POST['auth'] == 'on' ) nginx_vhost( $in_arr['url'] , $in_arr['cookie'] ); 108 | 109 | $insert = $db->insert_into("scan_list",$in_arr); 110 | 111 | }else{ 112 | Message(" 请配置节点服务器 ","?m=point",0,3000); 113 | } 114 | } 115 | } 116 | 117 | function info() { 118 | global $db; 119 | 120 | $action = $_GET['c']; 121 | $hash = $_GET['p']; 122 | 123 | if (empty($action)){ 124 | $sql = "SELECT * FROM target_vul where hash='{$hash}' order by Severity"; 125 | }else if ($action == 'high'){ 126 | $sql = "SELECT * FROM target_vul where hash='{$hash}' and Severity='high' order by Severity"; 127 | }else if ($action == 'middle'){ 128 | $sql = "SELECT * FROM target_vul where hash='{$hash}' and Severity='middle' order by Severity"; 129 | }else if ($action == 'low'){ 130 | $sql = "SELECT * FROM target_vul where hash='{$hash}' and Severity='low' order by Severity"; 131 | } 132 | 133 | $results = $db->query($sql); 134 | if (mysql_num_rows($results) > 0){ 135 | $i = 1; 136 | while ($fs = $db->fetch_array($results)) 137 | { 138 | $id = $i; 139 | $Name = $fs["name"]; 140 | $Affects = $fs["affects"]; 141 | $Parameter = $fs["parameter"]; 142 | $Severity = $fs["severity"]; 143 | $details = $fs["details"]; 144 | $Request = str_replace("\n",'
',$fs["request"]); 145 | //$Response = str_replace("\n",'
',$fs["response"]); 146 | 147 | if (strtolower($Severity) == 'high'){ 148 | $class = 'error'; 149 | }else if(strtolower($Severity) == 'middle'){ 150 | $class = 'warning'; 151 | }else if(strtolower($Severity) == 'low' or strtolower($Severity) == 'info'){ 152 | $class = 'info'; 153 | } 154 | 155 | if ($Parameter == 'Array'){ 156 | $Parameter = ''; 157 | } 158 | 159 | if ($Request == 'Array'){ 160 | $Request = ''; 161 | } 162 | 163 | if ($Response == 'Array'){ 164 | $Response = ''; 165 | } 166 | 167 | $html_str .= " 168 | 169 | 170 | $id 171 | 172 | 173 | $Name 174 | 175 | 176 | $Severity 177 | 178 | 179 | $Affects 180 | 181 | 182 | $Parameter 183 | 184 | 185 | $details 186 | 187 | 188 | $Request 189 | 190 | \r\n"; 191 | $i ++; 192 | } 193 | 194 | return $html_str; 195 | }else{ 196 | return ""; 197 | } 198 | } 199 | 200 | function edit() { 201 | global $db; 202 | 203 | $hash = $_GET['p']; 204 | 205 | if (!empty($hash)){ 206 | $sql = "SELECT * FROM scan_list where hash='{$hash}'"; 207 | 208 | $results = $db->fetch_assoc($sql); 209 | 210 | return $results; 211 | } 212 | 213 | } 214 | 215 | function point() { 216 | global $db; 217 | 218 | $action = $_GET['c']; 219 | 220 | if ($action == 'new'){ 221 | //新添加 222 | //print_r($_POST); 223 | if(!empty($_POST['ip'])){ 224 | 225 | $in_arr['pointip'] = $_POST['ip']; 226 | $in_arr['pointport'] = $_POST['port']; 227 | $in_arr['status'] = $_POST['status']; 228 | $in_arr['hash'] = md5($in_arr['pointip'].$in_arr['pointport']); 229 | 230 | $insert = $db->insert_into("point_server",$in_arr); 231 | } 232 | }else if ($action == 'update'){ 233 | //更新 234 | //print_r($_POST); 235 | $key = $_GET['p']; 236 | if(!empty($_POST['ip']) and !empty($key)){ 237 | 238 | $in_arr['pointip'] = $_POST['ip']; 239 | $in_arr['pointport'] = $_POST['port']; 240 | $in_arr['status'] = $_POST['status']; 241 | 242 | $update = $db->update("point_server",$in_arr,"hash='{$key}'"); 243 | } 244 | } 245 | 246 | $sql = "SELECT * FROM point_server"; 247 | 248 | $results = $db->query($sql); 249 | if (mysql_num_rows($results) > 0){ 250 | $i = 1; 251 | while ($fs = $db->fetch_array($results)) 252 | { 253 | $id = $i; 254 | $ip = $fs["pointip"]; 255 | $port = $fs["pointport"]; 256 | $level = $fs["level"]; 257 | $status = $fs["status"]; 258 | $hash = $fs["hash"]; 259 | 260 | if ($status == '1'){ 261 | $class = 'success'; 262 | $status = '启用'; 263 | }else{ 264 | $class = 'warning'; 265 | $status = '禁用'; 266 | } 267 | 268 | $html_str .= " 269 | 270 | 271 | $id 272 | 273 | 274 | $ip 275 | 276 | 277 | $port 278 | 279 | 280 | $level 281 | 282 | 283 | $status 284 | 285 | 286 | 修改 287 | 288 | \r\n"; 289 | $i ++; 290 | } 291 | 292 | return $html_str; 293 | }else{ 294 | return ""; 295 | } 296 | 297 | } 298 | 299 | 300 | function set() { 301 | global $db; 302 | 303 | $action = $_GET['c']; 304 | 305 | if ($action == 'new'){ 306 | //新添加 307 | //print_r($_POST); 308 | if(!empty($_POST['username']) and !empty($_POST['passwd'])){ 309 | 310 | $in_arr['username'] = $_POST['username']; 311 | $in_arr['passwd'] = $_POST['passwd']; 312 | $in_arr['phone'] = $_POST['phone']; 313 | $in_arr['email'] = $_POST['mail']; 314 | $in_arr['status'] = $_POST['status']; 315 | $in_arr['ctime'] = time(); 316 | 317 | $insert = $db->insert_into("user",$in_arr); 318 | } 319 | }else if ($action == 'update'){ 320 | //更新 321 | //print_r($_POST); 322 | if(!empty($_POST['username'])){ 323 | 324 | $in_arr['username'] = $_POST['username']; 325 | //$in_arr['passwd'] = $_POST['passwd']; 326 | $in_arr['phone'] = $_POST['phone']; 327 | $in_arr['email'] = $_POST['mail']; 328 | $in_arr['status'] = $_POST['status']; 329 | 330 | $update = $db->update("user",$in_arr,"username='{$in_arr['username']}'"); 331 | } 332 | } 333 | 334 | $sql = "SELECT * FROM user"; 335 | 336 | $results = $db->query($sql); 337 | if (mysql_num_rows($results) > 0){ 338 | $i = 1; 339 | while ($fs = $db->fetch_array($results)) 340 | { 341 | $id = $i; 342 | $username = $fs["username"]; 343 | $email = $fs["email"]; 344 | $phone = $fs["phone"]; 345 | $status = $fs["status"]; 346 | $hash = md5($username); 347 | 348 | if ($status == '1'){ 349 | $class = 'success'; 350 | $status = '启用'; 351 | }else{ 352 | $class = 'warning'; 353 | $status = '禁用'; 354 | } 355 | 356 | $html_str .= " 357 | 358 | 359 | $id 360 | 361 | 362 | $username 363 | 364 | 365 | $email 366 | 367 | 368 | $phone 369 | 370 | 371 | $status 372 | 373 | 374 | 修改 375 | 376 | \r\n"; 377 | $i ++; 378 | } 379 | 380 | return $html_str; 381 | }else{ 382 | return ""; 383 | } 384 | 385 | } 386 | 387 | 388 | function login() { 389 | global $db; 390 | 391 | $username = $_POST['username']; 392 | $password = $_POST['password']; 393 | 394 | //print_r($_POST); 395 | 396 | if (!empty($username) and !empty($password)){ 397 | $sql = "SELECT * FROM `user` where username='{$username}' and passwd='{$password}'"; 398 | 399 | $results = $db->fetch_assoc($sql); 400 | $rows = $db->db_num_rows($sql); 401 | if ($rows > 0 and $results['status'] == 1){ 402 | $_SESSION['username'] = $results['username']; 403 | $_SESSION['r_ip'] = $_SERVER['REMOTE_ADDR']; 404 | 405 | $up_arr['lasttime'] = time(); 406 | $update = $db->update("user",$up_arr,"username='{$username}'"); 407 | 408 | Message(" $username 登录成功! 正在跳转... ","?m=index",0,3000); 409 | }else if ($rows > 0 and $results['status'] == 0){ 410 | Message(" 账号被禁用,请联系管理员 ","?m=login",0,3000); 411 | } 412 | } 413 | 414 | } 415 | 416 | function logout() { 417 | unset($_SESSION['username']); 418 | header("Location: ?m=login"); 419 | } 420 | 421 | ?> -------------------------------------------------------------------------------- /include/ip.conf: -------------------------------------------------------------------------------- 1 | |testphp.vulnweb.com -------------------------------------------------------------------------------- /include/mysql.class.php: -------------------------------------------------------------------------------- 1 | db_host = $db_host; 15 | $this->db_user = $db_user; 16 | $this->db_pass = $db_pass; 17 | $this->db_database = $db_databbse; 18 | $this->conn = $conn; 19 | $this->db_charset = $db_charset; 20 | $this->connect(); 21 | $this->db_pre = $db_pre; 22 | } 23 | 24 | //数据库连接 25 | private function connect() 26 | { 27 | $this->conn = mysql_connect($this->db_host,$this->db_user,$this->db_pass) or die("数据库连接错误"); 28 | MySQL_query("SET NAMES 'UTF8'"); 29 | mysql_select_db($this->db_database,$this->conn) or die("没有找到".$this->db_database."这个数据库"); 30 | 31 | } 32 | 33 | //数据库执行语句,可执行查询添加修改删除等任何SQL语句 34 | function query($sql) 35 | { 36 | $sql = str_replace("##_",$this->db_pre,$sql); 37 | $result = mysql_query($sql,$this->conn); 38 | if (!$result) { 39 | //调用中使用SQL语句出错时,会自动打印出来 40 | //echo "SQL语句错误:$sql
"; 41 | $k=fopen(LDINC."/data/mysqllog.txt","a+"); 42 | fwrite($k,date("Y-m-d H:i:s")."执行{$sql}出错,来源于".$_SERVER['REQUEST_URI']."\r\n"); 43 | fclose($k); 44 | // echo "SQL语句错误
"; 45 | } 46 | return $result; 47 | } 48 | 49 | function fetch_array($result = null) 50 | { 51 | $result = $result == null ? $this->result : $result; 52 | return mysql_fetch_array($result); 53 | } 54 | 55 | function fetch_row($result = null) 56 | { 57 | $result = $result == null ? $this->result : $result; 58 | return mysql_fetch_row($result);//mysql_fetch_array($result); 59 | } 60 | /** 61 | *根据select查询结果计算结果集条数 62 | */ 63 | function db_num_rows($sql) 64 | { 65 | $result=$this->query($sql); 66 | if(empty($result)) $result=0; 67 | return mysql_num_rows($result); 68 | } 69 | 70 | //查询一个表下所有的字段 71 | function findall($table) 72 | { 73 | $result = $this->query("select * from $table"); 74 | return $result; 75 | } 76 | 77 | //添加数据到数据库 78 | function insert_into($table,$array_value) 79 | { 80 | foreach ($array_value as $key=>$value) 81 | { 82 | $filed .= "`$key`,"; 83 | $val .= "'$value',"; 84 | } 85 | $filed = substr($filed,0,(strlen($filed)-1)); //替换最后一个逗号 86 | $val= substr($val,0,(strlen($val)-1)); //替换最后一个逗号 87 | $sql="INSERT INTO ".$table." ($filed) VALUES ($val)";//拼成SQL语句 88 | $this->query($sql); 89 | return mysql_insert_id(); 90 | } 91 | 92 | /** 93 | *函数从结果集中取得一行作为关联数组。返回根据从结果集取得的行生成的关联数组,如果没有更多行,则返回 false。 94 | */ 95 | function fetch_assoc($sql) 96 | { 97 | $res = $this->query ( $sql ); 98 | if ($res !== false) { 99 | return mysql_fetch_assoc ( $res ); 100 | } else { 101 | return false; 102 | } 103 | } 104 | 105 | function fetch_assoc1($sql) 106 | { 107 | $res = $this->query ( $sql ); 108 | if ($res !== false) { 109 | return mysql_fetch_assoc ( $res ); 110 | } else { 111 | return false; 112 | } 113 | } 114 | 115 | 116 | /** 117 | *更新数据库,$table代表着更新的表,$array_value更新的数组,$where条件 118 | */ 119 | function update($table,$array_value,$where) 120 | { 121 | foreach ($array_value as $key=>$value) 122 | { 123 | $upvalue .= "`$key`='$value',"; 124 | } 125 | $upvalue = substr($upvalue,0,(strlen($upvalue)-1)); //替换最后一个逗号 126 | $sql="update $table set $upvalue where $where"; //拼成SQL语句 127 | return $this->query($sql); 128 | } 129 | //获得错误描述 130 | function GetError() 131 | { 132 | $str = mysql_error(); 133 | return $str; 134 | } 135 | function free_result($query) { 136 | return @mysql_free_result($query); 137 | } 138 | function escape_string($str){ 139 | return mysql_escape_string($str); 140 | } 141 | //获取字段数 142 | function num_fields($query) { 143 | return mysql_num_fields($query); 144 | } 145 | //获取数据库版本 146 | function version() { 147 | return mysql_get_server_info($this->conn); 148 | } 149 | //删除数据库 150 | function delete($where) 151 | { 152 | $sql = "DELETE from $where"; 153 | return $this->query($sql); 154 | } 155 | //判断此条数据库语句是否存在记录 156 | function checknumsql($sql) 157 | { 158 | if($this->db_num_rows($sql) > 0) 159 | return true; 160 | else 161 | return false; 162 | } 163 | //查询一个表返回的值 164 | function listtablezd($table,$zd) 165 | { 166 | //echo "select $zd from $table
"; 167 | $arr = $this->fetch_array($this->query("select $zd from $table")); 168 | $str = $arr[$zd]; 169 | return $str; 170 | } 171 | 172 | //获取受影响的行数 173 | function Getaffected($sql) 174 | { 175 | $this->query($sql); 176 | $rc = mysql_affected_rows(); 177 | return $rc; 178 | } 179 | /** 180 | * 获取设置表某个字段 181 | */ 182 | function GetConfig($field) 183 | { 184 | return $this->listtablezd("##_config where id=1",$field); 185 | } 186 | } 187 | 188 | 189 | ?> -------------------------------------------------------------------------------- /include/sqlsafe.php: -------------------------------------------------------------------------------- 1 | |<|=|in|like)|\\/\\*.+?\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)"; 4 | private $postfilter = "\\b(and|or)\\b.{1,6}?(=|>|<|\\bin\\b|\\blike\\b)|\\/\\*.+?\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)"; 5 | private $cookiefilter = "\\b(and|or)\\b.{1,6}?(=|>|<|\\bin\\b|\\blike\\b)|\\/\\*.+?\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)"; 6 | /** 7 | * 构造函数 8 | */ 9 | public function __construct() { 10 | //echo "hi"; 11 | foreach($_GET as $key=>$value){$this->stopattack($key,$value,$this->getfilter);} 12 | foreach($_POST as $key=>$value){$this->stopattack($key,$value,$this->postfilter);} 13 | foreach($_COOKIE as $key=>$value){$this->stopattack($key,$value,$this->cookiefilter);} 14 | } 15 | /** 16 | * 参数检查并写日志 17 | */ 18 | public function stopattack($StrFiltKey, $StrFiltValue, $ArrFiltReq){ 19 | if(is_array($StrFiltValue))$StrFiltValue = implode($StrFiltValue); 20 | if (preg_match("/".$ArrFiltReq."/is",$StrFiltValue) == 1){ 21 | $this->writeslog($_SERVER["REMOTE_ADDR"]." ".strftime("%Y-%m-%d %H:%M:%S")." ".$_SERVER["PHP_SELF"]." ".$_SERVER["REQUEST_METHOD"]." ".$StrFiltKey." ".$StrFiltValue); 22 | echo('您提交的参数非法,系统已记录您的本次操作!'); 23 | exit(); 24 | } 25 | } 26 | /** 27 | * SQL注入日志 28 | */ 29 | public function writeslog($log){ 30 | $log_path = dirname(__FILE__).'\data\sqlinject_log.txt'; 31 | //echo $log_path; 32 | $ts = fopen($log_path,"a+"); 33 | fputs($ts,$log."\r\n"); 34 | fclose($ts); 35 | } 36 | } 37 | ?> -------------------------------------------------------------------------------- /include/vhost-demo.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8000; 3 | server_name #host#; 4 | 5 | location / { 6 | root html; 7 | index index.html index.htm; 8 | 9 | proxy_pass #url#; 10 | proxy_redirect off; 11 | proxy_set_header Host #host#; 12 | proxy_set_header X-Real-IP $remote_addr; 13 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 14 | proxy_set_header Cookie "#cookie#"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /include/xml.action.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibijj/AwvScan/59e725c001ff0f9d76ad89834af9b52bbb71479f/include/xml.action.php -------------------------------------------------------------------------------- /include/xml.class.php: -------------------------------------------------------------------------------- 1 | $val) { 49 | if($priority == 'tag') $attributes_data[$attr] = $val; 50 | else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' 51 | } 52 | } 53 | 54 | //See tag status and do the needed. 55 | if($type == "open") {//The starting of the tag '' 56 | $parent[$level-1] = &$current; 57 | if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag 58 | $current[$tag] = $result; 59 | if($attributes_data) $current[$tag. '_attr'] = $attributes_data; 60 | $repeated_tag_index[$tag.'_'.$level] = 1; 61 | 62 | $current = &$current[$tag]; 63 | 64 | } else { //There was another element with the same tag name 65 | 66 | if(isset($current[$tag][0])) {//If there is a 0th element it is already an array 67 | $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; 68 | $repeated_tag_index[$tag.'_'.$level]++; 69 | } else {//This section will make the value an array if multiple tags with the same name appear together 70 | $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array 71 | $repeated_tag_index[$tag.'_'.$level] = 2; 72 | 73 | if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well 74 | $current[$tag]['0_attr'] = $current[$tag.'_attr']; 75 | unset($current[$tag.'_attr']); 76 | } 77 | 78 | } 79 | $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1; 80 | $current = &$current[$tag][$last_item_index]; 81 | } 82 | 83 | } elseif($type == "complete") { //Tags that ends in 1 line '' 84 | //See if the key is already taken. 85 | if(!isset($current[$tag])) { //New Key 86 | $current[$tag] = $result; 87 | $repeated_tag_index[$tag.'_'.$level] = 1; 88 | if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data; 89 | 90 | } else { //If taken, put all things inside a list(array) 91 | if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array... 92 | 93 | // ...push the new element into that array. 94 | $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; 95 | 96 | if($priority == 'tag' and $get_attributes and $attributes_data) { 97 | $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; 98 | } 99 | $repeated_tag_index[$tag.'_'.$level]++; 100 | 101 | } else { //If it is not an array... 102 | $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value 103 | $repeated_tag_index[$tag.'_'.$level] = 1; 104 | if($priority == 'tag' and $get_attributes) { 105 | if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well 106 | 107 | $current[$tag]['0_attr'] = $current[$tag.'_attr']; 108 | unset($current[$tag.'_attr']); 109 | } 110 | 111 | if($attributes_data) { 112 | $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; 113 | } 114 | } 115 | $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken 116 | } 117 | } 118 | 119 | } elseif($type == 'close') { //End of tag '' 120 | $current = &$parent[$level-1]; 121 | } 122 | } 123 | 124 | return($xml_array); 125 | } 126 | ?> 127 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /js/action.js: -------------------------------------------------------------------------------- 1 | function cpasswd(){ 2 | 3 | if ( $('#newpasswd').val() == $('#repasswd').val() ) { 4 | 5 | //alert( $('#newpasswd').val() + $('#oldpasswd').val()); 6 | $.ajax({ 7 | type: "POST", 8 | url: "ajax.php?m=cpasswd", 9 | data: { oldpasswd: $('#oldpasswd').val() , newpasswd: $('#newpasswd').val() }, 10 | success: function(data) { alert(data); } 11 | }); 12 | } 13 | } 14 | 15 | function del(p){ 16 | 17 | //alert( p ); 18 | $.ajax({ 19 | type: "POST", 20 | url: "ajax.php?m=del", 21 | data: { hash : p }, 22 | success: function(data) { 23 | alert(data); 24 | window.location.reload(); 25 | } 26 | }); 27 | } 28 | 29 | function exportexcel(p){ 30 | window.location.href = 'ajax.php?m=export&hash=' + p; 31 | } -------------------------------------------------------------------------------- /js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Bootstrap.js by @fat & @mdo 3 | * plugins: bootstrap-transition.js, bootstrap-modal.js, bootstrap-dropdown.js, bootstrap-scrollspy.js, bootstrap-tab.js, bootstrap-tooltip.js, bootstrap-popover.js, bootstrap-affix.js, bootstrap-alert.js, bootstrap-button.js, bootstrap-collapse.js, bootstrap-carousel.js, bootstrap-typeahead.js 4 | * Copyright 2012 Twitter, Inc. 5 | * http://www.apache.org/licenses/LICENSE-2.0.txt 6 | */ 7 | !function(a){a(function(){a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in").attr("aria-hidden",!1),b.enforceFocus(),c?b.$element.one(a.support.transition.end,function(){b.$element.focus().trigger("shown")}):b.$element.focus().trigger("shown")})},hide:function(b){b&&b.preventDefault();var c=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),a.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var b=this;a(document).on("focusin.modal",function(a){b.$element[0]!==a.target&&!b.$element.has(a.target).length&&b.$element.focus()})},escape:function(){var a=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(b){b.which==27&&a.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),b.hideModal()},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),b.hideModal()})},hideModal:function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('